Ask a Question

Rerun tests after a stipulated time period.

SOLVED
Learner_Pranavi
Occasional Contributor

Rerun tests after a stipulated time period.

Hi guys,

 

I am running a test to generate an ID. So, the generation takes 5-10 minutes. In few cases, it takes more than 10 minutes.

I have also implemented another script in python to check whether the ID has been generated or not.

So, this later script has to be run for every 5 minutes for 3 times (i.e, till 15 mins). If, the test is a success, there is no need to rerun it. 

Meanwhile, during this timeframe, I will be running other project test scripts in that project suite.

Is it possible in Testcomplete? If so, how?

Please help!

 

PS : I am a beginner.

9 REPLIES 9
rraghvani
Champion Level 3

It's not possible to run two or more scripts at the same time.

MW_Didata
Regular Contributor

you could store a project variable with how many times it's been run,

then use an if then to check if it exists, if not and variable Timesrun is not 3 continue,

if it doesn't exist and the Timesrun does equal 3 then post error/warning to logs.

 

Then just put that test in your exeplan 3 times at different point.

 

you could also add a variable and set that to true when it has been found,

then just use that to skip the later 2 testruns with another if then statement.

 

It would look a little like this:

MW_Didata_0-1695284250143.png

 

Learner_Pranavi
Occasional Contributor

Hi @MW_Didata ,

I appreciate your answer. This will work if I run the other tests in the same project.

But meanwhile, I need to run another project and come back to this project after some time to check whether the ID has been generated or not.

I have also read that Project suite execution plan does not support reruns of a project i.e, a project can be run only once in a project suite. 

So, in this case is there any solution?

I also wanted to know is there any scheduler to set time and trigger that particular test after some time?

MW_Didata
Regular Contributor

So you run the whole projectsuite at once? That does make it a little more difficult. My experience can't help you here I think. Someone else might have a better solution for you.

 

Have you thought about splitting the test runs up? we run every project seperately through batch

rraghvani
Champion Level 3

Note, in Python - Specifics of Usage multithreading is not supported.

 

Not sure if it is possible to use Running the Network Suite, Jobs and Tasks as Network Suite functionality is deprecated.

 

From my understanding, it take between 5-10 minutes to generate an ID. You then check if this ID is generated every 5 minutes? Is this a unique ID, how do you know if the ID is created?

 

Does the other projects rely on this ID to be generated?

MW_Didata
Regular Contributor

What if you add the same test to a different project that runs after?

You could check within that project at the end if the ID exists

Learner_Pranavi
Occasional Contributor

@rraghvani 

Thanks for the info you have provided.

No other project is dependent on this ID generation.

I check the ID is generated or not by opening a url in chrome which contains a dynamic table. I then search for the specific record and will check the ID cell.  If the cell is empty, then the generation is still in progress. If it contains any value, then the ID has been generated successfully. Even after 15 minutes, the cell in the table is empty, I then log the error messages.

This is how my test works.

 

 

@MW_Didata 

I have thought about your solution. So after checking at the end, what if the generation is still in progress and needed an extra run after sometime? I need to manually run it again right? My entire project suite is running in a time not more than 8 minutes. So, some IDs will eventually fail to generate within 8 minutes.

Also, can you please explain about this running separately in a batch. How to split tests up? So that it could be easier for me to manually run another batch after sometime to check for ID generation.

 

MW_Didata
Regular Contributor

You can split them up using sessioncreator (or Testexecute) in script

 

"C:\Program Files (x86)\SmartBear\TestExecute 15\x64\Bin\SessionCreator.exe" RunTest /Username:"User" /Password:"Password" /ProjectPath:"E:\TestComplete 15 Projects\Projectlocation\Projectsuite.pjs" /UA /ScreenResolution:1600*900 /Timeout:9000 /project:"Your project here"

 

Then repeat for all project in your testsuite

See https://support.smartbear.com/testcomplete/docs/working-with/automating/session-creator/index.html 

For more info and arguments you can use

rraghvani
Champion Level 3

Pseudocode to achieve what you want will look something like this,

Generate ID
Start-Timer
While ID is not generated
	if Start-Timer is greater than 15 minutes
		Break
	otherwise
		Wait for 1 minute
End-Timer
Output time taken to generate ID (End-Timer - Start-Timer) minutes
cancel
Showing results for 
Search instead for 
Did you mean: