Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Titan » Repeat the execution of the test cases until terminated manually
Repeat the execution of the test cases until terminated manually [message #1802219] Mon, 04 February 2019 14:11 Go to next message
Sean McLeish is currently offline Sean McLeishFriend
Messages: 1
Registered: February 2019
Junior Member
Hi, guys,

I am currently trying to test a system "live". This requires a repeated execution of some test cases. As soon as one of these test cases fails, the execution is stopped, but it should also be possible to stop the execution manually. You can do this using the "Terminate" button in Eclipse, but this is not a clean solution because the "mctr_cli" instance still runs and therefore does not quit.
Is there a flag or something like that you could set manually and then query in a while loop?

I'm looking forward to your help!

LG Sean
Re: Repeat the execution of the test cases until terminated manually [message #1802525 is a reply to message #1802219] Mon, 11 February 2019 12:45 Go to previous messageGo to next message
Jeno Attila Balasko is currently offline Jeno Attila BalaskoFriend
Messages: 80
Registered: September 2013
Location: Budapest, Hungary

Hi Sean,

if you push the red button "terminate" on the right side of the runtime console, you stop the host controller and the mctr_cli as well.

If the mctr_cli is running (under Eclipse) it periodically sends state information to the runtime console. If you terminated the HC but not the mctr_cli, its periodic output can be seen in the console. It always can be stopped from the terminate button of the console view - perhaps not immediately.

The Titan Eclipse plug-in executor does the same steps as you can read in the user guide of titan.core

Best regards
Re: Repeat the execution of the test cases until terminated manually [message #1802574 is a reply to message #1802525] Tue, 12 February 2019 08:06 Go to previous messageGo to next message
Elemer Lelik is currently offline Elemer LelikFriend
Messages: 1120
Registered: January 2015
Senior Member
Hi Sean,

I would advise against manual intervention during test execution; this sort of slaps the concept of test automation in the face... :)

Would it not be feasible to:

-start a timer of a couple of dozen seconds
-repeat the sequence in question until successful; set verdict to pass
-if above timer expires, set verdict to fail ( to prevent infinite loops)

all this within one test case ; so it's not the test case that has to be cycled but only the relevant code?

Best regards

Re: Repeat the execution of the test cases until terminated manually [message #1802586 is a reply to message #1802574] Tue, 12 February 2019 10:32 Go to previous message
Alexander Kaiser is currently offline Alexander KaiserFriend
Messages: 28
Registered: May 2017
Junior Member
Hi Sean,

I had a similar demand for repeated test execution and counting the verdicts in an automated fashion. However, I assume stopping the execution on the occurrence of a failed test case should be also easily possible.
Rather than the Eclipse IDE, I used Titan with the CLI and python for the automation tasks.
Let me illustrate the concept with a few snippets of python code:

First, you would require a function which encapsulates the spawning of Titan and your test suite
def start_test_suite(test_suite, config):
    test_suite is the path to the binary test suite
    config is the path to the configuration file
    args = ['ttcn3_start', test_suite, config]
    child = subprocess.Popen(args, stdout=subprocess.PIPE)
    return child

Now let's start the test suite and check for verdicts
child_process = start_test_suite(test_suite, config)
line = 'initialize line'
while line != '':
    line = child_process.stdout.readline().decode("utf-8")
    if 'finished. Verdict:' in line:
        # here you should have lines like: "MTC@lx: Test case [TC] finished. Verdict: pass reason: [your reason]
        # grab the verdict with regex: the verdict result is between the keyword 'Verdict:' and 'reason:'
        # e.g. something like matches = re.finditer(r'Verdict:\s(.*)reason:') 

Once you have found a fail verdict, you can simply terminate the child process. This should be similar to clicking the "Terminate" button within the IDE

For clean manual termination, you will probably need to add a signal handler which listens for CTRL+C and terminates the child process gracefully.

Previous Topic:Issue with ETSI ITS Conformance Suite execution
Next Topic:TITAN on Cygwin
Goto Forum:

Current Time: Fri Jun 25 05:13:17 GMT 2021

Powered by FUDForum. Page generated in 0.01655 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top