Unofficial Content

GXUnit3 - How it Works

You create procedures that have the goal of testing a certain functionality - the granularity of the functionality to test is your call, but the intent is to test "units".

(To see how to write test see GXUnit3_WriteATest)

You organize your tests in suites - the suite will group related tests so that they are easier to manage. 

The programs that execute the tests are included in the KB when you start using GXUnit, but there is one of them (the test-loader) that will be regenerated every time you select tests to run.

Tests are selected in the GXUnit tool-window

i2017_03_24_21_14_029_png

When you hit Test the GXUnit_LoadTests gets regenerated with the selected tests - for example:

/*
Loads the tests to be executed.
This program is overwitten every time GXTest executes

Created Automatically by GXUnit
*/

//Output File
&ResultFileName='C:\CCData\CSD_CI\Trunk\CSD_CI\CSharpModel\web\GXUnitResults\GXUniPR_20170324_181251.xml'

&GXUnitSuiteCollection = new()
&GXUnitSuiteCollection.Add(&GXUnitSuite)

&GXUnitSuite = new()
&GXUnitSuite.SuiteName = 'LoginTest'

&GXUnitTestCase = new()
&GXUnitTestCase.TestName = 'TestLoginValidate_InvalidBlankUser_ReturnExcep'
&GXUnitSuite.TestCases.Add(&GXUnitTestCase)

&GXUnitSuiteCollection.Add(&GXUnitSuite)

//Add Calls for Static-Link
if false
    TestLoginValidate_InvalidBlankUser_ReturnExcep()
endif

In the CCNet output if this test runs you would see something like this in the case of a successful run

i2017_03_24_21_28_4310_png

and something like this in the case it fails

i2017_03_24_21_32_5511_png

 

Note that if you want to keep running the same tests you don't need to run them from the GXUnit window - it is enough to execute the GXUnit_RunTests procedure. You can compile this program and run it from the command prompt as well (to run tests automatically without the need of the GeneXus IDE)

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant