Monday, May 4, 2015

Telerik Test Studio : How to automate a web application using Telerik Test studio project through Visual Studio IDE and C#

Automating web application using Telerik test studio tool is very easier. It has user friendly UI to configure, record and run the automated test script. In our previous post we have shown step by step process on automating a web application using record and playback approach. Now we can integrate Telerik Test studio project on our Visual Studio IDE and we can modify the recorded test script using C# or Visual Basic.

Test Case : Verify the search functionality of Bing Search engine.

  1. Navigate to http://www.bing.com/
  2. Enter the text “Telerik Test Studio” at search text box.
  3. Click on Search button.
  4. Verify the result.

Step 1 : Download Telerik Test Studio. Go to Telerik Test Studio Site and click on Download Trial button to download the trial version. In my case I am using the Trial version.

Step 2 : After following normal installation steps guided by the installer open the application. Telerik Test Studio window is displayed like the following. Click on “Continue Trial” button on the Activation Wizard window if it asks for trial version. Note that if you have visual studio installed on your machine then Telerik test studio will automatically be installed to Visual Studio.

image

Step 3 : Open Visual Studio (In my case it is visual studio 2013).

Step 4 : Navigate to File>New>Project at File Menu.

SNAGHTML4ee51a7f

Step 5 : New Project window is displayed.

Step 6 : Select “Test” from left side Project Template category under visual C#.  Select “Telerik Test Studio Project”. Note that in my case .Net Framework 4.5.1 is selected. Enter Project name as “SearchTest” and Select Location. Enter solution name. In my case this is the same as project name. Check “Create directory for solution” option and Click on Ok button.

image

Step 7 : New project SearchTest is created. Note that a Test named “WebTest1.tstest” is created at solution Explorer.

image

Step 8 : Double click on the test name “WebTest1.tstest”. Activation Wizard window is displayed if it is a trial version and installed for the first time. Click on “Continue Trial” button.

image

Step 9 : Webtest recorder tool bar is displayed and click on Record button.

image

Step 10 : “Select Recording Browser” window is displayed and Select “Internet Explorer”. Click on Record button.

image

Step 11 : Internet explorer window will open and enter the URL : http://www.bing.com/ at the search text box and click on “Start Recording” button.

image

Step 12 : Recording will start and Recorder window is displayed below the Internet explorer window.

image

Step 13 : Enter the text “Telerik Test Studio” at the bing search text box and click on Search button.

SNAGHTMLfe049c38

Step 14 : Now click on “Pause Recording” button at the recording window. Next come to verify the result.

image

Step 15 : Select “Visible” at the verification column on Recorder window and click on “Highlight Element”.

image

Step 16 : Now move mouse pointer to the text that needs to verify and a red color rectangle is displayed around the text. A drop down menu is displayed. click on Quick Steps >>Verify – element is visible. A step is added to the test for verification.

image

Step 17 : Close the browser window and go to Visual studio Editor. Following recorded steps are displayed.

image

Step 18 : Click on “Generate unit test” button.

image

Step 19 : Select the Test Template as “MS Test” and Ok button.

image

Step 20 : Click Yes button.

image

Step 21 : Now the code is generated as the following.

image

Step 21 : You can modify the code as you wish. Now build the code.

image

Step 22 : Go to Test menu and click on Windows>Test Explorer.

image

Step 23 : In the Test Explorer, Test Name is displayed.

image 

Step 24 : Right click on the Test Name and click on “Run Selected Test”.

image

Step 25 : Test will run and Test result is displayed at the Test Explorer.

image

That’s all for now. We will discuss more about script modification in future post.

Until then ….”Happy Testing with Telerik Test Studio!!!”

No comments:

Post a Comment

Cypress: How to handle browser-based authentication pop up dialog in Cypress

Five years ago I have written a blog on how to handle browser-based authentication for selenium webdriver.   Now it is for cypress. Cypress...