Forum Discussion

czpqwerty's avatar
czpqwerty
Occasional Contributor
11 years ago

scripts execution

I add two scripts to the script level, no other items. And I only add one item to this project. But every time I run this test project, it aways run these two scripts together. 

How can I just run the second one?





  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    Click View>Organize Tests

    Make sure you don't have multiple test items.

    Each test item will run the specified script under the "Test" column when you run the project.
  • czpqwerty's avatar
    czpqwerty
    Occasional Contributor
    I just add another scipt. when this script is not added to the project, it is not executed. but the first one is still executed anyway. Are these two scripts anything different?
  • czpqwerty's avatar
    czpqwerty
    Occasional Contributor
    the one that is always execcuted is the installation script. others are just functional scripts
  • czpqwerty's avatar
    czpqwerty
    Occasional Contributor

    pic.PNG

    just like this, it all starts with insatll script. no matter whether this one is added into the organize test

    • Marsha_R's avatar
      Marsha_R
      Icon for Champion Level 3 rankChampion Level 3

      Could we see the code for the script that you intend to run?

      • joseph_michaud's avatar
        joseph_michaud
        Moderator

        Please note that any function calls you make at the global level of the scripts will be run when the scripts are loaded.  For example if I have the script units "Unit1" and "Unit2":

         

        [Unit1]
        function func1() { Log.Message("func1"); }
        function func2() { Log.Message("func2"); }

         

        [Unit2]
        //USEUNIT Unit1
        function func3() { Log.Message("func3"); }
        func2();
        func3();

         and then I attempt to run func1(), func2() and func3() will be run first.  The log looks like this:

         

        log.png