In this blog, we are discussing a feature of DevOps by which we can optimize automation. Manual testing is out fashioned yet it is still important but if we work on big projects we always feel the testing phase should be performed rapidly. Here at moreYeahs we are optimizing automation using DevOps.
We are using selenium to do automation for testing of the dynamics CRM project. Using the .net Unit test project we created test cases. Under the TestClasses, we defined TestMethod which is basically test cases. Test Classes categories type of test. For best practice, we should always have some basic test cases which need to be performed each time we create a new build to do further development.
Before doing all these we need to write test cases that contain test steps. Test Steps describe the execution steps and expected results that are documented against each one of those steps. Each step is marked pass or fail based on the comparison result between the expected and actual outcomes.
Save test case and copy its id.
Now we need to associate this test to our unit project for it we need to place code on the repository. From the test explorer, we need to associate the test as below.
You need to add the ID of the test case created in azure DevOps’s test case.
You got the link of a test case in ID column which directly opens into azure DevOps.
Here we are ready enough to use one of the most useful features of DevOps which provide true automation. Azure Pipelines is a cloud service that you can use to automatically build and test your code project and make it available to other users. It works with just about any language or project type. Azure Pipelines combines continuous integration (CI) and continuous delivery (CD) to constantly and consistently test and build your code and ship it to any target. Azure Pipeline is its self topic which I will cover on the next blog. Here I would like to discuss the pipeline that will automate the test cases.
Before creating a pipeline we need to create a configuration of test plan in Azure DevOps. The configuration is a platform on which the test code will run. Like which OS to use, which browser to use, etc. All these definitions provided in the configuration.
We need to assign a configuration to test suits so suits will use configuration to run its test cases.
Now we are good to use pipeline’s vsTest task add it into a pipeline and configure it below.
Select test plan from the dropdown, select test suits, select test configuration.
check Test mix contains UI test as it is automation we need to check this.
Save and queue the pipeline and run it. you can see real-time logs as tasks are running.
We can get a summary of test cases also we can get logs of fail test cases. All these features going to provide ease in the development process and help develop more effective softwares.