Grouping Tests - J Query

Problem
You’ve split up all of your tests to keep them atomic and free of side effects, but you want to keep them logically organized and be able to run a specific group of tests on their own.

Solution
You can use the module() function to group tests together:

All tests that occur after a call to module() will be grouped into that module. The test names will all be preceded by the module name in the test results. You can then use that module name to select tests to run (see Recipe (Selecting Tests to Run)).

Discussion
In addition to grouping tests, module() can be used to extract common code from tests within that module. The module() function takes an optional second parameter to define functions to run before and after each test within the module:

You can specify both setup and teardown properties together, or just one of them.
Calling module() again without the additional argument will simply reset any setup/ teardown functions defined by another module previously.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

J Query Topics