8 Answers, 1 is accepted
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?
the Telerik team
Yes, that looks good. Please let us know if you need further assistance.
the Telerik team
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:
- Open your project/solution and click Test > New Test.
- Highlight WebAii Test
- Give the test an unique name
- Set the Add to Test Project field, select Create a new Visual C# test project...
- Click 'okay'
- 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):
- If the contents of the target test project are hidden, click the disclosure triangle next to the Test Project in question (Method1>01).
- Double-click the individual test that you want to run in firefox (see Method1>02).
- Click the Steps tab (Method1>03).
- Set the Browser field to read the specified browser (in your case, firefox, Method1>04)
- 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).
- Make sure that you have a separate Test Project for each browser
- Click Test > Edit Test Settings > Local (local.testsettings).
- In the left column click WebAii Test.
- Click the Default Browser field and choose which browser you want the settings to be for
- Click the Save As... button
- Enter a name for the settings and click Save
- 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.
the Telerik team
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.
Tien Loong Siaw
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.
- Start by adding multiple .testrunconfig files under your Solution Items folder. Give them easy to remember names as shown in the attached screenshot.
- 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.
- 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:firefox.testrunconfig /testlist:testlist001
mstest /runconfig:.testrunconfig /testlist:testlist001
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?