How to run scenarios in different browsers?



  • Avatar
    Mansi Shah

    Hi Alexey,

    This can be achieved by doing the following:

    1. If you want to have multiple browser options, copy the file and rename them as follows:

    (Make sure to edit the properties file to reflect the appropriate browser)

    2. Create a system variable called say, launch_browser in Preferences->Twist-> Default JVM arguments for launching


    (If you want Chrome to be used to run the tests)

    3. Make the following changes in the applicationContext-suite.xml

    <bean class=”org.springframework.beans.factory.config.PropertyPlaceholderConfigurer”>
    <property name=”systemPropertiesModeName” value=”SYSTEM_PROPERTIES_MODE_OVERRIDE”/>
    <property name=”ignoreResourceNotFound” value=”true”/>
    <property name=”locations”>

    This way when you run your tests, Twist will use the browser that is specified as a system variable(in step 2).

    4. If you have exported the twist project (or used 'Export Twist Libraries' option), Twist would generate an ant build file containing <twist.runner> task.
    <twist.runner scenarioDir="${twist.project.dir}/scenarios"
                          tags="!in-progress" threads="1"

    5. Now from command prompt, you can specify which launch_browser to use, using -D option:

    ant -buildfile build.xml execute-scenarios -Dlaunch_browser=chrome
    ant -buildfile build.xml execute-scenarios -Dlaunch_browser=firefox

    Hope this helps!



  • Avatar
    Alexey Litosh

    Yes! Thank you! It's working! :)

    Except step #2 - when I add '-Dlaunch_browser=browser_name' to JVM arguments it has no effect. Instead twist launches browser which is set in system variable. So if I want to change browser I have to change the system variable value manually (or using bat-file) and then restart twist.

    Hope, it's posible to start different test-suits on different browsers via Maven using some script to change sys variable value.

  • Avatar

    Hi Alexey,

    Yes, if you would do it from ant/maven/command prompt, it would immediately take effect. for the other issue, one possible reason is that the "run configurations" may still have the old settings. See the post on "managing multi env config" -


Please sign in to leave a comment.