Executing tests in all supported browsers (continuous integration)

9 posts, 0 answers
  1. Marcel
    Marcel avatar
    6 posts
    Member since:
    Feb 2011

    Posted 23 Mar 2011 Link to this post

    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
  2. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 27 Mar 2011 Link to this post

    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
  3. Marcel
    Marcel avatar
    6 posts
    Member since:
    Feb 2011

    Posted 28 Mar 2011 Link to this post

    I know about the test settings, but the problem is running the tests for each test setting in one single command. Is this possible?
  4. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 28 Mar 2011 Link to this post

    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
  5. Marcel
    Marcel avatar
    6 posts
    Member since:
    Feb 2011

    Posted 29 Mar 2011 Link to this post

    I guess we'll just have to live with my little hack for now. Thanks for your replies.

    Kind regards,

    Marcel
  6. Franklin
    Franklin avatar
    6 posts
    Member since:
    Aug 2012

    Posted 12 Mar 2013 Link to this post

    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
  7. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 14 Mar 2013 Link to this post

    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
  8. Franklin
    Franklin avatar
    6 posts
    Member since:
    Aug 2012

    Posted 14 Mar 2013 Link to this post

    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. 

       
  9. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 15 Mar 2013 Link to this post

    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
Back to Top
  Cast Your Vote at DevPro Connections! Cast Your Vote at  Win IT Pro Connections!