Running Unit tests

Official Content

There are 4 ways to run unit tests: 

  1. Using the context menu in the Unit Test object
  2. Using Test Explorer on GeneXus IDE
  3. Using the “Run after build” option
  4. Or using a CI/CD tool via msbuild.exe

1 - Using the context menu in the Unit Test object

Right-click on the unit test object's tab and then select "Run unit test" option

rununittest_gif

2 - 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 window, and select each one you want to run, then press the Run button to execute tests and see the results. 

image_2019410153054_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)
  • 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. 

3 - Using the “Run after build” option

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. 

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 runs all tests after each commit, or you can add them on specific instances that are suitable for your QA process. 

Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.