Tags

a

Test Automation with Telerik I

Automating with Telerik Test Studiois really simple and its free!!! its just a matter of creating a test in Visual studio and you are set. The following article is about how you create a simple test in Visual studio using Telerik testing framework

 

 

First of all you should download and install the Telerik Testing Framework, as I said before its free and its a very powerful framework.

 

 

  1. Use the below link to download Telerik Testing Framework, did I mention that its FREE??
    Download Telerik Testing Framework

 

2. Now install the package, to your computer.

 

3. Open visual studio Select New project

 

4. Create a Unit Test Project from Visual Studio

 

If you’re using Telerik Test studio Free framework Use Visual studio as your IDE. You could select new project like in the Figure 1 screenshot and select “Unit Test Project

 

Figure 1

 

Then Select new Item and Under Test you can select new VsUnit test from adding a new Item. You can use a Simple Unit test for this but then you have to write the initialize and tear down methods by yourself. So use this “VS unit test ” option [Figure 2]

 

Figure 2

So your test will look like below

 

Figure 3

and your test you could see a template with several test methods such as

 

  • MyClassInitialize
  • MyTestInitialize
  • MyTestCleanup
  • MyClassCleanup

You can declare or initialize any variables in the MyClassInitialize

 

If you’re using couple of testes in side one class you can use  MyTestInitialize declare or initialize any variables for that particular test. If you have to clean something in each test you can add it on MyTestCleanup

Ex: browser

 

If you have to clean something at the end of the class you can use MyClassCleanup to clean that variable
Ex: Manager

 

Then you can create a Test Method in between MyTestInitialize and MyTestCleanup

 

Figure 4

 

Your new test methods will look like this

 

[TestMethod]
public void TestMethod1()
{
}

You can Write your test Scripts inside this method

[TestMethod]
public void TestMethod2()
{
Settings mySettings = new Settings();
mySettings.Web.DefaultBrowser = BrowserType.InternetExplorer;
Manager myManager = new Manager(mySettings);
myManager.Start();
myManager.LaunchNewBrowser();
myManager.ActiveBrowser.NavigateTo("www.google.com");
//Add Some assertion
myManager.Dispose();
}

How to Run the test 

In visual studio open the Test menu

 

Select Test> Windows> Test Explorer

 

Inside test explorer you new test will be listed if not, build the solution and check the Test Explorer

 

TestMethod2 will be listed inside the Test Explorer, Right click it and select “Run Selected Tests” or “Debug Selected Tests”

with that your test will start running,

Kasun Ratnayake

Kasun has over 6 years of experience in both Software Development and Software Quality Assurance streams. He is a test automation specialist experienced in many automation tools including Telerik, Selenium, QTP and CodedUI. He is passionate about the technical aspects of testing and has created automation frameworks to facilitate automation in several domains including Finance, Insurance, Enterprise Performance Management and CRM.

No Comments

Post a Comment

Comment
Name
Email
Website