Monday, October 20, 2014

Test Automation using C#, Selenium WebDriver and NUnit

What is Selenium?
Selenium automates browsers. That's it! What you do with that power is entirely up to you. Primarily, it is for automating web applications for testing purposes, but is certainly not limited to just that. Boring web-based administration tasks can (and should!) also be automated as well.

Selenium has the support of some of the largest browser vendors who have taken (or are taking) steps to make Selenium a native part of their browser. It is also the core technology in countless other browser automation tools, APIs and frameworks.

Selenium IDE is an integrated development environment for performing Selenium tests.  Selenium tests can be written as HTML tables or coded in various languages like C#, PHP, Perl, Python and can be run directly in most modern browsers.The IDE can help you to record, edit and debug tests. Currently the IDE is only available for Firefox (as if we developers will use any other) as a addon.
Here is a possible scenario for using Selenium. Imagine you have created a HTML form with about twenty fields and you have to repeatedly test the form. Filling the form every time can quickly become tedious. With Selenium you can automate the whole process and run the test as required. In this part we will see how to create a simple test in Selenium. So let’s get started.

Creating a Test Automation Framework is a challenging task due to following reasons:

Test framework design and the coding of that design requires significant time and effort
Test framework must be easy to expand and maintain
Test framework should be independent of application
Test design should remove most testers from the complexities of the test framework

SOFTWARE REQUIREMENTS:

Windows 7 as OS
Microsoft Visual Studio 2013 as IDE
SpecFlow as BDD tool for .Net
NUnit as Unit Testing Tool
Selenium as a Test Automation Tool

Basic Architecture:
I have developed test framework for test automation using selenium which can be over viewed as shown below.

 Page-Object pattern:
Test code is easily readable.
Distinguished reusable code.
No duplication of Selenium API calls.
Creation of tests are easy and improves maintainability.
Used effectively with IDE such as Visual Studio, Eclipse, IntelliJ, Visual Studio.
Excellent support for languages such as C#, Java, Ruby, Python, Perl.

Test Framework Code Overview.
Application Test code hierarchy which categorized the tests for each application and its releases.



A Very Simple Test for Utility App:
Simple understandable test cases using page objects. 

8 comments:

  1. Great Information you have shared, Check it once selenium training

    ReplyDelete

Popular Posts