How to detect problems in browsers to work with Test Studio

Learn more about Test Studio here

Often I get questions from customers that how I could detect if there are any configuration setting missing to work with different browser in Test Studio. This can be easily detected. Very first before you start working with Test Studio in different browsers make sure you have configured them.

Read here to configure browser

After installation you can detect browsers or configured or not in Project Setting.

image

In Project Settings you will get option Browsers. In that you can see a message below each type of browsers that “There is a problem with this browser

image

You have option to calibrate browser right from there. You will get message to close instance.

image

Once browser is successfully calibrated you can see message below browser that “The browser is ready for playback

image

In this way you can detect configuration setting of browsers to work with Test Studio. I hope you find this post useful. Thanks for reading.

Advertisement

How to debug a Coded Step in Test Studio?

Learn more about Test Studio here

Recently in one of the customer interaction I came across a question that how a Coded Step in Test Studio can be debugged? This is an important query and can be very useful while writing complex Coded Step.

So let us begin with following recorded step,

image

As we see step 6 is a Coded Step. We need to debug this step. To being with we cannot debug a particular line of coded step in Test Studio desktop version. In Test Studio desktop version we can put breakpoint to debug only at Test Step level. So we can put a breakpoint on Test Step as given below. Test Studio will wait for user at step 3, 4 and 6.

image

Putting breakpoint at Test Step level is simple. However our requirement is to debug particular line of code in Coded Step. We cannot do this in Test Studio Desktop version. But this can be done in Test Studio plug-in of Visual Studio. So we need to follow below steps to debug coded step.

Very first open Test in Visual Studio and put a breakpoint in line of the code we need to debug. This can be done as follows,

image

After this open Test Explorer. To open it from menu select Test and then Windows and then Test Explorer. See the image below for reference.

image

Once Test Explorer is open select test (of which coded step you want to debug). In this case that is Test3 and right click on that and from context menu select Debug Selected Tests as given in below image,

image

Now on debugging of that particular test you will find breakpoint is being hit.

image

We learnt it is super easy to debug a codes step in Test Studio. I hope you find this post useful. Thanks for reading.

Learn more about Test Studio here

Automating Mouse Actions Test in Test Studio

Learn more about Test Studio here

When you automate a test, working with various mouse actions as desktop commands are essential. Mouse actions could be as following,

  • Single Click
  • Double Click
  • Right Click
  • Mouse Hover etc.

When I talk to customers who are coming from manual testing background or working with other automated testing tools they complain about automation of mouse actions like hover etc. They say it is tough in their existing tools to automate Mouse Actions. They require them to write some amount of scripts to achieve automation of mouse actions.

In Test Studio automating mouse actions are super simple. In this post we will take a look on how to do that.

Let us consider you are recording a test and Test Studio is connected to recording browser (IE in this case) . From Test Studio control panel docked on browser select second option. It will allow to select an element on the DOM

image

When you move mouse on page elements would be getting selected. There would be a red rectangle around selected element. Keep mouse for some time and you will get a blue bubble.

image

Next you need to click on blue bubble. You will get various options. In options select Mouse Actions options.

clip_image001

On selecting Mouse Actions option , you will get available mouse actions to automate.

clip_image002

For example if you want to add Mouse Hover action in your test just double click on Mouse Hover and a step will get added in the test. Next Test Studio will ask you further options like Centre and Specific Point.

clip_image003

You will find mouse actions are added in test as follows

clip_image005

We just witnessed how easy it is to automate various desktop mouse actions command using Test Studio. We did not have to write any script and automation can be done while recording test. I hope you find this post useful. Thanks for reading.

How to use existing Test Scripts to create new test in Test Studio

Learn more about Test Studio here

In one of customer demo, I came across a question that how we could use test scripts recorded on different machine or rather an existing test script to create a new test in Test Studio.

This can be done very easily in Test Studio. Each Test Project in Test Studio can be opened in File system. Let us say you want to use Test1 to create another test. So right click on Test1 and from context menu select Show in Windows Explorer

image

On File system you will find Test Studio Test file. You need to use this Test Studio Test File to create new test with existing scripts.

clip_image002

Next to use existing test script, right click on Test Project you get option to Add Existing Test in content menu.

clip_image004

Browse to existing Test Studio Test File you want to use to create new test. Select Test File click on Open.

clip_image006

On clicking on Open you will find that you have created new test with existing test. Newly created test will have same name as of existing test. If you want you can rename test by right clicking on the test and selecting rename option from context menu.

