Auto-reset hard/soft for further cycles
[anna.git] / source / testing / TestCase.cpp
index efaba5c..d048dfc 100644 (file)
@@ -211,6 +211,12 @@ bool TestCase::reset(bool hard) throw() {
   // Soft reset if finished:
   if (!hard /* is soft reset */  && !isFinished()) return false;
 
+  // Dump as failed if still in progress (hard reset):
+  if (getState() == State::InProgress) {
+    addDebugSummaryHint("Testcase hard reset while in progress");
+    setState(State::Failed);
+  }
+
   // Clean stage ////////////////////////////
   // id is kept
   std::vector<TestStep*>::iterator it;
@@ -366,11 +372,25 @@ void TestCase::addWait(bool fromEntity,
   addStep(step);
 }
 
-void TestCase::addWaitRegexp(bool fromEntity, const std::string &regexp) throw(anna::RuntimeException) {
+void TestCase::addWaitRegexpHex(bool fromEntity, const std::string &regexp) throw(anna::RuntimeException) {
+  assertInitialized();
+
+  TestStepWait *step = new TestStepWait(this);
+  step->setConditionRegexpHex(fromEntity, regexp);
+
+  LOGINFORMATION(
+    if (hasSameCondition(step->getCondition()))
+      anna::Logger::information(anna::functions::asString("The same wait condition has already been programmed in this test case (%llu). Are you sure ?", a_id), ANNA_FILE_LOCATION);
+  );
+
+  addStep(step);
+}
+
+void TestCase::addWaitRegexpXml(bool fromEntity, const std::string &regexp) throw(anna::RuntimeException) {
   assertInitialized();
 
   TestStepWait *step = new TestStepWait(this);
-  step->setCondition(fromEntity, regexp);
+  step->setConditionRegexpXml(fromEntity, regexp);
 
   LOGINFORMATION(
     if (hasSameCondition(step->getCondition()))