Ask a Question

Stop Project Script Command

SOLVED
mboyce
Contributor

Stop Project Script Command

I've been searching the docs and message boards and I think the answer to my question is no, but I don't see that explicitly stated anywhere.

 

Does a script command exist to stop a project during a suite run?

 

I'm running a project within a project suite (comprised of about 30 projects). Within this particular project, there is a specific scenario that may be encountered that I want to handle in the following way:

- Set a flag to true (I'm using a Project Suite variable)

- Log an error

- Have an OnLogEvent handler that looks for the flag, and if it is true:

   - Run a few scripts to reset the application

   - Stop the project but continue to run the suite

 

This sounds all good until I get to the part of stopping the project in script. I can only find Runner.Halt() and Runner.Stop(), which I understand as stopping the entire suite. 

 

I can use the flag and and if() at the beginning of the remaining scripts within the project to tell them to run or not, but that's less than ideal and I could reuse this event handler in a subsequent project if it worked the way I want it to.

1 ACCEPTED SOLUTION

Accepted Solutions
tristaanogre
Community Hero

Re: Stop Project Script Command

I think the answer is:

 

No, there is not, not specifically as a Object.Method item available to "stop project".  Instead, as the article @TanyaYatskovska linked to gives a variety of methods, settings, etc., which allow you to control project flow.  So, combining native language exception handling, event handlers, settings in the Project Suite items list and Project items list, etc., you CAN achieve what you want... but there is no "Stop this project" command.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

5 REPLIES 5
TanyaYatskovska
Community Manager

Re: Stop Project Script Command

Hi @mboyce,

 

Could you please check if the following article answers your question?

https://support.smartbear.com/testcomplete/docs/testing-with/running/control-test-flow/stop-after-fi...

---------
Tanya Yatskovskaya
SmartBear Community and Education Manager


Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
mboyce
Contributor

Re: Stop Project Script Command

@TanyaYatskovska 

Thank you for the suggestion, but no, that article doesn't explicity answer my question.

 

I want to have an error handler that looks for a specific scenario and, if found, (via scripts) resets my tested desktop application, stops the project, and then continues to run any subsequent projects in the suite.

 

To accomplish this I am looking for a script command to stop the project, but it seems this doesn't exist. I'm just looking for someone to say "Yes this does exist and here it is" or "No it doesn't exist"

tristaanogre
Community Hero

Re: Stop Project Script Command

I think the answer is:

 

No, there is not, not specifically as a Object.Method item available to "stop project".  Instead, as the article @TanyaYatskovska linked to gives a variety of methods, settings, etc., which allow you to control project flow.  So, combining native language exception handling, event handlers, settings in the Project Suite items list and Project items list, etc., you CAN achieve what you want... but there is no "Stop this project" command.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

View solution in original post

mboyce
Contributor

Re: Stop Project Script Command

Thanks! That's what I was thinking, I just wanted someone else to confirm it.

 

I think it would be really useful to be able to stop the project via code. 

 

I don't quite understand how to prevent the 'Stop on Project' settings from stopping the project on errors that are not this one specific scenario. My understanding is if I use the 'Stop on Project' settings I can stop the project  and reset my tested application when I'd like to, but I'll also stop the project when I don't want to.

tristaanogre
Community Hero

Re: Stop Project Script Command

If you set the Stop on Project to "On Error" and then use the "OnLogError" event handler to intercept the error before it's logged.  If you do so, you can then filter in that event handler for that condition and then suppress the log entry or log something different (Warning or a message with a particular formatting or priority) in those cases where you don't want the project to halt.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: