Command execution for system test cases
[anna.git] / example / diameter / launcher / testing / TestCase.cpp
index 1c5beeb..b3d2f2f 100644 (file)
@@ -110,7 +110,8 @@ void TestCase::setState(const State::_v &state) throw() {
   TestManager &testManager = TestManager::instantiate();
   if (isFinished()) {
     if (!testManager.getDumpReports()) return;
-    std::string file = testManager.getReportsDirectory() + anna::functions::asString("/testcase.%llu.xml", a_id);
+    // report file name: cycle-<cycle id>.testcase-<test case id>.xml
+    std::string file = testManager.getReportsDirectory() + anna::functions::asString("/cycle-%d.testcase-%llu.xml", testManager.getPoolCycle(), a_id);
     std::ofstream out;
     out.open(file.c_str(), std::ofstream::out | std::ofstream::app);
     if(out.is_open() == false) {
@@ -338,6 +339,16 @@ void TestCase::addWaitRegexp(bool fromEntity, const std::string &regexp) throw(a
   a_steps.push_back(step);
 }
 
+void TestCase::addCmd(const std::string &script, const std::string &parameters) throw(anna::RuntimeException) {
+  assertInitialized();
+
+  TestStepCmd *step = new TestStepCmd(this);
+  step->setScript(script);
+  step->setParameters(parameters);
+
+  a_steps.push_back(step);
+}
+
 TestStepWait *TestCase::searchNextWaitConditionFulfilled(const anna::DataBlock &message, bool waitFromEntity) throw() {
 
   TestStepWait *result;