Needless to say that I am a huge fan of system testing through Selenium WebDriver. You can find lots of useful information in my WebDriver Series. Usually, we use WebDriver to create GUI automated tests. However, we can go far beyond that and use our already created UI tests for load testing. In the article, I will show you how to do that using PhantomJS driver and Visual Studio. The tests will be executed in the Azure cloud using Visual Studio Team Services.

Create the UI Test for Load Testing Use Case The scenario that I want to load test is pretty simple. I will open the home page of Automate The Planet and assert the main headline. After that, the test will click on the 'Got to the blog' button and navigate to the blog page. There we will wait for the subscribe widget to show up and assert the title of the page. 1. Open the home page

2. Assert the main headline 3. Click 'Go to the blog' button

4. Wait for the subscribe widget to show up

5. Assert the blog page's title

Automate the Use Case through Selenium WebDriver C# My code splits the logic into a couple of classes utilizing the Page Object Pattern. There is a page object for the home page and another for the blog. We have three files for each one of them- page, map and asserter. HomePage

HomePage.Map

HomePage.Asserter

BlogPage

BlogPage.Asserter

Below you can find how the project's file structure should look like.

Unit Test Execution the Use Case

The test will be executed in a headless browser using PhantomJS. Required NuGet Packages To be able to run the above test you need to install three NuGet packages- Selenium.PhantomJS.WebDriver, Selenium.WebDriver and Selenium.Support.

Create a Load Test using the Selenium WebDriver UI Test We are going to use Visual Studio Team Services to create the load test. 1. Create a free account

2. Download and install Visual Studio Enterprise. You can get a free 90 days trial.

Usually, I use the free community edition of Visual Studio. However, the load testing is not included in it. With you free account for Visual Studio Team Service, you will get 20000 virtual user minutes. 3. Create a new load test

4. Use Cloud-based Load Test with Visual Studio Team Services

5. Specify a location. You can use the default.

6. Set up the load test duration

7. Select a think time profile. You can use the default one.

8. Select a load pattern. You can choose a constant or an increasing load.

9. Select a test mix model. You can use the default settings.

10. Add tests to a load test scenario. Choose the WebDriver test.

11. Open the load test file and run it.

12. Open the test results online