X-Git-Url: https://git.teslayout.com/public/public/public/?a=blobdiff_plain;f=source%2Ftesting%2FTestCase.cpp;h=455c61b5d2c87ffb1a24590f5327b5340c70c540;hb=398d53cb90e9f25dc89a46396225eef981f0ab24;hp=f8d7a986f326d8868c5d5f011e1434863b077c09;hpb=9fa68da11c56250017da9735e4a5dd3fd3b2021b;p=anna.git diff --git a/source/testing/TestCase.cpp b/source/testing/TestCase.cpp index f8d7a98..455c61b 100644 --- a/source/testing/TestCase.cpp +++ b/source/testing/TestCase.cpp @@ -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::iterator it; @@ -298,9 +304,24 @@ void TestCase::addSendxml2c(const anna::DataBlock &db, anna::diameter::comm::Ori assertInitialized(); assertMessage(db, false /* to client */); + if (stepNumber != -1) { + const TestStep *stepReferred = getStep(stepNumber); + if (!stepReferred) + throw anna::RuntimeException(anna::functions::asString("Step number (%d) do not exists (test case %llu)", stepNumber, a_id), ANNA_FILE_LOCATION); + + if (stepReferred->getType() != TestStep::Type::Wait) + throw anna::RuntimeException(anna::functions::asString("Step number (%d) must refer to a 'wait' step (test case %llu)", stepNumber, a_id), ANNA_FILE_LOCATION); + + const TestCondition &tc = (static_cast(stepReferred))->getCondition(); + if (tc.getCode() == "0") { // if regexp used, is not possible to detect this kind of errors + throw anna::RuntimeException(anna::functions::asString("Step number (%d) must refer to a 'wait for request' step (test case %llu)", stepNumber, a_id), ANNA_FILE_LOCATION); + } + } + TestStepSendxml2c *step = new TestStepSendxml2c(this); step->setMsgDataBlock(db); step->setOriginHost(host); + step->setWaitForRequestStepNumber(stepNumber); // -1 means, no reference addStep(step); }