Run Nightwatch tests on Azure Pipelines
Azure Pipelines is a mature and powerful tool meant for enterprises. It enables you to create workflows that automatically build, test, publish, release, and deploy code, allowing you to give complete traceability of the software development lifecycle.
In this article we will learn how to quickly build up test automation using the NightwatchJS testing library and integrate it into the Azure DevOps pipelines flow.
- Working project to test that has been pushed to Github
- Tests run properly in your local system
In this example we will be learning how to run Nightwatch tests using Azure Pipelines using the nightwatch-examples Github repo
Step 1: Create a New Pipeline
To create a new pipeline in Azure DevOps you have to navigate to Azure DevOps from your Azure DevOps home page, then hover on Pipelines and Click on Pipelines
And then click on the new pipeline as shown in the below image
Step 2: Link your repository
Choose your repository management system where your project resides.
And then select your repository from the list
Step 3 : Select NodeJS plugin
You need to click on Node.js in order to configure its plugin. This will provide an environment to run the tests.
Step 4 : Configure azure-pipelines.yml file
Now you have to review and write the steps inside the azure-pipelines.yml file to run your tests.
Step 3: Push azure-pipelines.yml file and Run the tests
After editing and reviewing the .yml file you should click on the
save and run button
save and run button to commit .yml file after filling out the form accordingly.
Once you push your changes and click on save and run button, the pipeline will start and your tests will run automatically.
Note: After saving and running, you may encounter an error stating that no hosted parallelism has been purchased or granted. Please fill out the form to request a free parallelism grant.