This is a migrated thread and some comments may be shown as answers.

Sequential Test on Multiple Browser

8 Answers 188 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Emanuele
Top achievements
Rank 2
Emanuele asked on 20 Aug 2010, 12:51 PM
How I can execute same test code sequentially on IE, FF, SAFARI ?

I need code generation like this:

<TestMethod()> Public Sub Main(ByVal inputBrowser As ArtOfTest.WebAii.Core.BrowserType)
 
    'Launch an instance of the browser
    Manager.LaunchNewBrowser(inputBrowser)
 
    ActiveBrowser.NavigateTo("http://www.test.com/")
 
    ' TEST CODE HERE
 
End Sub

and another sub that call more time my test function.

8 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 23 Aug 2010, 09:17 AM
Hi Emanuele,

If I fully understand your request you should be able to achieve your goal by wrapping that code in a separate method and calling it with the three browser types either in a loop or manually (three times). Will that work for you?

Regards,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Emanuele
Top achievements
Rank 2
answered on 23 Aug 2010, 09:24 AM
Yes, something like this:

<TestMethod()> Public Sub MainTest()
     
    For Each i in Settings.BrowserToTest
        InternalTest(i)
    Next
 
End Sub
 
Private Sub InternalTest(ByVal inputBrowser As ArtOfTest.WebAii.Core.BrowserType)
  
    'Launch an instance of the browser
    Manager.LaunchNewBrowser(inputBrowser)
  
    ActiveBrowser.NavigateTo("http://www.test.com/")
  
    ' TEST CODE HERE
  
End Sub
0
Konstantin Petkov
Telerik team
answered on 23 Aug 2010, 09:49 AM
Hi Emanuele,

Yes, that looks good. Please let us know if you need further assistance.

Best wishes,
Konstantin Petkov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Keaegan
Telerik team
answered on 29 Oct 2010, 11:21 PM
Hi Emanuele,

There is in fact a method to accomplish this within WebUI Studio Developer Edition. In order to do this process, we advise that within your main project/solution, you have a different test project for each browser (named after the browser in question to ease with discerning data as well as creating the tests).  I assume you do not, but if you need assistance with creating a new test case, see the next few steps. Otherwise you can go on to the next sections which discuss the two methods of setting different projects to use different browsers:

Creating a new:

  1. Open your project/solution and click Test > New Test.
  2. Highlight WebAii Test
  3. Give the test an unique name
  4. Set the Add to Test Project field, select Create a new Visual C# test project...
  5. Click 'okay'
  6. In the field that is in the pop-up window, type in a name that relates to the browser the contained tests will use (IE, firefox, etc.) and click Create.

Alternatively, if you  have already created a test project for each browser, simply right-click the Test Project in Question and choose 'rename' to rename the project.

There are two methods to set tests to open specific browsers. Method 1 effects individual tests whereas method 2 provides settings for all tests contained within the test project. Please note that, while these will effect playback, you will still need to record within Internet Explorer.

Method 1 (setting individual tests):

  1. If the contents of the target test project are hidden, click the disclosure triangle next to the Test Project in question (Method1>01).
  2. Double-click the individual test that you want to run in firefox (see Method1>02).
  3. Click the Steps tab (Method1>03).
  4. Set the Browser field to read the specified browser (in your case, firefox, Method1>04)
  5. Save the test

Now, when you run the specific test, it will run in firefox. This method has to be done for each individual test, but is quicker than method 2 (below). Both processes will accomplish the same thing, but method 2 (below) is more of a 'global' setting that effects the test project (not the individual tests).

Method 2:

  1. Make sure that you have a separate Test Project for each browser
  2. Click Test > Edit Test Settings > Local (local.testsettings).
  3. In the left column click WebAii Test.
  4. Click the Default Browser field and choose which browser you want the settings to be for
  5. Click the Save As... button
  6. Enter a name for the settings and click Save
  7. You should see the settings appear in the solution explorer. The format for the file you created is givenname.settings (where givenname is what you named the settings). Drag the settings to the correct test project and save.

And you are done. Subsequent tests in the specified test or test project (depending on the method) will launch the specific browsers you need them to.  Please let us know if you encounter an issue with performing the above, but that should get you started on launching tests the way you are wanting to.

Sincerely yours,
Keaegan
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Tien Loong
Top achievements
Rank 1
answered on 01 Nov 2010, 09:38 AM
Hello Keaegan,

Thank you for your reply, but I want to inform you that I am using Visual Studio 2008. I want to use tests as part of a build process. Here I encountered the problem that it is possible to have multiple test projects, but the test list for the build process can only contain tests from 1 test project. If you put tests from other test projects in your test list, then these tests will not run in the build.

In our company we want to run a single testscript multiple times and in each iteration of this testscript, the test is run in a different web browser. So for example we want to run the test first in Internet Explorer, then this same test in Firefox and finally in Safari. And this test is part of a build process.

Thanks in advance for your reply.

Regards,

Tien Loong Siaw
0
Cody
Telerik team
answered on 03 Nov 2010, 09:54 PM
Hi Tien Loong,

To run the same test in different browsers sequentially in a VS 2008 build environment we recommend using multiple .testrunconfig files along with the MStest command line tool instead of trying to do this in code.

  1. Start by adding multiple .testrunconfig files under your Solution Items folder. Give them easy to remember names as shown in the attached screenshot.
  2. Configure the default browser in each to the correct but different browser as shown in the attached screenshot. You get to this configuration panel by double clicking on one of the .testrunconfig files then clicking WebAii Test on the left. Set one to IE, the next to Firefox and the last to Safari.
  3. Now configure your build script to run mstest three different times. You need to use the /runconfig:[file name] command line option and specify the different .testrunconfig files you created and configured in the previous two steps. You may also want to create test lists, add your WebAii tests to the test list, and use the /testlist:[test list path] command line option with MSTest. Your build script should then resemble something like this:
mstest /runconfig:ie.testrunconfig /testlist:testlist001
mstest /runconfig:firefox.testrunconfig /testlist:testlist001
mstest /runconfig:.testrunconfig /testlist:testlist001

If you need further assistance with this, don't hesitate to ask.

Sincerely yours,
Cody
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
George
Top achievements
Rank 1
answered on 13 Feb 2016, 09:59 AM

Hi, please what application are you trying to run on multiple browsers, it is the Telerik Unit Test  or the Test Studio,

I need help on how to run my Telerik Unit on multiple browsers any help please?

0
Boyan Boev
Telerik team
answered on 19 Feb 2016, 08:29 AM
Hello George,

You should add a test settings file to your solution.

Please see this article for further information.

Hope that helps.

Regards,
Boyan Boev
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Emanuele
Top achievements
Rank 2
Answers by
Konstantin Petkov
Telerik team
Emanuele
Top achievements
Rank 2
Keaegan
Telerik team
Tien Loong
Top achievements
Rank 1
Cody
Telerik team
George
Top achievements
Rank 1
Boyan Boev
Telerik team
Share this question
or