Powered By Blogger

Search Here!

Wednesday, November 27, 2013

E2E Protractor for .NET

Protractor is an end to end test framework for AngularJS applications built on top of WebDriverJS. In this tutorial I’ll guide you through the process of getting it up and running. Protractor can run Jasmine and Mocha tests so feel free to choose the one that suits your needs best.
The .NET port of Protractor, an end to end test framework for Angular applications.
Protractor for .NET is built on top of Selenium WebDriver C# binding.
Get it from NuGet!
PM> Install-Package Protractor
Supports Microsoft .NET Framework 3.5 and higher..

Write Tests!

         
///
/// User Login.
///

private void UserLogin()
{
//Create Webdriver Instance
webDriver = new ChromeDriver();
webDriver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(10));
IWebDriver ngDriver = new NgWebDriver(webDriver);
//Navigate Browser
ngDriver.Navigate().GoToUrl("https://mail.gmail.com");
//Enter User Name                    ngDriver.FindElement(NgBy.Input("user.Email")).SendKeys("dummy.user@gmail.com");
//Enter User Password
ngDriver.FindElement(NgBy.Input("user.Password")).SendKeys("qwertyuio");
//Wait For Element
webDriver.FindElement(By.CssSelector("button[data-qa-id*='login-button']")).Click();
//Click Save Button
webDriver.FindElement(By.CssSelector("span[class*='ico-profile']")).Click();       
}

Saturday, November 16, 2013

Changes in Visual Studio 2012 with respect to test features !

Welcome to the first post in this series which will give an overview of the differences in Visual Studio 2012 (VS12) retrospect to Visual Studio 2010 (VS10). In this particular post, we will cover the basic differences between VS2012 and VS2010 Test features, mostly with respect to navigation, running the tests, results and some features that have been deprecated in VS12. Let us now dive into this.

Test List Editor which is very commonly used to run tests in VS10 is deprecated in VS12 and is replaced by Test Explorer. Below screenshots show this difference with a red highlight.


Next question would obviously be, how do I run my tests from Test Explorer and how will this be different from VS2010. The experience of running the tests in VS12 is seemingly different from VS10 for a first time user. When you select Test Explorer in VS12 as shown in the above screen shot (Test – Windows – Test Explorer), it will open the Test Explorer window and you will see ‘Run All’ or ‘Run’ option to execute your tests as compared to ‘Run Checked Tests’ or ‘Debug Checked Tests’ in VS10. Below screen shots will show this difference


In VS12 ‘checkbox’ option is removed which means that if you want to select any particular tests to run, you have to click ‘CTRL + Select’.
Now that we understand the differences on how to run the tests in VS12, let us look at the features that have changed in VS12 while the tests are in progress. Unlike, VS10 where the progress of the test is shown with a distinct ‘In Progress’ icon, this icon is replaced in VS12 with a simple status bar. We have highlighted the differences in the below screenshots