add() method from fcf.NUnitest.Unitest class
Package: fcf-framework-unitest
File: fcf-framework-unitest:unitest.js
Available from version: 1.0.1
Registers a test
Instead of the
Arguments
- The name of the test part. The testing section allows you to separate tests, for example, into basic tests that do not require the application to run, and application tests that require the entire application to run.
- Test group name
- Test name
- Test function
Function signature: [simple or async] a_cbtest(
Example: Function application
let fcf = require("fcf-framework-core");
let unitest = require("fcf-framework-unitest");
function testedFunction(){
return 1;
}
unitest .add ("Some test", (a_unitest )=>{
a_unitest .equal (testedFunction(), 1);
});
unitest .run ()
.finally (()=>{
process.exit(0);
});
Output:
2023-05-08 05:18:09.699 [PID:83750] [LOG] [MOD:UniTest]: ====================================================
2023-05-08 05:18:09.704 [PID:83750] [LOG] [MOD:UniTest]: Start testing on the server side...
2023-05-08 05:18:09.705 [PID:83750] [LOG] [MOD:UniTest]: Parts: *
2023-05-08 05:18:09.706 [PID:83750] [LOG] [MOD:UniTest]: Groups: *
2023-05-08 05:18:09.706 [PID:83750] [LOG] [MOD:UniTest]: Tests: *
2023-05-08 05:18:09.707 [PID:83750] [LOG] [MOD:UniTest]:
2023-05-08 05:18:09.707 [PID:83750] [LOG] [MOD:UniTest]: Start local tests...
2023-05-08 05:18:09.708 [PID:83750] [LOG] [MOD:UniTest]: --------------------
2023-05-08 05:18:09.708 [PID:83750] [LOG] [MOD:UniTest]: Test [default][default][Some test] running ...
2023-05-08 05:18:09.709 [PID:83750] [LOG] [MOD:UniTest]: Test [default][default][Some test] is completed.
2023-05-08 05:18:09.710 [PID:83750] [LOG] [MOD:UniTest]:
2023-05-08 05:18:09.710 [PID:83750] [LOG] [MOD:UniTest]: ----------------------------------------------------
2023-05-08 05:18:09.711 [PID:83750] [LOG] [MOD:UniTest]: 1 test have been completed.
2023-05-08 05:18:09.711 [PID:83750] [LOG] [MOD:UniTest]: Errors: 0; Successfully: 1; Total: 1