Tuesday, September 15, 2015

Execute selenium(C#) tests from command prompt/Batch File

Step 1: Create some test method in your project.


using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;

namespace UnitTestProject2
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            IWebDriver driver = new FirefoxDriver();
            driver.Navigate().GoToUrl("https://www.google.co.in");
            driver.Quit();
        }
        [TestMethod]
        public void TestMethod2()
        {
            IWebDriver driver = new FirefoxDriver();
            driver.Navigate().GoToUrl("https://in.yahoo.com");
            driver.Quit();
        }
        [TestMethod]
        public void TestMethod3()
        {
            IWebDriver driver = new FirefoxDriver();
            driver.Navigate().GoToUrl("http://www.msn.com");
            driver.Quit();
        }
    }
}

Step 2: Create a batch file and write following commands in your batch file.


call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"

vstest.console.exe "C:\Projects\UnitTestProject2\UnitTestProject2\bin\Debug\UnitTestProject2.dll" /Tests:TestMethod1,TestMethod2,TestMethod3  /logger:trx 

Note:

  • Please make sure that path given above are correct.
  • Dll file should be ready at the given path.

Step 3: Execute this batch file and you are done.

Thursday, September 10, 2015

How to use Chrome webdriver with Selenium(C#)

Want to run your selenium script on Chrome browser. See the solution below:

Step1: Download Chrome webdriver


Download this driver from here and put this driver exe at a particular location(like i put in "E:\")

Step2: Code to use this driver


using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium;

namespace UnitTestProject2
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            IWebDriver driver = new ChromeDriver(@"E:\");
           driver.Navigate().GoToUrl("https://www.google.co.in");
        }
    }
}


Step3: Run this code and we are done



Wednesday, September 9, 2015

Integrate Selenium webdriver with C#

Integration of selenium with C# is very easy. It would not take more than 5-10 minutes to start it and create/test a small selenium project.

Step 1: Create Solution and Project


Open Visual Studio and create a new solution with one empty “Unit Test” project.

Step2: Install Selenium NuGet packages


Goto Tools -> Library Pacakage Manager -> Manage NuGet Packages for Solution.




Search for selenium in open window




Install “Selenium WebDriver” and “Selenium WebDriver Support Classes” and close the window.

See references in “solution explorer”. “WebDriver” and “Webdriver.Support” will be visible.

Step3: Write some code to test it


using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenQA.Selenium.Firefox;

namespace UnitTestProject2
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            FirefoxDriver driver = new FirefoxDriver();
            driver.Navigate().GoToUrl("https://www.google.co.in");


        }
    }
}


Step4: Run it and you are done

Monday, May 4, 2015

Planning Poker - Agile Estimation


A consensus based estimation technique mainly used in agile environment. It can be used to estimate days or story points for any requirement.


Equipment needed:

  • A deck of cards: Cards in the deck have numbers on them. A typical deck has cards showing the Fibonacci sequence including a zero: 0, 1, 2, 3, 5, 8, 13, 21, 34, 55, and 89.
  • Requirement list (which need to be estimated


How to apply:

  • A Moderator, who normally doesn’t play, chairs the meeting.
  • The Product Owner provides a short overview of the user story. The team is given an opportunity to ask questions and discuss to clarify assumptions and risks.
  • Each individual lays a card face down representing his/her estimate instead of speaking them aloud.
  • Everyone calls their cards simultaneously by turning them over.
  • People with high estimates and low estimates has given the opportunity to justify their estimate and then discussion continues.
  • This estimation process is repeated until a consensus is reached for a particular feature and then it is repeated for next requirement item

Pert - A Three Point Estimation Technique



The PERT Three Point Estimate technique is a type of three point estimate. It can be applied to cost and duration.  The only difference between pert and three point estimation is that it applies weighting so that the most-likely estimate is weighted 4 times more than the other two estimates (optimistic and pessimistic). 

When to use:        

For projects which are unique, such as R&D projects where there are many unknowns. 

Estimate:

E (Pert) = (O + 4M + P) / 6
E (Three Point Estimation) = (O + M + P) / 3

E is Total Estimate
O = optimistic estimate
P = pessimistic estimate
M = most likely estimate

Standard Deviation

SD (Pert) = (P − O)/6

SD is Standard Deviation

Steps to produce PERT estimate:

  • Decompose the project into a list of estimable tasks, i.e. identify tasks for each Work Breakdown Structure (WBS) work package
  • Estimate E and SD for each task.
  • Calculate E for the total project work as E (Project Work) = Σ E
  • Calculate SD value for the total project work as SD (Project Work) = √Σ SD

Now E and SD values are used to get the confidence levels as follows:

  • Confidence level in E value +/- SD is approximately 68%
  • Confidence level in E value +/- 1.645 × SD is approximately 90%
  • Confidence level in E value +/- 2 × SD is approximately 95%
  • Confidence level in E value +/- 3 × SD is approximately 99.7%

Information Systems typically use the 95% confidence level, i.e. E Value + 1.645 × SD, for all project and task estimates

Tuesday, April 29, 2014

Spell checker for browser

As a tester most of the time, we need to check spellings on browser and for that what we do:- select all content, copy it and paste it on utility and use its spell check feature.

Following is the way to do it in a single click.

Spell Checker(Firefox add-on)

About this Add-on:
This add-ons is basically to check the Spelling mistakes all over the web page. It uses Firefox's inbuilt dictionary to check the spellings. There are many sites available which checks the spelling mistake on the website but for that you must have your site live. But what to do when site is under construction and you are testing it. To copy whole page text and past into some utility that checks the spelling mistakes is tedious work to do. This add-on will help you in this case. 



Tuesday, September 24, 2013

Tired of typing on android phone while testing. Read this.

Are you tired of typing on small keyboard of android phone while testing?
Are you tired of typos caused by your large thumbs?
So use this tool which Control your android phone from your laptop with MOUSE and KEYBOARD. “ShareKM” is a very handy tool for Android that lets you share your computer’s Mouse, Keyboard and Clipboard.
I tried and tested this tool on “HTC one” device using USB connection.
Restriction: If your device is not ROOTED, you can use only USB connection.
Refer link below for complete list of feature.