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

Executing tests in all supported browsers (continuous integration)

8 Answers 130 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marcel
Top achievements
Rank 1
Marcel asked on 23 Mar 2011, 02:35 PM
Hello,

Several co-workers have asked me how to make TFS run our tests in all supported browsers. Normally the tests are executed in one browser specified in the test settings. I've resolved this by converting our tests to code en making changes to the initialization. Now they execute in all our browsers (kind of like data driven tests). The problem with this is that these changes have to be reimplemented when the tests are updated in the original files.

Is there a way to let TFS run our tests in all the supported browsers without editing them or copying them to another project?

Kind regards,

Marcel

8 Answers, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 27 Mar 2011, 06:18 PM
Hello Marcel,

Instead of adding code to the test to change browsers, you can add local test settings to the project's solution. Then use MSTest from the command line and call the desired setting with a switch.

In Visual Studio, go to the Solution Explorer in the upper right. Double-click "local.testsettings" and highlight "WebAii Test" on the left side. Change the Default Browser to Firefox. Click Save As and give it an easily recognizable name. You can repeat those steps for each desired browser, creating a new settings file for each.

When running MSTest from the command line, add "/testsettings:[file name]" to call the desired browser.

A video clip is located here that clearly lays out these steps and provides screen captures to follow along.

Regards,
Anthony
the Telerik team
0
Marcel
Top achievements
Rank 1
answered on 28 Mar 2011, 07:40 AM
I know about the test settings, but the problem is running the tests for each test setting in one single command. Is this possible?
0
Anthony
Telerik team
answered on 28 Mar 2011, 09:17 PM
Hello Marcel,

Unfortunately, it is a limitation of MSTest to only use the testsettings switch once per command. In your case, you would run MSTest once per testsettings file you want to use.

Regards,
Anthony
the Telerik team
0
Marcel
Top achievements
Rank 1
answered on 29 Mar 2011, 07:12 AM
I guess we'll just have to live with my little hack for now. Thanks for your replies.

Kind regards,

Marcel
0
Franklin
Top achievements
Rank 1
answered on 12 Mar 2013, 05:04 PM
Hello,

   I have been running my tests with my specified 'testsettings' file and I have some issues that concern me. In my test settings file I have changed the browser type to Safari and added a base URL of the site I am testing. 

1. When I run tstests (telerik recordings) these test launch in Safari and navigate to the base URL as expected.

2. When I convert the tstests to c# and run the c# files (via test list editor) with these settings, none of the settings I have modified apply to them. An IE browser launches (as opposed to Safari) and the site does NOT navigate to the base URL from the settings file. 

   So My question is, do the testsettings NOT apply to c# tests being run from the test list editor? If so is this a bug? Will it be implemented in a future release?

Thanks in advance.
Frank
0
Plamen
Telerik team
answered on 14 Mar 2013, 02:40 PM
Hello Frank,

The Convert All Steps To Code button in Visual Studio, converts your Test Studio test into a coded unit test and for a unit test you need to overwrite the settings via the Settings class. Please follow the instructions from this documentation article.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Franklin
Top achievements
Rank 1
answered on 14 Mar 2013, 08:52 PM
Plamen, 

   The article you suggest involves hard coding settings in the c# file itself. However what I want to do is create a test settings file to leverage the behavior of the c# file. So in the test settings file I would modify my settings and expect my c# file to follow as such. The workflow I want to utilize is posted below. Can Telerik execute this workflow?

1. Create a test settings file in Visual Studio
2. Set the browser to Safari and the BaseUrl to 'mysite' (See image)
3. Select the test settings file I created as my Active Test Settings (See image) 
4. Run the converted c# code (unit test) from either the Test List Editor or the command prompt 

   By doing this I would expect the unit test to launch in Safari and navigate to the BaseUrl I entered and then execute the test. Please see my attached photos. 

   
0
Plamen
Telerik team
answered on 15 Mar 2013, 12:55 PM
Hi Franklin,

Unfortunately you cannot use the Test Studio settings seen in the .testsettings file for coded unit tests, you can only use them for Test Studio tests. However you can use the app.config file as documented here.

Kind regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Marcel
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Marcel
Top achievements
Rank 1
Franklin
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or