Is it possible to set a timeout on a test case while executing test list ? if a test has not finished executing in defined time period, we should kill the test and active browser (if there is one) and move to next test.
We run our test lists on Jenkins over night, some times due to in stability of tests, test cases are getting stuck on some screens and and execution sits there all night ( ex: open an upload file dialogue but provide in-valid file name) . I know we need to make our tests better, which we are doing. To avoid these kind of issues we are thinking to set a TimeOut on testcase so that if a test case is not finished in that time time period, we should kill that test and kill the active browser session( if there is) and move on to next test. is that possible ? if so how can we achieve this ? any information is appreciated.
we are using Test Studio Version 2016.3.928.0.
5 Answers, 1 is accepted
Thank you for your question.
It is possible to complete such task using an execution extension. The idea here is to use a timer that is started before each test execution and if the time limit is not hit - to be restarted after the test. If the time limit is hit - related to the test processes are killed and the execution continue with the next test. Try to create such extension and to modify the code attached here to your case.
Since you are using as CI - Jenkins and running your test in command line - to preserve the results a prior to the test that is failing using an ArtOfTest.Runner option persistOnEachStep="true".
Let me know whether the proposed solution helps.
Regards,
Nikolay Petrov
Telerik by Progress
Hi Nikolay,
Thanks for your suggestion and sorry for late response.
To test this solution out, I generated .dll with 10 second time out (int timeout = 10000) and moved the .dll into C:\Program Files (x86)\Telerik\Test Studio\Bin\Plugins folder as suggested and ran the the following test list :
Test 1 :
Navigate to : 'https://www.google.com
wait for 60000
Test 2:
Navigate to :https://www.cnn.com
What it's doing is after every 10 seconds it's timing out and killing those processes until wait period in Test 1 Ends (i.e: 60000) before it goes to Test 2 so it's killing those processes 6 times. I was expecting it to go to seconds test right after first 10 seconds. Is there a way to achieve that ? I would like the execution to move to next Test no matter what's the status of the test is being executed when the time out hits. Is that possible ?
Btw, I have upgraded to 2017.1.207.0 version right now.
Thanks for your time.
It is possible to achieve such goal by implement some time limit in the execution extension library. Please find in the attached sample execution extension library a sample implementation of this test time out limit. The main idea is to implement a stop watch that terminates all related to Test Studio running process if the time limit is hit. The implementation happens in the methods: OnBeforeTestStarted() - to start the timer and OnAfterTestCompleted() - restart the timer if the test complete normally.
I hope this will solve the problem.
Regards,
Nikolay Petrov
Telerik by Progress
Unfortunately it is not possible to stop the execution delay step. This step holds in general the execution process. To stop it you have to stop the entire test list execution with no further test execution continuation.
Try to use "Wait for" step instead the execution delay one. It is much more responsive.
I hope this information is helpful.
Regards,
Nikolay Petrov
Telerik by Progress