Simplify command (no parameter field, all inside command). Interactive mode.
[anna.git] / example / diameter / launcher / testing / TestStep.cpp
index 8a5e2b0..c1f27d8 100644 (file)
@@ -99,6 +99,7 @@ namespace {
 
     bool result = true;
     try {
+      messageCodec.setEngine(NULL); // perhaps we will need another codec engine ...
       messageCodec.decode(message);
     }
     catch (anna::RuntimeException &ex) {
@@ -135,7 +136,7 @@ bool TestStep::decodeMessage() throw() {
 
 const char* TestStep::asText(const Type::_v type)
 throw() {
-  static const char* text [] = { "Unconfigured", "Timeout", "Sendxml2e", "Sendxml2c", "Delay", "Wait", "Cmd" };
+  static const char* text [] = { "Unconfigured", "Timeout", "Sendxml2e", "Sendxml2c", "Delay", "Wait", "Command" };
   return text [type];
 }
 
@@ -168,8 +169,18 @@ std::string TestStep::asXMLString() throw() {
 }
 
 bool TestStep::execute() throw() {
+
+  int ia = a_testCase->interactiveAmount();
+  if (ia > -1) {
+    if (ia == 0) return false;
+    a_testCase->interactiveExecution();
+    LOGDEBUG(anna::Logger::debug("Interactive execution ...", ANNA_FILE_LOCATION));
+    if (a_executed) return false; // avoid repeating (this implies amount consumption)
+  }
+
   LOGDEBUG(anna::Logger::debug(anna::functions::asString("EXECUTING %s (step number %d) for Test Case %llu (%p) (%p)", asText(a_type), a_number, a_testCase->getId(), (TestCaseStep*)this, this), ANNA_FILE_LOCATION));
   setBeginTimestamp(anna::functions::millisecond());
+  a_executed = true;
   return do_execute();
 }
 
@@ -184,6 +195,7 @@ void TestStep::reset() throw() {
   LOGDEBUG(anna::Logger::debug(anna::functions::asString("RESET %s (step number %d) for Test Case %llu (%p) (%p)", asText(a_type), a_number, a_testCase->getId(), (TestCaseStep*)this, this), ANNA_FILE_LOCATION));
   // type and testCase kept
   a_completed = false;
+  a_executed = false;
   a_beginTimestamp = 0;
   a_endTimestamp = 0;
   do_reset();
@@ -541,7 +553,6 @@ throw() {
   //parent->createChild("TestStepCmd");
 
   result->createAttribute("Script", (a_script != "") ? a_script:"<no script>");
-  result->createAttribute("Parameters", (a_parameters != "") ? a_parameters:"<no parameters>");
   if (a_errorMsg != "") result->createAttribute("ErrorMessage", a_errorMsg);
   if (!a_threadRunning && a_resultCode != -2) {
     result->createAttribute("ResultCode", a_resultCode);
@@ -555,8 +566,6 @@ bool TestStepCmd::do_execute() throw() {
   if (!a_threadRunning /* || a_threadDeprecated DO NOT WANT TO OVERLAP ... */) {
     // Special tags to replace:
     std::string cmd = getScript();
-    cmd += " ";
-    cmd += getParameters();
     size_t index;
     while ((index = cmd.find(SH_COMMAND_TAG_FOR_REPLACE__CYCLE_ID)) != std::string::npos)
       cmd.replace(index, strlen(SH_COMMAND_TAG_FOR_REPLACE__CYCLE_ID), anna::functions::asString(TestManager::instantiate().getPoolCycle()));