Running UI tests under CI

Official Content

In the same way that you will use GeneXus Tasks such as OpenKB, BuildAll, RebuildAll, etc. for handling Knowledge Base tasks and Team Development Tasks for handling GXServer, in order to run UI tests, you will need to call some extra task/step. You can take a look at the documentation of these tasks here.

How-to Run All your UI Tests in your KB

GXtest.msbuild: Let's assume that this is the filename of the MSBuild File that you are building to run UI Tests.

In the beginning, you will need to import two MSBuild projects that contain predefined tasks that you are going to use on your file. Those projects are GeneXus.Tasks.targets and GXtest.targets.

The following is an example of an MSBuild file:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(GX_PROGRAM_DIR)\GeneXus.Tasks.targets"/>
  <Import Project="$(GX_PROGRAM_DIR)\GXtest.targets"/>

  <Target Name="RunAllTests">
    <OpenKnowledgeBase Directory="$(KBPath)"/>
    <SetActiveEnvironment EnvironmentName="$(EnvironmentName)"/>
    <UpdateTestRefs Type="$(TestType)" ServerUserName="$(GXUser)" ServerPassword="$(GXPass)"/>
    <BuildOne BuildCalled="true" ObjectName="Runner"/>
    <RunTests Type="$(TestType)" ServerUserName="$(GXUser)" ServerPassword="$(GXPass)"/>
    <CloseKnowledgeBase/>
  </Target>
</Project>

Having this file configured properly, you can launch all UI tests using this command line:

MSBuild.exe /t:RunAllTests /p:KBPath="C:\Models\KbTests" /p:EnvironmentName="CSharpWeb" /p:TestType="UI" /p:GXUser="local\admin" /p:GXPass="password" $env:GX_PROGRAM_DIR"\GXtest.msbuild"

How to Run a Test List (suite) of your KB

As well as the task Run All Tests, you will need to configure a MSBuild file as is showed below:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(GX_PROGRAM_DIR)\GeneXus.Tasks.targets"/>
<Import Project="$(GX_PROGRAM_DIR)\GXtest.targets"/>

<Target Name="RunTestsList">
    <OpenKnowledgeBase Directory="$(KBPath)"/>
    <SetActiveEnvironment EnvironmentName="$(EnvironmentName)"/>
    <UpdateTestRefs ExecutionDataFilePath="$(pathToJSON)" ServerUserName="$(GXUser)" ServerPassword="$(GXPass)"/>
    <BuildOne BuildCalled="true" ObjectName="Runner"/>
    <RunTestsList ExecutionDataFilePath="$(pathToJSON)" ServerUserName="$(GXUser)" ServerPassword="$(GXPass)"/>
    <CloseKnowledgeBase/>
</Target>
</Project>

Having this file configured properly, you can run a specific UI tests list using this command line:

MSBuild.exe /t:RunTestsList 
/p:KBPath="C:\Models\KbTests"
/p:EnvironmentName="CSharpWeb"
/p:pathToJSON="C:\Models\KBTests\TestList.json"
/p:GXUser="local\admin" /p:GXPass="password"
$env:GX_PROGRAM_DIR"\GXtest.msbuild"

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