DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Related

  • Testcontainers: From Zero To Hero [Video]
  • Java CI/CD: From Local Build to Jenkins Continuous Integration
  • Recipe To Implement the Jenkins Pipeline For MuleSoft Application [Videos]
  • Integrating Jenkins With Playwright TypeScript: A Complete Guide

Trending

  • Developers Beware: Slopsquatting and Vibe Coding Can Increase Risk of AI-Powered Attacks
  • Intro to RAG: Foundations of Retrieval Augmented Generation, Part 1
  • How to Build Real-Time BI Systems: Architecture, Code, and Best Practices
  • Customer 360: Fraud Detection in Fintech With PySpark and ML
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. DevOps and CI/CD
  4. Integrating Jenkins With Testsigma for Continuous Integration

Integrating Jenkins With Testsigma for Continuous Integration

See how Testsigma's test automation tool can be integrated with your Jenkins pipeline to enable continuous testing as part of CI/CD.

By 
Renju Jose user avatar
Renju Jose
·
Apr. 12, 18 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
6.4K Views

Join the DZone community and get the full member experience.

Join For Free

Introduction to Continous Integration

Continuous Integration (CI) is the practice of merging all developer working copies to a shared mainline several times a day, as per the wiki definition. CI was initially popularized by modern development strategies such as XP (Extreme Programming) and Agile. Presently, it is the de-facto standard for most of the Product based companies but not limited to them as it encourages testing and fixing issues at an earlier stage.

Testsigma provides built-in CI support among its suite of various plugins to facilitate the test automation process. We will take a look at setting up Jenkins pipeline to run automated tests on Testsigma in this article.

Jenkins - An Overview

As you may already know, Jenkins is a self-contained, open source automation server which can be used to automate all sorts of tasks related to building, testing, and delivering or deploying software. It does this by following the principle of pipelining those tasks.

A pipeline is an automated expression of your process for getting software from version control right through to your users and customers. Every change to your software (committed to source control) goes through a complex process on its way to being released. This process involves building the software in a reliable and repeatable manner, as well as progressing the built software (called a "build") through multiple stages of testing and deployment.

Jenkins_Continous_Integration_Pipeline-Testsigma

Testsigma's Place in the CI/CD Pipeline

Testsigma comes into picture during the Testing stage. Using the Jenkins plugin for Testsigma, we can integrate the Testsigma Test Automation tool into the Jenkins pipeline so that whenever a successful build is made, Testsigma executes the tests and notifies whether the tests passed or failed. The test results help us determine whether the build is a release candidate (RC), i.e. whether it is deployable or not.

Integrating Testsigma Into a Jenkins Pipeline

If you are fairly new to Testsigma tool, please check out our previous article on Web Application Automated Testing with Testsigma for a quick overview of the tool.

We can use the Jenkins plugin in Testsigma to automate a Test Execution when a successful build is triggered in Jenkins automation server. This is done by adding a task to the Jenkins pipeline to execute a shell script. The script sends POST requests to Testsigma API using curl when a successful build is generated.

Adding the Test Execution Step to the Jenkins Pipeline

First, go to the Execution details page in Testsigma tool for the Execution that you want to include in your Jenkins Pipeline. The CURL request format for starting a Test Execution can be found on the Execution details page under the CI Integration Details as shown below:

CI_Integration_details-Testsigma_Execution_Details_page

Then, replace the <Username> and <Password> parts with your Testsigma login credentials to get the curl request format for the corresponding execution.

Once you get the required request format, you simply need to add a task to your Jenkins pipeline to execute a shell script that executes the above instruction.

Jenkins Script Formats

Simple Format

Add a step in the Jenkins pipeline to run the following bash script which starts the Test Execution remotely.
 curl -X POST -H 'Content-type: application/json' \ -u : \ http://app.testsigma.com/rest/execution/229/run

This script simply starts the execution in Testsigma and you might need to add additional tasks to check for the result of the execution.

Advanced Format

This script starts the test execution and polls for the test execution completion every 120 secs until failure.

#https://github.com/trentm/json
#https://gist.github.com/maxcnunes/9f77afdc32df354883df

get_status(){

RUN_RESPONSE=$(curl -u <YOUR_USERNAME>:<YOUR_PASSWORD> --silent --write-out "HTTPSTATUS:%{http_code}" -X GET $URL/$HTTP_BODY/status)
# extract the body
RUN_BODY=$(echo $RUN_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
# extract the status
RUN_STATUS=$(echo $RUN_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')

# print the body
echo "Run Status..."
echo "$RUN_BODY"

EXECUTION_STATUS=$(echo $RUN_BODY | json status)

echo "Execution Status $EXECUTION_STATUS"
echo $RUN_BODY | json status_text

if [ $EXECUTION_STATUS -eq 2 ]; then
sleep 120
get_status
else
echo "Automated Tests Execution completed..."
fi
}
echo "Start executing automated tests ... "

URL='<YOUR_EXECUTION_URL>'
#example: URL='http://app.testsigma.com/rest/execution/49/run'

# store the whole response with the status at the and
HTTP_RESPONSE=$(curl -u <YOUR_USERNAME>:<YOUR_PASSWORD> --silent --write-out "HTTPSTATUS:%{http_code}" -X POST $URL)

# extract the body
HTTP_BODY=$(echo $HTTP_RESPONSE | sed -e 's/HTTPSTATUS\:.*//g')
#HTTP_BODY=$(echo '"$HTTP_RESPONSE" | sed -e 's/HTTPSTATUS:.*//g'')

# extract the status
HTTP_STATUS=$(echo $HTTP_RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')

# print the body
echo "$HTTP_BODY"

# example using the status
if [ ! $HTTP_STATUS -eq 200 ]; then

echo "Failed to executed automated tests!!"
echo "Error [HTTP status: $HTTP_STATUS]"
exit 1 #Exit with a failure.
else
#Poll to check the execution status
poll=true
while $poll
do

get_status
#sleep 120 #Wait for 120 seconds to check execution status again.
poll=false #Mark poll to false to stop polling and exit
done

fi
echo "Completed executing automated tests!!!"


You need to replace the <YOUR_USERNAME>, <YOUR_PASSWORD> with your Testsigma account username and password and <YOUR_EXECUTION_URL> with the URL of the corresponding Execution Details page. You may also modify the wait time of 120 seconds if needed.

Finally, add any of the two scripts (simple or advanced) to the shell script execution task into the Jenkins pipeline.

That's all we need to automate test execution when a successful build is triggered using the Jenkins CI server.

Welcome to the era of #SmartTestAutomation.

Continuous Integration/Deployment Jenkins (software) Integration Execution (computing) Testing Pipeline (software)

Opinions expressed by DZone contributors are their own.

Related

  • Testcontainers: From Zero To Hero [Video]
  • Java CI/CD: From Local Build to Jenkins Continuous Integration
  • Recipe To Implement the Jenkins Pipeline For MuleSoft Application [Videos]
  • Integrating Jenkins With Playwright TypeScript: A Complete Guide

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!