Ask a Question

How to run a TestItem through Script?

SOLVED
mengbinhao
Contributor

How to run a TestItem through Script?

Hi there,

    Is there any way I can run Project TestItems by Script? for instance, I added two TestItems in list as below,  after running the two items,  I want to re-run the first one by my Script, Pls provide any ideas, Thanks   

 

    IMG_0587.HEIC.JPG.JPG 

6 REPLIES 6
mikef
Staff

Hi @mengbinhao 

 

If my understanding is correct, you can just re-add the first script to the plan. Or, you could remove these and add another single script method which would run the first script, then second, then first again.

Some examples of Calling Project Items From Scripts .

 

Is there some condition to the flow?

 

Thanks

 

Mr_Bro
Frequent Contributor

@mengbinhao ,

 

try using Runner.CallMethod() which may be considered for your scenario.

 

Hi @Mr_Bro,

Thanks a lot, Runner.CallMethod()  is exactly what I need.

Hi @mikef,

   I want to dynamic collect the failed cases after each execution plan, then re-run them for double-check whether it is a true bug, so I should totally do that by my Scripts, Thank you anyway. 

You also have the option in your Execution Plan to set a test to "Stop and rerun item" on any error or exception, you can find it in the Properties panel of each test item. 

 

You can also set this behaviour at Project level in Tools > Current Project Properties > Playback.

 

You can read about more approaches to re-running failed tests here : https://support.smartbear.com/testcomplete/docs/testing-with/running/control-test-flow/stop-and-reru... 

Yes, This is an optional way for me, Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: