There are 4 ways to run unit tests:
- Using the context menu in the Unit Test object
- Using Test Explorer on GeneXus IDE
- Using the “Run after build” option
- Or using a CI/CD tool via msbuild.exe
Right click on the unit test object's tab and then select "Run unit test" option
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 window, 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)
- The time of the test when started
- The list of each assertion executed containing expected and obtained results.
This window is used to understand test results when they fail.
This mode enables developers to run unit tests on a 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 tests to fail almost immediately.
You can turn this feature on in Test Settings inside GeneXus 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 runs all tests after each commit, or you can add them on specific instances that are suitable for your QA process.