tc
Test case runner.
Test case files
Create the directory with testCases. Each file with testCase must contains '.case.' in the name.
caseDir/
tc.conf.js //optional
A.case.js
B.case.js
TestCase file structure
//in
test case text (js code by default)
//out
expected result
For example:
//intc;tc;//out44
Method 'tc.out' accumulates results. Each call creates the new line.
You can run testCases from command line:
node tc/bin/tc caseDir
or from js:
;
Config file - tc.conf.js
Config file should return the object with next fields:
- exec(inText, tc, callback) - function for testCase execution.
- 'inText' - text from testCase between '//in' and '//out'.
- 'tc' - testCase object.
- 'tc.out' - this method accumulates results.
- 'tc.fixPath' - can be used for resolving of relative path.
- 'callback' - must be called for finish of test.
- [beforeEach(tc, callback)] - function will be called before each testCase.
- 'tc' - testCase object.
- 'tc.out' - this method accumulates results.
- 'tc.fixPath' - can be used for resolving of relative path.
- 'callback' - callback.
- 'tc' - testCase object.
- [afterEach(tc, callback)] - function will be called after each testCase.
- 'tc' - testCase object.
- 'tc.out' - this method accumulates results.
- 'tc.fixPath' - can be used for resolving of relative path.
- 'callback' - callback.
- 'tc' - testCase object.
For example:
{ tc; ; }
'exec' can be the name of predefined executer.
exec: 'async'
'exec' can send Error object to callback.
{ // do something if smfWrong else ; }
You can use code from another files. You should use 'conf.fixPath' for resolving of relative path.
exec: exec
Example
See more examples in the test directory.