Saturday, October 19

Basic SpecFlow Automation tests in visual studio express using C# ,Selenium webdriver,nUnit console


Specflow is layer that would sit on the top of C# and one can specify tests cases in normal English readable format and build automation using these test cases. Writing test cases in format that is easily readable enables appropriate reporting and the direct mapping user story into automated test cases.Instead of digging down what test case is doing, here from reading the test case itself, it gives understanding of what it is about and what it is doing. Thus enables one to describe a test case on how the desired behaviour should be specified. 
Using above  behaviour specification structure one can write a story like
Feature: Google Search
As an end user,
I would like to visit the google search page
And then I would like to search an item so that
I can view the search results

Scenario: Google Search
Given I am on the Google home page
When I search for text Webdriver
Then I should see the search results with title WebDriver – Google Search

Sunday, October 6

How to invoke nUnit from Visual studio express and execute automation tests


nUnit is Unit testing framework tool for testing C# unit test cases. With the invent of selenium webdriver, this C# code intergrated with nUnit framework can be used to run acceptance tests. Simple way to integrate commands into Visual studio express to call nUnit tests is to use external tool feature.
Before that lets explore what options has nUnit has when you run it from a command line. Type ‘nUnit /help’ in command window which is in the directory where nUnit bin is pointing to, then it pops up below window .

Capturing screen shots using remote/local webdriver in C#/Selenium webdriver automation test cases

This blog provides details on how can you capture a screenshot using webdriver. You may run webdriver as remote webdriver or local webdriver . Both the webdriver has a method called GetScreenshot() which captures the screenshot of the browser’s current state. In tests it would be useful to capture the screen shot just to make sure the test has executed successfully or capture screenshots when error occurs. So this blog will provide you information on how basically one needs to make calls to these methods and you can use this code or learning from this code to implement it your framework.

How to invoke/run different type of selenium web driver browser using remote webdriver in C# automation scripts


Remote web driver feature in selenium is very advantages and helps to achieve distributed testing.  Distributed testing comprises testing different browsers on different machine and simultaneous run of tests  on number of machines. As a basic lets try to understand how we can we invoke a test case in different browser that is located on different machine using remote webdriver. Declaration for remote webdriver is as below for c# code
IWebDriver driver = new RemoteWebDriver(new Uri("http://127.0.0.1:4444/wd/hub"), DesiredCapabilities.InternetExplorer());

Wednesday, October 2

How to invoke locally different types of browser web driver using selenium and c# for test Automation scripts


This blog is in sequence to How to blogs related Selenium in C#. In previous blog of this series , we had created a basic web driver test . Different browsers have different webdrivers and invoking them is all nearly similar but there are slight changes.Of three main browsers – Firefox, Google Chrome and IE – firefox comes inbuilt. Hence in the test written in previous blog we could straight away start using firefox browser without downloading driver file.
As seen ,the statement below would be all just necessary to create instance of firefox browser.
IWebDriver driver = new FirefoxDriver();

The same statement for IE or Google chrome would not work as the driver files for these drivers are separate files and do not come embedded with selenium jar. For this one needs to download drivers for IE ( 32 bit or 64 bit ) and Google chrome . These are available from selenium at this location


---------------------------------------------

Related Posts Plugin for WordPress, Blogger...