So just we learnt that it is very simple to use existing test scripts to create new test in Test Studio. I hope you find this post useful. Thanks for reading.

Learn more about Test Studio here

How to create Support Ticket from Telerik Test Studio Desktop

Learn more about Test Studio here

In this post we will take a look on creating Support Ticket from Test Studio Desktop. To create support ticket after launching Test Studio Desktop click on Help in top menu

clip_image002

After clicking on Help menu in ribbon you get option to Submit Ticket. Click on Submit Ticket to create a support ticket.

clip_image004

Now either you need to create a new Telerik account or login with existing account. I am login with existing Telerik account

clip_image005

After successful login, you will be provided with options from various products. Select TestStudio and click on Contact Support Team

clip_image007

You will get option to create Support Ticket under product Test Studio. If Test Studio is expired for you then you will get message as like below,

clip_image009

These steps you need to follow create Support Ticket. I hope you find this post useful. Thanks for reading.

Learn more about Test Studio here

Automate Database Insertion Test using Test Studio

Learn more about Test Studio here

Inserting data from application is very prominent task. You will find this functionality in all kind of applications. In this post we will take a look on automating the test to verify insertion of data in database.

Let us assume you have following application to insert data in database,

image

And you have recorded test steps for insertion operation as following. As you see that all the test steps are passed and data got inserted in database.

image

At this point there is no step to verify that whether data got inserted to database successfully or not? Only manually Tester can verify that data being inserted or not. Now let us see that how can we automate this test.

We will automate this test using

  • Coded step
  • Performing database verification operation in coded step. We will choose LINQ to verify that whether data got inserted successfully not. You can choose any other data base technology like ADO.Net or other library to perform operation against database.
  • We will use NUnit for assertion

Very first we need to add a Coded step. To add coded step select Test from menu and then Script Step from ribbon as given in below image.

image

You will be asked to select scripting language. I am selecting C# as scripting language here.

image

Once Code step is added export test project to Visual Studio. To export to visual studio from menu click on Export to Visual Studio as shown in image below,

image

Next select Visual Studio version to export project.

image

Creating Library to work with LINQ

Now in visual studio you need to add operations related to LINQ in different class library. Idea is that we will create separate library for LINQ operation and later we will add that library to Test Studio.

clip_image002

Assume that we have created a library with name DataLibrary. This Library got

  • LINQ data context classes
  • We added a static class in which operation is being performed to verify that whether data exist with given user name or not? If data does not exist static function will return false else true.

So DataHelper class contains following code to verify that whether data exist or not.


public static class DataHelper
 {
 public static bool VerifyInsertion(string username)
 {
 DataClasses1DataContext conext = new DataClasses1DataContext();
 var result = (from r in conext.User_Login_Datas
 where
 r.username.Equals(username)
 select r).FirstOrDefault();
 if (result == null)
 return false;
 else
 return true;

}
 }

Adding Reference in Test Project

There are in two ways you can work on Test Studio. Either on Visual Studio plugin or on Test Studio Desktop.

Adding reference in Visual Studio is simpler. Right click on test project and from context menu select Add Reference. Browse to DataHelper.dll library and add reference in test project.

Even though you have added reference in Visual Studio make sure that you have added reference in test project opened in Test Studio desktop version else you will get exception.

To add DataHelper.dll assembly in Test Studio desktop version you need to follow following steps,

In project tab or project dashboard select Settings option from ribbon

clip_image002[6]

In dialog box click on Script Options. To add assembly reference click on Add Reference.

clip_image004

The way you added DataHelper library add Add reference of nunit.framework dll in Test Project as well. Make sure to add this in Test Studio desktop version also.

After adding references you need to write codes for coded steps. We need add two coded steps,

First coded step to read username value before Post back or Form get submitted. In this particular application when user will click on Insert Data button, a post back will occurred or form will get submitted and this will clear value of all the elements in DOM. So we need to read value before form submission. We can do that in coded step as following,

image

We are reading text of UserName field using TestStudio Framework API.

Second coded step will call VerifyInsertion function from DataHelper library and using NUnit we will assert the validation. We can do that as following,

image

For your reference both coded steps are as follows,


string insertedValue = string.Empty;

 [CodedStep(@"New Coded Step")]
 public void Data_Insert_Test_CodedStep()
 {

 bool result = DataHelper.VerifyInsertion(insertedValue);
 NUnit.Framework.Assert.AreEqual(true, result);
 }

[CodedStep(@"New Coded Step")]
 public void Data_Insert_Test_CodedStep1()
 {
 insertedValue = Find.ById<HtmlInputText>("MainContent_txtUserName").Text;

}

