2 minute read time

How to Run UFT One Tests from GitLab

by   in DevOps Cloud (ADM)

Many UFT One users manage their continuous integration through GitLab. Configuring GitLab to run UFT One tests as part of a CI pipeline takes just a few simple steps. This blog post, from Dorin Bogdan and Ioana Tarau in the UFT One R&D team, explains how you can configure your GitLab instance to run UFT One tests.

Step 1: Add an SSH Key to GitLab

You will need to generate an SSH key and add it to GitLab so that it can communicate securely with your computer:

1. Open a terminal window.

2. Type ssh-keygen -t followed by the key type and an optional comment. This comment will be included in the .pub file that’s created. You may want to use an email address for the comment:

          ssh-keygen -t ed25519 -C "<comment>"

               For more information, see:  https://docs.gitlab.com/ee/ssh/

3. Go to the newly generated file (eg. C:\Users\ITarau\.ssh) and open the .pub file with notepad. Copy the content and go to GitLab.

4. Go to User Settings.

5. On the left panel click on SSH key.

6. Paste what you had copied in the Key edit box. Insert a title and click on Add key:

Step 2: Install and Configure Runners

To run pipelines in GitLab, we need runners. For installation and configuration follow the steps in this video:

https://www.youtube.com/watch?v=2MBhxk2chhM

Step 3: Run UFT tests

Before you can run the tests, you need a GitLab project that contains UFT tests, and FTToolsLauncher.exe. You can download FTToolsLauncher.exe from https://github.com/MicroFocus/ADM-FT-ToolsLauncher/releases/, by selecting the latest release. We recommend that you download version FTToolsLauncher_net48.exe.

Make sure that UFT One is installed on the machine that will run the tests (the runner machine)

Follow these steps to run the tests:

1. Open your GitLab project.

2. Go to CI/CD -> Editor.

3. Use the following script to run a test:

stages:
    - build
    - test

build:
    stage: build
    script:
        - echo "Building"
        - mkdir build
        - Set-Content -Path ./build/Props.txt -
Value "runType=FileSystem"
        - Add-Content -Path ./build/Props.txt -
Value "resultsFilename=build\\Results.xml"
        - Add-Content -Path ./build/Props.txt -Value (("Test1=$PWD" -replace '\\', '\\') + "\\UFT_Tests\\QuickPass")
        - Get-Content -Path ./build/Props.txt

    artifacts:
        paths:
            - build/
test:
    stage: test
    script:
        - echo "Testing"
        - echo $PWD
        - Test-Path "./build/Props.txt" -PathType leaf
        - Get-Content -Path ./build/Props.txt
        - Start-Process -FilePath "./FTToolsLauncher.exe" -ArgumentList "-paramfile ./build/Props.txt" -Wait *>&1
        - echo "Please check the [$PWD\build\Results.xml] file."

4. Click on commit changes

5. After running the pipeline, the UFT One test report can be found on the runner machine in the Git-Runner folder inside the UFT tests folder.

For example, C:\GitLab-Runner\builds\AsBJQfSZ\0\IoanaTarau1\my-simple-pipeline\UFT_Tests\QuickPass\Report2

Conclusion

Configuring GitLab to run UFT One tests is quite simple and consists of only a few, easy-to-follow steps.

To learn more about UFT One, visit the UFT One product page, or browse the UFT One Online Help. Click here for a free 30-day trial of UFT One.

Labels:

Functional Testing
  • Hi Dorin ,

    thanks ,that worked and sorted the issue , But when it comes to reporting it always overrides the Report everytime a run is made

    Ex: Run 1 

    It created Report 1 folder 

    Run 2 

    It overrides the same report 1 folder again 

    Can you help me out to get the new report folder when ever new test is executed 

  • Hi,

    Please update the Start-Process statement from the script to use absolute local paths, for example I have this:

    Start-Process -FilePath "D:\Work\GitLab\Runner\FTToolsLauncher.exe" -ArgumentList "-paramfile $PWD/build/Props.txt" -Wait *>&1
    Make sure you have the FTToolsLauncher.exe in that location.
  • Hi Dorin , I tried to configure and run the tests but seems to have an issue 

    $ Test-Path "./build/Props.txt" -PathType leaf
    True
    $ Get-Content -Path ./build/Props.txt
    runType=FileSystem
    resultsFilename=build\\Results.xml
    Test1=C:\\GitLab-Runner\\builds\\7afbc9fd\\0\\SQS_Functional-Testing\\OTS_FFETestScripts\\Regression\\FFE\\DASH_001_Verify Dashboard actions
    $ Start-Process -FilePath "./FTToolsLauncher.exe" -ArgumentList "-paramfile ./build/Props.txt" -Wait *>&1
    Start-Process : This command cannot be run due to the error: The system cannot
    find the file specified.
    At line:1 char:1
    + Start-Process -FilePath "./FTToolsLauncher.exe" -ArgumentList "-param ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [Start-Process], InvalidOp
    erationException
    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.C
    ommands.StartProcessCommand

    <Objs Version="1.1.0.1" xmlns="">schemas.microsoft.com/.../04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>Cleaning up project directory and file based variables
    #< CLIXML
    <Objs Version="1.1.0.1" xmlns="">schemas.microsoft.com/.../04"><Obj S="progress" RefId="0"><TN RefId="0"><T>System.Management.Automation.PSCustomObject</T><T>System.Object</T></TN><MS><I64 N="SourceId">1</I64><PR N="Record"><AV>Preparing modules for first use.</AV><AI>0</AI><Nil /><PI>-1</PI><PC>-1</PC><T>Completed</T><SR>-1</SR><SD> </SD></PR></MS></Obj></Objs>ERROR: Job failed: exit status 1

  • Hello,

    If possible please provide more details.

    The YML script, the Props.txt file and the console output logs.

    Best regards,

    Dorin.

  • Hello

    I have tried the above steps and still the pipeline is failing.

    is there any update on any of these steps to get it working?

    I am trying to Intregrate UFT with Git\Lab Pipelines.

    Thanks