Simplify command (no parameter field, all inside command). Interactive mode.
[anna.git] / example / diameter / launcher / testing / TestCase.hpp
index 0a2c93b..a3b653d 100644 (file)
@@ -56,7 +56,7 @@ public:
     anna::xml::Node* asXML(anna::xml::Node* parent) const throw();
   };
 
-  TestCase(unsigned int id) : a_id(id), a_state(State::Initialized), a_startTime(0) { /*a_stepsIt = a_steps.end()*/;}
+  TestCase(unsigned int id) : a_id(id), a_state(State::Initialized), a_startTime(0), a_interactiveAmount(-1) { /*a_stepsIt = a_steps.end()*/;}
   ~TestCase();
 
   struct State { enum _v { Initialized, InProgress, Failed, Success }; };
@@ -69,6 +69,17 @@ public:
   bool inProgress() const throw() { return (getState() == State::InProgress); }
   bool hasSameCondition(const TestCondition &condition) const throw();
 
+  // Interactivity:
+  void makeInteractive(bool yes = true) throw() { a_interactiveAmount = (yes ? 0:-1); }
+  void addInteractiveAmount(unsigned int amount) throw() {
+    if (a_interactiveAmount == -1) makeInteractive();
+    if (amount == 0) return;
+    a_interactiveAmount += amount;
+    process();
+  }
+  int interactiveAmount() const throw() { return a_interactiveAmount; }
+  void interactiveExecution() throw() { a_interactiveAmount --; }
+
   // Step type & information
   void addTimeout(const anna::Millisecond &timeout) throw(anna::RuntimeException);
   void addSendxml2e(const anna::DataBlock &db, RealmNode *realm, int stepNumber) throw(anna::RuntimeException);
@@ -80,7 +91,7 @@ public:
                 const std::string &msisdn, const std::string &imsi, const std::string &serviceContextId) throw(anna::RuntimeException);
   void addWaitAnswer(bool fromEntity, int stepNumber) throw(anna::RuntimeException);
   void addWaitRegexp(bool fromEntity, const std::string &regexp) throw(anna::RuntimeException);
-  void addCmd(const std::string &script, const std::string &parameters) throw(anna::RuntimeException);
+  void addCommand(const std::string &cmd) throw(anna::RuntimeException);
 
 
   // Process:
@@ -115,6 +126,7 @@ private:
   State::_v a_state;
   anna::Millisecond a_startTime;
   DebugSummary a_debugSummary; // used when a test case has failed, uncovered message conditions, and any other hint.
+  int a_interactiveAmount;
 
   friend class TestStep;
 };