Skip main navigation

Test Automation with Selenium

.

So far in this course, you have created an automated build process that is deploying into the cloud. The next step in the process is testing. And with an automated build process, you ideally want an automated testing process as well.

In this step, we will discuss what test automation and Selenium is and how you can use Selenium for test automation.

What is Test Automation?

Test automation is the practice of running tests automatically, managing test data and utilising results to improve software quality. It is primarily a quality assurance measure, but its activities involve the commitment of the entire software production team.

There are typically four levels or quadrants of testing:

  1. Technology-facing tests that support the team, including, Unit tests, API tests, Web Services testing, and Component Tests.
  2. Business-facing tests that support the team, such as, Functional Testing, Story Tests, Prototypes, and Simulations.
  3. Business-facing tests that critique the product, for example, Exploratory Testing, Scenario-based Testing, Usability Testing, User Acceptance Testing, and Alpha/Beta testing.
  4. Technology-facing tests that critique the product, which covers tests such as Performance & Load Testing, Security Testing, and ‘*ility’ testing – Stability, Reliability, Scalability, Maintainability, Compatibility, etc.

Selenium

Selenium is one of the popular open-source frameworks available in the market for test automation.

Selenium is used to perform user interface testing by executing scripted actions against browser DOM. It is most commonly used for functional testing to verify that key functionality continues to work after the latest build gets deployed, but it can also be used for unit and load testing.

PhantomJS is a headless web driver that automates browser testing in cloud environments in an unattended manner. By plugging Selenium into our CI / CD pipeline, we enable quick feedback to developers when web UI issues are detected.

For more information on using Selenium with VSTS, see https://www.visualstudio.com/en-us/docs/test/continuous-testing/getting-started/continuous-test-selenium.

For more information on Selenium, see http://www.seleniumhq.org/docs/01_introducing_selenium.jsp.

Adding a Selenium Test

To add a Selenium test, you need to create a new project by right-clicking your solution and selecting Add. When you have added a New Project, navigate to the test section. In this section, you can select any unit testing project that is available.

Now that you have selected a unit test project, you can navigate to your NuGet feed. Within NuGet, you can search for Selenium. Although the Selenium package might already be added, you may have to add the Selenium WebDriver and some other optional drivers. There will be some settings you have to add depending on the test you have created.

The next step is to create and initialise your tests, and once that is completed, you can commit your tests in the source control. Once you queue your test up in your build and the test execution is complete, a report is generated that shows you a full test execution summary.

This article is from the free online

Microsoft Future Ready: Continuous Integration Implementation

Created by
FutureLearn - Learning For Life

Reach your personal and professional goals

Unlock access to hundreds of expert online courses and degrees from top universities and educators to gain accredited qualifications and professional CV-building certificates.

Join over 18 million learners to launch, switch or build upon your career, all at your own pace, across a wide range of topic areas.

Start Learning now