Part 1: Selenium Web Driver Automation for ASP.NET webpage

The testing industry is slowly coming to the realisation that the role of a tester will be more technical in future. Gone will be the days where tester focuses only on black and white box testing. With the adoption of DevOps model, the line that separates tester from other technical resources will slowly disappear. A tester will eventually be asked to perform more than a single role, including writing automation scripts to assist with unit testing, deploying and testing web services/APIs in test environments, verifying databases upon application commit etc.

It astonishes me that some of my colleagues in the testing industry have no idea how to develop and deploy web services. If current industry standard is any indication, unless testers continue to develop and enrich their technical knowledge, it is more than likely that they will find themselves without a job in distant future. For example, at Atlassian, QA Engineers are essentially developers who are entrusted to maintain quality of their code. They do not hire QA Analysts who come from pure testing background. As companies look to become more agile and efficient in delivery, more technical savvy resources will be required to take the organisation to the next level. Hence, testers cannot remain comfortable in their current role. Unless they evolve, they will not survive in the industry.

With that view, I decided to write a series of articles that delve into automation testing. Depending on which company you work for, you must have come across some of the tools that are used for automation: HP UFT, TOSCA, Selenium Web Driver etc. While HP UFT or TOSCA require heavy investment by the company as they are quite expensive, selenium web driver is an open source tool and requires no upfront investment. The only investment that will be required is to hire the correct people with the right expertise.

Please note that these articles will not be like traditional tutorials. Frankly, I don’t like the way some of the tutorials or books teach materials to the readers. For example, if you have looked at any of the programming language books for dummies, you will see that they spend dozens of chapters on teaching the reader the basics of the language before actually showing the application. I think it is the wrong approach. I think for any tutorial, you should first show what the final product will look like and then proceed to explain the details. This way, the reader, will have a baseline to work with. If the reader does not like the look of the product, they can move on to a different tutorial on a different website.

For the current article, I will demonstrate how to develop an ASP.NET webpage, deploy it and then run automation script using Selenium Web Driver. I will develop and deploy it on a win7 laptop with IIS.

The purpose is to develop and deploy a webpage with textbox, button and dropdown menus. Then use Selenium web driver to automate this simple webpage. Once you have achieved that, then you can move on to automate more advanced demo webpages as practice.

The ASP.NET webpage will look like below. This webpage was created in Visual Studio 2015 using C#.

To understand how to create such a ASP.NET webpage in Visual Studio, please refer to MSDN article: Walkthrough: Creating a Basic Web Forms Page in Visual Studio

Then deploy the webpage to IIS. In order to do this, please follow below steps:

For reference purposes, please see below the design and code behind for the Visual Studio ASP.NET project.


Now that the ASP.NET webpage is well and truly up and running, it is time to create the Selenium web driver scripts. For Selenium Web Driver, we will develop automation scripts in Eclipse in Java. There are many websites that explain how to setup Eclipse, provide some basic understanding of Java and explain how to create Selenium scripts.

The TOOLSQA is a good website that teaches you everything you need to get started.

Now run the automation script by clicking the Play button  in Eclipse. This will open a new instance of the Chrome browser and execute the following:

  1. Enter a name in the textbox
  2. Select a radio button
  3. Select a value from the drop down menu
  4. Click the button, and
  5. Verify that the text in label matches to the expected text.

The automation output will be as below.

Once you have managed to get your head around this very basic automation, please proceed to automating the ToolsQA Automation Practice Form as below.

Following that, please proceed to automating a demo website as below.

Please NOTE: Learning a new tool requires time and patience. One cannot become an expert overnight. But you should be able to gain a level of confidence by following the above process.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.