Your test should be like following

clip_image001

In this way you can automate data insertion test in database. I hope you find this post useful. Thanks for reading.

Learn more about Test Studio here

How to execute Test in different Environment in Test Studio

Learn more about Test Studio here

To execute test in different environment you need to set base URI at project level. Very first let us understand that why we need BaseURL? Assume a scenario when you need to run test in different environment. For example your test should run in following environments

  • Testing environment
  • Staging environment
  • Production environment

Now suppose for testing environment you have recorded test as follows,

clip_image001

As you see first step of test is navigating to base URL of testing environment. Problem will occur when you will move test from testing environment to some other environment. In that scenario for each step you will have to come back and change URL.

Test Studio provides a simple solution of this by option of setting baseURL at project level. To set baseURL at project level navigate to project tab and click on project setting in ribbon

clip_image003

In project setting you have option to provide baseURL. Provide base URL here and click on ok.

clip_image005

After providing base URL when you rerecord test you will find portion specified in base URL hs been removed.

clip_image006

So setting base URL at project level allows you easily to move test from one environment to another environment. For example in case of test environment set base URL as test environment and perform all testing. When you need to execute test in production environment all you need to change base URL in the project setting. I hope you find this post useful.

Learn more about Test Studio here

How to record test using Google Chrome Browser in Test Studio

image

In this post we will take a look on how to use Chrome Browser to record in Test Studio Desktop. New release of Test Studio allows you to record in any browser.

Learn more about Test Studio here

Let us say you have created a Web Test with title Login Test HR. On project dash board double click on test to navigate test dash board.

image

On Test dashboard you see that on ribbon there is Quick Execution section. In that select browser you want to record with. After selecting browser click on Record button. Once Test Studio is successfully connected to Chrome, you will find chrome ready for recording as given in below image,

image

Navigate to page for testing. You need to provide page URL in Test Studio recorder built in navigation bar. You will get Test Studio Recorder navigation bar in bottom of browser.

image

In bottom of browser you will find Test Studio Recorder tool box

image

Here you get below options,

  • Pause recording
  • Highlight element
  • Help with recording
  • Expand recording menu

Choose option of Highlight Elements to select any element on DOM. After clicking on Highlight element when you move mouse over page, you will find red rectangle around selected DOM element. On selecting an element you will get hand icon on selected element. On clicking you will get many options related to selected element as shown in below image,

image

Here you got different options to work with selected elements.

  • Verification
  • Locate in DOM
  • Add to repository option
  • Muse actions etc.

When you click on All Action in bottom of browse you will find Test Studio recorder expanded.

image

Here you can select any verification option like and all them in test

  • Content
  • Attributes
  • Style
  • Properties

In this way you can now record a test using Chrome in Test Studio. I hope you find this post useful. Thanks for reading.

Hello Test Studio Desktop: New Immersive experience

Test Studio has got all new user interface and look. Now it is lighter and more immersive. After installing latest version you will find TEST STUDIO Desktop home as given in below image.

clip_image002

There are three section

  1. Recent Projects section
  2. Option to create new project , open existing project and open sample project
  3. Option to watch Get Started video right from launching pad

You can create new project by clicking on Create new project option. Here you select location to create project and can give a desired name to project.

image

In latest Test Studio desktop version Project dashboard look like below,

image

Right from project dashboard you can connect to TFS and do Check In and Check Out.

image

You can perform following operation on TFS from project dash board

  1. Check in
  2. Check out
  3. Open existing project from source control
  4. Connect to TFS

Right from project dash board you can connect to

  1. Team Pulse
  2. QC
  3. Bug tracking tools

Now there is new experience to create new test also

image

Now you can record test in any browser. Test Studio supports cross browser recording. In later posts I will show you in detail recording options. In new version recorded tests look like as following,

image

In further posts we will explore other new features of new Test Studio Desktop. I hope you find this post useful. Thanks for reading.

How to configure Identification or Find Logic of Element in Test Studio

In this post we will take a look on how to configure Find Logic of an element in Test Studio…

Being a Test Professional while automating test there is one common question all of us are worried about and question is,

Will Test fail if id of element being changed in development? Or what will happen if Element id is changed?

Yes Test will fail but there is a way you can change configuration and Find Logic

Test Studio allows you to change Find Logic at the project level. By Default Test Studio search an element on

  • Id of element
  • Name of element

You can browse to find logic setting of Test project by clicking on

