3. The Zanebug Console

The Zanebug Console provides command line access for running tests. There are several options available via command line.

To start the Zanebug Console, you'll need to get to the command line. For most computers, you can do the following (it will depend on your operating system):

  1. Go to Start -> Run

  2. Type cmd in the box

  3. When the command prompt appears, type the following (replace C:\Program Files\Zanebug with your install dir):

    > cd "C:\Program Files\Zanebug"
  4. You should now see the following:

    C:\Program Files\Zanebug>
  5. Now, call the Zanebug.Console.exe, with any of the options provided below. Here is an example:

    C:\Program Files\Zanebug>Zanebug.Console.exe /assemblies:"C:\Program Files\Zaneb
    ug\Zanebug.Tests.dll"

    Example output:

    C:\Program Files\Zanebug>Zanebug.Console.exe /assemblies:"C:\Program Files\Zaneb
    ug\Zanebug.Tests.dll"
    Running Zanebug v1.5.0
    Please wait...
    TestFixtureSetUp
    TestFixtureTearDown
    
    DATE: 1/2/2005 9:37:31 PM
    ========================================
    Zanebug.Tests
    ========================================
    C:\Program Files\Zanebug\
    Passed: 16
    Failed: 1
    Ignored: 2
    Percent Passed: 94.12 %
    Avg Duration: 0.00452460649258675
    Total Duration: 0.00452460649258675
    # of Iterations: 1
    
    
    ========================================
    SUMMARY
    ========================================
    P        F        I
    16       1        2
    Percent Failed: 94.12 %
    
    
    C:\Program Files\Zanebug>

    In the Summary section, the P, F and I stand for Passed, Failed and Ignored.

3.1. console.bat

Now that you've seen the hard way to do it, there's a much simpler way. The C:\Program Files\Zanebug folder contains a console.bat file. If you click on it, it will automatically launch the Zanebug Console. You can edit it for your needs. This is much simpler than manually navigating to the Zanebug Console via command line. However, this will not meet all needs, which is why you had to suffer through the tutorial above. :-)

3.2. Options

Below is a list of the various command line options

Table 5. Command Line Options

NameDescription
/helpDisplays all of the command line switch options
/file: [filename]Will run all assemblies listed in the file
/assemblies: [assemblies]Will run all assemblies listed. Separate assemblies using the ;
/testfixtures: [names]Will run the listed TestFixtures, and ignore the rest. The name should be the full class name (Ex: Namespace.SubNamespace.Class). Case insensitive. Separate TestFixtures using the ;
/tests: [names]Will run the listed Tests, and ignore the rest. The name should be the full method name (Ex: Namespace.SubNamespace.Class.MethodName). Case insensitive. Separate Tests using the ;

Note

If you specify a /testfixtures filter, then the engine will only look for matching /tests within the specified /testfixtures...all others will be ignored

/showdetailWill show a breakdown of individual test results
/showoutputWill show any console output for each test. /showdetail must be selected
/showfailureWill show any error or exception messages for each test. /showdetail must be selected
/showxmlWill show the test results in xml format
/save: [file]Saves the text formatted results to the specified file
/savexml: [file]Saves the XML formatted results to the specified file

3.3. Examples

Below are examples for each command line switch

3.3.1. /help

C:\Program Files\Zanebug>Zanebug.Console.exe /help

3.3.2. /file

You can list tests to run in a simple text file, with an assembly listed on each line. Here is an example:

Example 1. example.txt

C:\Program Files\Zanebug\Examples\Examples.NUnit.v214\bin\Debug\Examples.NUnit.v214.dll
C:\Program Files\Zanebug\Examples\Examples.NUnit.v220\bin\Debug\Examples.NUnit.v220.dll
C:\Program Files\Zanebug\Examples\Examples.Zanebug.v141\bin\Debug\Examples.Zanebug.v141.dll
C:\Program Files\Zanebug\Examples\Examples.Zanebug.v142\bin\Debug\Examples.Zanebug.v142.dll

Now, you can simply run the tests for all of the above assemblies via the command line

C:\Program Files\Zanebug>Zanebug.Console.exe /file:example.txt

3.3.3. /assemblies

If you don't want to load tests via the /file command, then you can load them using the /assemblies command. The /assemblies command allows you to list all test assemblies on the command line separated by a ;

Loading 1 assembly

C:\Program Files\Zanebug>Zanebug.Console.exe /assemblies:C:\test\sometest.dll

Loading multiple assemblies

C:\Program Files\Zanebug>Zanebug.Console.exe /assemblies:C:\test\sometest.dll;C:\test\sometest2.dll

Note

If the path to your test assembly contains a space, then you must surround it in quotes. Example:

C:\Program Files\Zanebug>Zanebug.Console.exe 
/assemblies:"C:\test\spaced folder\sometest.dll";C:\test\sometest2.dll

3.3.4. /testfixtures

The /testfixtures command specifies which TestFixtures to run in an assembly. The name that you provide should be the fully qualified name of the TestFixture class.

