Create a simple automation test with Telerik Testing Framework




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.

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

Download Telerik Testing Framework

Now install the package, to your computer.

Open visual studio Select New project

create a Unit test 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


In 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



Your new test methods will look like this


 [TestMethod]
     public void TestMethod1()
     {
     }



You can Write your test Scripts inside this method

Eg;

 [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,

Happy Testing!!!











Comments

Post a Comment

Popular posts from this blog

Drag and Drop with Telerik Testing Framework

Sheduling tests - Running Tests From the Command line | Telerik Testing Framework

Using page object model with Telerik Framework