Project -> Show Setting

clip_image002

In Project Setting dialog box click on identification logic option. Here you can find identification logic and change it as per requirement to your project.

clip_image004

As you can clearly see that by default Test Studio find an element on its Id. If you believe that ID of elements are very much likely to be changed with each development cycle then you may opt to find an element on its other property. If you believe that Name of the elements are not expected to change frequently then you can consider to change project setting to find an element on its Name attribute.

To change Find Logic select any attribute then click on up/down arrow to change its position. For example Name is at second from top. To make it first attribute on which Test Studio will find element select Name and then click on up arrow button to bring it at the top in the list.

clip_image006

In this way you can configure Find Logic. You may notice that if required you can add new Tag to list as well. So we just witnessed that Test Studio as automated testing tool is very flexible and allows us to configure Find Logic as our own requirement.

I hope you find this post useful. To speedup automated testing do not forget to download trail of Test Studio from here

image

How to work with NUnit Assertion as step in Test Studio

Learn more about Test Studio here

clip_image001

After I written this post How to work with MS Unit Test Assertion as step in Test Studio , I got a question,

How can I use NUnit Test Assertion in a Test Step while automating test with Test Studio?

Answer of this questions is also lies in three steps,

Step 1:

Add reference of nunit.framework dll in Test Project

Step 2:

Create a coded step

Step 3:

Write Assertion in test

Add Reference

There are in two ways you can work on Test Studio. Either on Visual Studio plugin or on Test Studio standalone version.

Adding reference in Visual Studio is simpler. Right click on test project and from context menu select Add Reference. Browse to nunit.framework.dll library and add reference in test project.

Even though you have added reference in Visual Studio make sure that you have added reference in test project opened in standalone version else you will get exception.

To add nunit.framework.dll assembly in Test Studio standalone version you need to follow following steps,

Select Project option in top menu

image

Click on Show Settings in project tab

image

On clicking on Show Settings you will get Project Settings dialog box. In dialog box click on Script Options. To add assembly reference click on Add Reference.

image

When you clock on Add Reference Test Studio will open File Chooser dialog box. In that browse nunit.framework.dll assembly reference location in file system and select that to add as reference in current Test project.

Create a coded step

To create Coded Step in select Test and from menu

image

You will find coded step added as below,

clip_image001[6]

Write Assertion in Test

Once Coded step is added you can write any assertion. To validate I am writing a very simple assertion as below,

You can view below code in Visual Studio,


[CodedStep(@"New Coded Step")]
 public void NunitTest_CodedStep()
 {
 NUnit.Framework.Assert.AreEqual("Telerik", "Telerik");

}

In Test Studio standalone version codes step will look like as following,

clip_image002

Now go ahead and execute test. You should able to get test passed successfully as given below,

clip_image003

I hope you find this post useful. To speedup automated testing do not forget to download trail of Test Studio from here

clip_image004

How to verify number of cookies while automating a test in Test Studio

Learn more about Test Studio here

Yes these kind of questions are very simple but have a sustainable impact while automating a test. Recently I got a question that,

I want to verify number of cookies in web application while automating test. How Test Studio can help me in that

This test scenario could be very important. Test Studio surprisingly simplify these kind of requirement while automating test. So to verify number of cookies in web application,

  1. Add Coded Step
  2. Add reference of MS Unit Test
  3. Read number of cookies
  4. Assert number of cookies with expected value.

To Add Coded Step and reference of MS Unit Test follow this post

Once you have added reference of MS Unit Test and added a coded step start writing following scripts in coded step,

Read cookies of web application being in test as following. Do not forget to change URL with URL of web application you are testing.

image

Now in browserCookies all cookies are being read. You can read count of cookies as below,

image

Once you have cookies count in variable count you can verify its exact value and assert result using MS Unit Test Assert. This can be done as following

image

Where baseCountValue could be any constant value. Putting all together script of coded step would like following,

 


[CodedStep(@"New Coded Step")]

 public void WebTest_CodedStep()
 {
 int baseCountValue = 2;
 var browserCookies = ActiveBrowser.Cookies.GetCookies("URL of your App");
 var count = browserCookies.Count;
 Microsoft.VisualStudio.TestTools.UnitTesting.Assert.AreEqual(count, baseCountValue);

}

On running you can see that below test is verifying that number of cookies associated with URI is zero.

image

In this way you can verify number of cookies in Test Studio. I hope you find this post useful. Thanks for reading.

I hope you find this post useful. To speedup automated testing do not forget to download trial of Test Studio from here

image