C:\Program Files\Zanebug>Zanebug.Console.exe /assemblies:C:\test\sometest.dll 
/testfixtures:SomeNamespace.SomeTestFixture

This will run all of the Test methods contained in SomeNamespace.SomeTestFixture

Important

The name of the specified test fixtures must be the full name, including namespace. Casing doesn't matter.

3.3.5. /tests

The /tests command specifies which Tests to run in an assembly. It can be used with or without the /testfixtures switch.

Using the /tests switch in combination with the /testfixtures switch means that only the specified TestFixtures should be loaded, and only the specified tests within those TestFixtures will be loaded. If you provide a name of a test that isn't in the specified /testfixtures, it will be ignored:

C:\Program Files\Zanebug>Zanebug.Console.exe /assemblies:C:\test\sometest.dll 
/testfixtures:SomeNamespace.SomeTestFixture 
/tests:SomeNamespace.SomeTestFixture.MyTest;SomeNamespace.SomeTestFixture.JoesTest

This will run MyTest and JoesTest, contained in SomeTestFixture. Everything else will be ignored.

Tip

Using /tests in combination with /testfixtures provides a performance improvement, since it limits the number of TestFixtures that are traversed for matching Tests.

Using the /tests switch alone will look through every TestFixture in each TestAssembly listed and run the specified test.

C:\Program Files\Zanebug>Zanebug.Console.exe /assemblies:C:\test\sometest.dll 
/tests:SomeNamespace.SomeTestFixture.MyTest;SomeNamespace.SomeTestFixture.JoesTest

This will search all of sometest.dll for a match, and run the specified tests.

Important

The name of the specified tests must be the full name, including namespace. Casing doesn't matter.

3.3.6. /showdetail

Without the /showdetail command, the results will only focus on the results for an assembly, and the overall results. With the /showdetail switch, results for individual tests will be shown.

C:\Program Files\Zanebug>Zanebug.Console.exe /assemblies:C:\test\sometest.dll /showdetail

Example output:

C:\Program Files\Zanebug>Zanebug.Console.exe /assemblies:"C:\Program Files\Zaneb
ug\Examples\Examples.Zanebug.v142\bin\Debug\Examples.Zanebug.v142.dll" /showdetail
Running Zanebug v1.4.2
Please wait...

DATE: 1/2/2005 9:42:30 PM
========================================
Examples.Zanebug.v142
========================================
C:\Program Files\Zanebug\Examples\Examples.Zanebug.v142\bin\Debug
Passed: 16
Failed: 1
Ignored: 2
Percent Passed: 94.12 %
Avg Duration: 0.00648279076142828
Total Duration: 0.00648279076142828
# of Iterations: 1

        +++Examples.Zanebug.v142 - Fail
                ++Attributes - Fail
                        +FailExpectedException - Fail
                Iteration: 1
                        +RepeatWithDelay - Pass
                Iteration: 2
                        +RepeatWithDelay - Pass
                Iteration: 3
                        +RepeatWithDelay - Pass
                Iteration: 4
                        +RepeatWithDelay - Pass
                Iteration: 5
                        +RepeatWithDelay - Pass
                        +MaxKMemory - Pass
                        +TestWithCategory - Pass
                        +IgnoreWithReason - Ignore
                Iteration: 1
                        +Repeat - Pass
                Iteration: 2
                        +Repeat - Pass
                Iteration: 3
                        +Repeat - Pass
                Iteration: 4
                        +Repeat - Pass
                Iteration: 5
                        +Repeat - Pass
                        +ExpectedDivideByZeroException - Pass
                        +ExpectedException - Pass
                        +SimpleTest - Pass
                        +MinOperationsPerSecond - Pass
                        +Ignore - Ignore

========================================
SUMMARY
========================================
P      F      I
16     1      2
Percent Passed: 94.12 %



C:\Program Files\Zanebug>

3.3.7. /showoutput

Show output will show the console output for each test.

Note

/showdetail must be selected

C:\Program Files\Zanebug>Zanebug.Console.exe /assemblies:C:\test\sometest.dll 
/showdetail /showoutput

3.3.8. /showfailure

/showfailure will show the error and exception messages for each test

Note

/showdetail must be selected

C:\Program Files\Zanebug>Zanebug.Console.exe /assemblies:C:\test\sometest.dll 
/showdetail /showfailure

Combined with /showoutput

C:\Program Files\Zanebug>Zanebug.Console.exe /assemblies:C:\test\sometest.dll 
/showdetail /showfailure /showoutput

3.3.9. /showxml

/showxml will show the results in xml format

C:\Program Files\Zanebug>Zanebug.Console.exe /assemblies:C:\test\sometest.dll /showxml

3.3.10. /save

/save allows you to save the results in well-formatted text to a file

C:\Program Files\Zanebug>Zanebug.Console.exe /file:assemblies.txt /save:output.txt

3.3.11. /savexml

/savexml allows you to save the results in XML format to a file

C:\Program Files\Zanebug>Zanebug.Console.exe /file:assemblies.txt /savexml:output.xml