Forum Discussion

markre94's avatar
markre94
Occasional Contributor
2 years ago

Modifying Test Complete Project Properties from script

Hi!

I've came across a specific issue. I'd like to know if it's possible to modify Current Project Properties directly from the script.

I would like to have PlayBack -> OnError property value (from Stop current item to Stop and rerun current item) to be configurable.Is there any specific way to do so?

 

 

 

Another thing is that currently even a manual project property change from GUI directly affects the .mds file since its added to git repository. Is there some nifty way to avoid it? I don't want to commit any changes by mistake. Maybe switching from Current Project Properties to Global? Is that the way to go? If so, how can I accomplish that?

6 Replies

    • markre94's avatar
      markre94
      Occasional Contributor

      Marsha_R, thanks for the answer.

       

      I need to have this property to be configurable by script. What are my options then?

       

      1. Is it a way to have two .mds files for one project and switch it programmatically, then?

      2. Or is it the way to reload .mds file after the script change via xml parsing?

       

      I really have no idea how to tackle this problem.

      • Marsha_R's avatar
        Marsha_R
        Champion Level 3

        Neither one of those is a good option.

         

        You can try putting your Stop tests and Stop/Rerun tests in two different projects under one project suite. Then they would automatically have different .mds files.

         

        Something else that might work is writing your own event handler for the ones you want to rerun and check for the failure yourself instead of letting TC handle it automatically.

         

    • AlexKaras's avatar
      AlexKaras
      Champion Level 3

      Hi,

       

      Nope. And I am fully in line with what Marsha has written.

      Any more information as for why do you need scripting access to these properties?

      However, regardless of the answer 🙂 I see only two options:

      a) Project file parsing and modification before test start. This is generally not recommended and you may do this on your own risk;

      b) Implement retry functionality in code. But, depending on your requirements, this might appear to be not a trivial task.

      Something like that:

      -- Create a loop;

      -- Call actual test code from within this loop;

      -- Test code must set some flag (e.g. via the project variable) that indicates whether or not test should be rerun. Additionally, this flag may be manipulated by event handling code (e.g. OnLogError);

      -- Loop or exit from the loop depending on the flag's state.