comp • gb.test • test • main

Test.Main (gb.test)

Static Sub Main ( [ Tests As String ] )

The static procedure Test.Main() runs tests. By default it runs all tests (aka testmethods) in all testmodules of a project ordered by name and prints the result to stdout.

A testmodule is a special class with the ending test. It must contain at minimum one test.

A test is a public sub in a testmodule whose name does not contain an underscore.

On the command line the interpreter is commanded with this line to execute Test.Main():

gbx3 -T "" /path/to/project

The optional argument ca be used to create a testsuite which chooses any combination of testmodule and test(s). The format of the string is like so: Testmodules are separated by a comma. If not all tests of a testmodule should be called then the name of the testmodule is followed by a dot and a string containing the tests separated by a semikolon. For example:

gbx3 -T "testmodule1,testmodule2.test1;test2,testmodule3" /path/to/project

In the Gambas IDE one is able to define testsuites and store them with a individual name in a file named ".test" in the project's path.

A test suite stored like that can be called by it's name with a preceeding "@", for example:

gbx3 -T "$My production testsuite1" /path/to/project

Public methods called "_Setup", "_Teardown", "_SetupEach" or "_TeardownEach" inside a testmodule can be used to create a testfixture, which defines a special environment for the tests.