There are 4 ways to run unit tests:
- Using Test Explorer on GeneXus IDE
- Using “Run after build” option
- Using "Run all test" option
- Or using a CI/CD tool via msbuild.exe
Tests Explorer is a tree view containing all the tests that are currently in your knowledge base. To run the test from GeneXus IDE, go to Tests Explorer windows, and select each one you want to run, then press the Run button to execute tests and see the results.
Each time you run test cases from GeneXus IDE, you will find useful to take a look at the “Tests Results” window, which contains the list of test results grouped by results.
Each test name contains the time where the test ran and elapsed time.
After selecting each test, Execution detail panel appears showing:
- Test Result (pass/fail)
- Time the test was started
- Elapsed time
- The list of each assertion executed containing expected and real results.
This window is used to understand tests results when they fail.
This mode enables developers to run unit tests on local (IDE) environment after each build.
Once your team created some unit tests, you may find interesting to run them all automatically, enabling developers to understand if they made a mistake causing some test to fail almost immediately.
You can turn this feature on in Test Settings inside GeneXus IDE.
This option enables developers to run all unit tests existing inside opened KB (on IDE).
The best way to run unit tests is to integrate them on your Continuous Integration cycle, so you can trust that each change that has been sent to GXserver will be tested using this framework.
This means, that you can add a step in your cycle that automatically run all tests after each commit, or you can add them on specific instances that is suitable for your QA process.