Forum Discussion

chicks's avatar
chicks
Regular Contributor
13 years ago

Best Practice - running scripts on different environments ?

I'm using the project file (xxx.mds) to control which of my scripts are run.  I'm using a data file for my variables which I will be passing as a parameter on my nightly Hudson build which runs on Test Execute. 



Ideally, I'd like a project file per environment which uses the same scripts, but which I can turn on and off and pass different variables for execution.

Is this the best/proper way to handle this?

If so, is there a quick way to reproduce the existing project file without importing all of the scripts as existing items one by one?



Thanks,



Curt

  • Hello Curt,





    I'm using the project file (xxx.mds) to control which of my scripts are run.


    If I get it right, you mean that you are using Test Items to build your test flow, and that the Test Items's settings are stored in the project file.

    And your task is to run different sets of Test Items on different systems.





    Assuming, I get things right:

    If your test flow is that dynamic, then using Test Items may be inconvenient for you. To implement a dynamic test flow, you may want to consider alternative ways of running your tests - using the script-based approach. So, instead of using the Test Items page, you have a main script routine that calls other routines that implement tests, and the main routine's code controls what tests to run based on some criteria.





    For example:







    function MainTestRunner()

    {

      if (Sys.OSInfo.FullName.indexOf("Windows 7") > 0)

      {

        Log.Message("This is Windows 7, we will run only one test");

        Test1();

      }

      else

      {

        Log.Message("This is not Windows 7, we will run all tests");

        Test1();

        Test2();

        Test3();

      }

    }







    It would also be interesting to hear what others are doing to implement dynamic test flow. Feel free to share your approaches!