Feature - Parallel
Description
GINT provides automatic running of testcases in parallel
. This can significantly reduce run time for tests making it possible to run more tests more often. This performance advantage can introduce a level of complexity in test scripts. GINT provides capabilities to minimize and manage this potential complexity. GINT also supports simple serial running of testcases by a simple parameter setting. The performance benefits of parallel running vary greatly depending on the testing situation.
If your testcases are totally independent of each other, parallelism will not add any complexity! While this is good in principle and more easy to accomplish in unit testing, it is simply is not practical in many integration test scenarios. The key is to manage dependencies easily.
Using
The following Parameters and Functions control parallelism for a test run:
- maxParallel - defaults to 8. Controls the maximum number of concurrent testcases.
- maxThreads - defaults to maxParallel. Controls the maximum number of inline testcases that can be run concurrently.
The following Testcase parameters are involved in managing a parallel run environment:
- depends - a list of testcase names that must run before this testcase. This is useful even in a serial run environment to document testcase dependencies. In a parallel run environment, it ensures that testcases are not run before dependent testcases are complete.
- end - a list of testcase names that must be ended before this testcase runs. There is a subtle difference with depends in that a testcase on the end list will not be started, only ended if it is currently running. The most common usage of end is to specify end: true to end all started testcase before starting this testcase.
Details
There are differences in how parallelism works depending on whether a testcase is command or inline* based.
Each command testcase is run as a separate process with output managed by GINT. This output can be analysed for data (see Feature - Automatic Comparisons). Output for each testcase will be displayed contiguously in the log when the testcase is ended.
Each inline testcase is run in its own thread. Output to standard output will appear in the log at the time it is produced. Standard output data is not available to GINT for further analyses. Also, with threading, accesses to global information must be thread safe - this can be as simple as using synchronized qualifier on closures and functions. Use maxThread=1 if necessary.
Problem determination
If you suspect your test is failing because of parallelism, use -DmaxParallel=1 to run to verify. Normally, the problem will be do to testcase dependencies that are not defined. Use -Dverbose or -v on the command line to see more information on the running of the tests.
© 2005 -2024 gint.org