Document toolboxDocument toolbox

Header

Jenkins Integration

Qualitia Automation Studio (QAS) supports Jenkins, an open-source automation server written in Java. It is a cross-platform, continuous integration, and continuous delivery application that increases your productivity. 

You can integrate Qualitia to execute test cases through Jenkins.

📚Prerequisites

  1. In order to push results, the machine which you are using to trigger the test case execution must have access to the machine where Qualitia Server is installed.

  2. You must have access to port 8887 from the machine where Qualitia Server is installed.

  3. Qualitia must be installed.

  4. Projects, Testcases, and Suites must be created in QAS - client.

  5. Testcases must be in Published state.

Jenkins Installation

Jenkins can be installed using following two methods. However, Qualitia recommends installing Jenkins using the war file.

Installing Jenkins using war File

  1. Download Jenkins JDK 1.6, 1.7.

  2. Install JDK 1.6, 1.7.

  3. Do one of the following:

    1. If Java_Path is not added as Enviornment Variable: Open the Command Prompt window, navigate to the folder where you have downloaded JDK 1.6, 1.7,  and then navigate to the folder where you have downloaded Jenkins. 

    2. If Java_Path is added as Enviornment Variable: Open the Command Prompt window and navigate to the folder where you have downloaded Jenkins. 

  4. Execute the following command:
     java -Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self';img-src 'self'; style-src 'self' 'unsafe-inline'; child-src 'self'; frame-src 'self'; script-src 'self' 'unsafe-inline'; frame-ancestors 'self';" -jar jenkins.war.
    Default port is 8080.

Installing Jenkins as a Service

  1. Install JDK 1.6, 1.7.

  2. Download and Install Jenkins following the onscreen instructions.

  3. Once the installation process is completed, open the location where Jenkins is installed. 

  4. Open the jenkins.xml.

  5. Update the argument for %Base%\jre\bin\java as follows: -Dhudson.model.DirectoryBrowserSupport.CSP="default-src 'self';img-src 'self'; style-src 'self' 'unsafe-inline'; child-src 'self'; frame-src 'self'; script-src 'self' 'unsafe-inline'; frame-ancestors 'self';"  Do not remove the existing value. Just add to the existing value as displayed in the image above.
  6. Save and close the file.
     Restart the Jenkins service once you update the XML values from the Services.msc console.

Jenkins Configuration

Once you have installed Jenkins, you can proceed for Jenkins configurations.

  1. Launch Jenkins Instance.

  2. Enter the Administrator password.
    Take the Administrator password from the initialAdminPassword file located in the .jenkins\secrets folder.

  3. Click Continue.

  4. Click New Item on left-hand side to create a New Jenkins job.

image-20240123-055013.png
  1. Click OK to go to the Configuration page.

  2. To configure enter the Job Description under General settings.

  3. Now set up the build steps, go to the Build Steps tab

    1. Click Add a build step.

    2. If you are using a Windows machine, select Execute Windows batch command.

    3. In the Command text box, enter the command to execute qualitia-offline.xxxx.jar.

      image-20240123-060248.png
    4. First command hits Qualitia Bot API endpoints to generate a executionAgent.jar. This jar is bridge between CI tool (in this case Jenkins) and Qualitia Server for provided server URL.

    5. In second command, utilize this bridge and provide arguments to access required artifacts.

    6. The required parameters are:

      1. ServerUrl: The server URL where your server is hosted.

      2. ProjectName: The name of the project for which you want to execute testcases and suites.

      3. SuiteName: The name of the suite which you want to execute using Jenkins integration.

      4. Executiontrigger: The mode of execution that you want to trigger from Jenkins.

      5. You can provide any arguments using this command like browser, driver path, polling interval etc.

    7. During the execution, Qualitia engine creates a property file qer.properties which will help you to read report in CI/CD.

    8. Make sure to install Inject environment variables plugin to read this file. Once you install this plugin, select Inject environment variables option in Build Steps.

    9. Provide a complete path of qer.properties.

  4. Next step is to set up Post-build Actions to get an execution report.

    1. Go to Post-build Actions and click Add post-build action.

    2. To publish execution report, install Publish HTML Reports plugin.

    3. Select Publish HTML Reports option.

    4. Add values we read from qer.properties in previous step.

    5. To publish the report.

      • HTML directory to archive: Enter the HTML directory path where report exists. Provide variable present in qer.properties for HTML directory where report exists.

      • Index page[s]: Enter variable reportfilename in qer.properties. This is the page users want to publish.

      • Report title: Provide any name of your choice for the file.

      • Click Apply and then save the data by clicking Save.

         

    6. Once the setup is done. Click Build Now.

    7. If the job is successfully executed, it will publish a report in Jobs.

    8. Download the Zip file and take a glance at it. It downloads all the supported files for reports as well.

    9. You can also view the complete build history in the left pane under Build History.

🔧 Got a problem? Let’s fix!

Unable to view Qualitia Suite Execution Summary Report in Jenkins

Problem: After an offline suite is executed using a Jenkins Job, the associated suite execution report is not displayed in Jenkins Reports.

Description: When you open the published suite execution report in Jenkins, you see any of the following behavior:

  • A blank page opens

  • The following message is displayed:
    “You need to enable JavaScript to view this”

Solution 1:

You need to set up the content policy in Jenkins.

Perform the following steps:

  1. Open the Jenkins Server.

  2. Click Manage Jenkins >Manage Nodes.

  3. Click the Settings icon for the node that you are using (Master node by default).

  4. In the node page, select the Script Console option in the side menu.

  5. In the script console, enter the following command line: System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "default-src 'self' 'unsafe-inline';")

  6. Click the Run button below to this console, and you should see the Result: with the above values printed.
    Note: If you don’t see it in the first attempt, then retry this step.
    You can now see the suite execution summary reports.

Solution 2:

The report does not load as by default the JavaScript is disabled in the latest version of Jenkin's.

Therefore, if Solution 1 does not work and the inline script fails to bypass the Content Security Policy (CSP), the alternative method is to enable the Chrome extension for CSP.

Steps to enable the Crome extension for CSP:

  1. Open the Crome browser.

  2. Navigate to Extensions and add https://chromewebstore.google.com/detail/disable-content-security/ieelmcmcagommplceebfedjlakkhpden?utm_source=ext_app_menu.

  3. Adding this extension will disable the Content Security Policy, and you will be able to view the execution report.

 

📞📚 Here to Help: Support and Resources

Need a helping hand? Don't hesitate to reach out to your Qualitia Relationship Manager. For more resources, our official Qualitia documentation and community website are just a click away!

Add label

Footer