Ask a Question

How to run a TestItem through Script?

SOLVED
mengbinhao
Occasional 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 

1 ACCEPTED SOLUTION

Accepted Solutions
K_Sathish_Kumar
Contributor

Re: How to run a TestItem through Script?

@mengbinhao ,

 

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

 

Regards,
Sathish Kumar K

View solution in original post

6 REPLIES 6
mikef
Staff

Re: How to run a TestItem through Script?

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

 

K_Sathish_Kumar
Contributor

Re: How to run a TestItem through Script?

@mengbinhao ,

 

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

 

Regards,
Sathish Kumar K

View solution in original post

mengbinhao
Occasional Contributor

Re: How to run a TestItem through Script?

Hi @K_Sathish_Kumar,

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

mengbinhao
Occasional Contributor

Re: How to run a TestItem through Script?

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. 

mikef
Staff

Re: How to run a TestItem through Script?

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... 

mengbinhao
Occasional Contributor

Re: How to run a TestItem through Script?

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

cancel
Showing results for 
Search instead for 
Did you mean: