I think you should think this a bit differently.
Do those component tests block the execution when they are run? If they do then you should do something to turn each of those tests into asynchronous calls instead of synchronous, so that they will not block main thread and freeze GUI.
like:
void StateMachine::doTests() {
...
case TestComponent1:
testComponent1->start(); // returns immediately, doesn't wait for the execution to start
...
}
void StateMachine::onTestComponent1Finished() { // this slot is connected to testComponent1's signal finished()
if( false == isStopped )
{
doTests(); // execute next test
}
}
void StateMachine::doTests() {
...
case TestComponent1:
testComponent1->start(); // returns immediately, doesn't wait for the execution to start
...
}
void StateMachine::onTestComponent1Finished() { // this slot is connected to testComponent1's signal finished()
if( false == isStopped )
{
doTests(); // execute next test
}
}
To copy to clipboard, switch view to plain text mode
When you click the stop-button in GUI you can just set the isStopped to true and the execution should stop when currently running test has finished.
Bookmarks