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

  • How To Run OWASP ZAP Security Tests in Azure DevOps Pipeline
  • DevOps Nirvana: Mastering the Azure Pipeline To Unleash Agility
  • CI/CD Metrics You Should Be Monitoring
  • Azure DevOps Pipeline for Oracle Integration Cloud

Trending

  • Immutable Secrets Management: A Zero-Trust Approach to Sensitive Data in Containers
  • Simplifying Multi-LLM Integration With KubeMQ
  • Integrating Model Context Protocol (MCP) With Microsoft Copilot Studio AI Agents
  • How to Ensure Cross-Time Zone Data Integrity and Consistency in Global Data Pipelines
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. DevOps and CI/CD
  4. Setup Cypress Tests in Azure DevOps Pipeline

Setup Cypress Tests in Azure DevOps Pipeline

Step by step guide to configure and run Cypress tests in Azure DevOps pipeline and publish Cypress test results in Azure DevOps.

By 
Ganesh Hegde user avatar
Ganesh Hegde
DZone Core CORE ·
Aug. 17, 21 · Tutorial
Likes (9)
Comment
Save
Tweet
Share
36.8K Views

Join the DZone community and get the full member experience.

Join For Free

This tutorial helps to integrate and run your Cypress tests with the Azure DevOps pipeline in an Easy Way

Pre-Requisite:

  1. You need to have already cypress framework up and running on your local machine
  2. Cypress Project should be checked into the repository
  3. Your framework should generate a JUnit XML file at the end of the execution of the test. If you are not sure how to do that refer to Generating JUnit XML article.

Step by Step Guide To Run / Set-Up Cypress Tests in Azure DevOps or TFS Pipeline CI/CD

This tutorial explains the easy way to configure and run Cypress Test Automation Framework into Azure DevOps. 

Step 1: Create a New Pipeline

Since we are starting from scratch, let's start with creating a new pipeline in Azure DevOps

Create your new pipeline. Navigate to Azure DevOps > From your Azure DevOps home page, Hover on Pipelines and Click on Pipelines

pipelines

Step 2: Click on New Pipeline

Click on the new pipeline as shown in the below image

Click on new pipeline

Step 3: Click on Use the Classic Editor

Click on Use the classic editor as shown in the below image

Classic Editor

Step 4: Choose the Correct Repository and Project

Source: Azure Repos Git
Team Project: Your Project Name
Repository: Your repository name where you have pushed Cypress Tests or code
Default branch: master (recommended) or any if you wish
Click on Continue

Select a source

Step 5: Select Template

Choose Empty Job As shown in the below image.

Select template

Step 6: Choose Pipeline Options

Click on the pipeline, On the right side of your screen specify desired options


Choose pipeline options

Name: Cypress Pipeline
Agent pool: Choose Agent pool (This will be as per your organization set up)
Agent Specification: Choose correct Specification (This will be as per your organization set up)

Step 7: Click on Agent Job1 From the Left Side and Choose Desired Options.

Display Name: Cypress or anything you wish
Agent pool: Choose Agent pool (This will be as per your organization set up)
Agent Specification: Choose correct Specification (This will be as per your organization set up)

Cypress pipelines

Step 8: Click on Plus Icon (+) And Add the Node Install Task

Click on the (+) icon on the left side the list of tasks opens up
Search for Npm install or Install Packages
Click on Add

Add tasks

Step 9: Configure Install Packages Task

In the added Task fill the correct options
Display Name
: Install Packages
Command: install
The working folder that contains package.json: Choose the correct working folder from the list (If you click on (…) it will show a list of folders in your repository, choose the correct one)

Install packages task

Step 10: Search and Add Powershell Task in Azure DevOps To Run Cypress Tests

Click on the (+) icon on the left side the list of tasks opens up
Search for Powershell
Click on Add

Powershell

Step 11: Configure Powershell Task To Run Cypress Test in Azure DevOps

Display name: Run Tests
Type: Inline
Script: add this command ./node_modules/cypress/bin/cypress run
Error Action Preference: Continue
Advanced Tab Options
Working Directory: Choose the correct directory (Where your package.json is located)
Continue Options
Enabled: Check this checkbox
Continue On Error: Check this check box


Run cypress tests

Step 12: Add Publish Cypress Test Results in Azure DevOps

Click on the (+) icon, Tasklist opens up
In the Search box type Publish Test Results
Click on Add to add the task


Publish cypress test results

Step 13: Configure Publish Cypress Test Results Task in Azure DevOps

Test Result Format: JUnit

Test Result Format: 
This is important, If you give the wrong path it will pick the Junit XML and the result will not be displayed. If you follow my Generating JUnit XML article, it will be generated inside the cypress/reports folder.

Control options

Enabled: Check this check box
Continue on Error: Check this check box
Run this task: From the drop-down choose the “Even if a previous task has failed unless the build was canceled” option

Step 14: Run Cypress End to End Test Automation Pipeline in Azure DevOps

Once you are done with adding all tasks click on Save & Queue

Save and Queue

Step 15: View Cypress Test Results in Azure DevOps

If you have configured everything correctly, then build will pass and test results link find in Publish Cypress Test Result Task

Publish test results

Test Results looks like this

test results

test results


Congrats!, You have successfully Integrated Cypress Tests with the Azure DevOps pipeline

Encourage me to write more articles by buying a coffee for me.

If you are looking for any help, support, guidance contact me on LinkedIn|https://www.linkedin.com/in/ganeshsirsi

Testing azure Pipeline (software) DevOps Task (computing)

Opinions expressed by DZone contributors are their own.

Related

  • How To Run OWASP ZAP Security Tests in Azure DevOps Pipeline
  • DevOps Nirvana: Mastering the Azure Pipeline To Unleash Agility
  • CI/CD Metrics You Should Be Monitoring
  • Azure DevOps Pipeline for Oracle Integration Cloud

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!