Contents

Running Unit tests

Unofficial Content

There are 4 ways to run unit tests: 

  1. Using Test Explorer on GeneXus IDE
  2. Using “Run after build” option
  3. Using "Run all test" option
  4. Or using a CI/CD tool via msbuild.exe

1 - Using the Tests Explorer 

image_2018315111332_1_png

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. 

image_2018315111414_1_png

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. 

2 - Using “Run after build” option

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. 

3 - Using "Run all test" option

This option enables developers to run all unit tests existing inside opened KB (on IDE).

4 - Using a CI/CD tool 

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.