Separate dumps by state: enable/disable Success and Failed tests
[anna.git] / example / diameter / launcher / Launcher.cpp
index 0968b8d..bf80e2d 100644 (file)
@@ -1340,12 +1340,16 @@ std::string Launcher::help() const throw() {
   result += "\n                                 Test cases reports are not dumped on process context (too many information in general).";
   result += "\n                                 The report contains context information in every moment: this operation acts as a snapshot.";
   result += "\n";
-  result += "\n   test|report[|[yes]|no]        Every time a test case is finished, its xml representation will be dump on a file under";
+  result += "\n   test|report|<Failed/Success>[|[yes]|no]";
+  result += "\n";
+  result += "\n                                 Every time a test case is finished, its xml representation will be dump on a file under";
   result += "\n                                 the execution directory (or the one configured in process command-line 'tmDir') with";
-  result += "\n                                 the name 'cycle-<cycle id>.testcase-<test case id>.xml'. This option is disabled by";
-  result += "\n                                 default reducing IO. ADML process context won't show test manager whole information";
-  result += "\n                                 because it could be a huge amount of data to write. Anyway, you could use the 'look'";
-  result += "\n                                 operation to see the desired report(s).";
+  result += "\n                                 the name 'cycle-<cycle id>.testcase-<test case id>.xml'. The third parameter represents";
+  result += "\n                                 the test result condition to dump the information. By default, neither failed nor successful";
+  result += "\n                                 test cases are written to avoid IO overload (in most of cases not all the tests are going to";
+  result += "\n                                 fail and you could enable only such dumps, but you can enable both types if you want).";
+  result += "\n                                 Better, you can use the 'look' operation to see the desired report(s) and its result state,";
+  result += "\n                                 in case that you miss the xml files or you disabled all the dumps during testing.";
   result += "\n";
   result += "\n   test|report-hex[|[yes]|no]    Reports could include the diameter messages in hexadecimal format. Disabled by default.";
   result += "\n";
@@ -1373,7 +1377,8 @@ std::string Launcher::help() const throw() {
   result += "\n";
   result += "\n   test|summary                  Test manager general report (number of test cases, counts by state, global configuration,";
   result += "\n                                 forced in-progress limitation, reports visibility, etc.). Be careful when you have reports";
-  result += "\n                                 dumps enabled because all the programmed test cases will be dump and that could be heavy.";
+  result += "\n                                 enabled because the programmed test cases dumps could be heavy (try to disable both failed";
+  result += "\n                                 and successful dumps).";
   result += "\n";
   result += "\n";
   result += "\nUSING OPERATIONS INTERFACE";
@@ -1769,19 +1774,19 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
     }
 
   } else if((opType == "test")) {
-    // test|<id>|<command>[|parameters]   Add a new step to the test case ...
-    // test|ttps|<amount>                 Starts/resume the provided number of time ticks per second (ttps). The ADML starts ...
-    // test|next[|<sync-amount>]          Forces the execution of the next test case(s) without waiting for test manager tick ...
-    // test|ip-limit[|amount]             In-progress limit of test cases. No new test cases will be launched over this value ...
-    // test|repeats|<amount>              Restarts the whole programmed test list when finished the amount number of times ...
-    // test|report[|[yes]|no]             Every time a test case is finished a report file in xml format will be created under ...
-    // test|report-hex[|[yes]|no]         Reports could include the diameter messages in hexadecimal format. Disabled by default.
-    // test|goto|<id>                     Updates current test pointer position.
-    // test|look[|id]                     Show programmed test case for id provided, current when missing ...
-    // test|interact|amount|id            Makes interactive a specific test case id. The amount is the margin of execution steps ...
-    // test|reset|<soft/hard>[|id]        Reset the test case for id provided, all the tests when missing ...
-    // test|clear                         Clears all the programmed test cases.
-    // test|summary                       Test manager general report (number of test cases, counts by state ...
+    // test|<id>|<command>[|parameters]         Add a new step to the test case ...
+    // test|ttps|<amount>                       Starts/resume the provided number of time ticks per second (ttps). The ADML starts ...
+    // test|next[|<sync-amount>]                Forces the execution of the next test case(s) without waiting for test manager tick ...
+    // test|ip-limit[|amount]                   In-progress limit of test cases. No new test cases will be launched over this value ...
+    // test|repeats|<amount>                    Restarts the whole programmed test list when finished the amount number of times ...
+    // test|report|<Failed/Success>[|[yes]|no]  Every time a test case is finished a report file in xml format will be created under ...
+    // test|report-hex[|[yes]|no]               Reports could include the diameter messages in hexadecimal format. Disabled by default.
+    // test|goto|<id>                           Updates current test pointer position.
+    // test|look[|id]                           Show programmed test case for id provided, current when missing ...
+    // test|interact|amount|id                  Makes interactive a specific test case id. The amount is the margin of execution steps ...
+    // test|reset|<soft/hard>[|id]              Reset the test case for id provided, all the tests when missing ...
+    // test|clear                               Clears all the programmed test cases.
+    // test|summary                             Test manager general report (number of test cases, counts by state ...
 
 
     if(param1 == "ttps") {
@@ -1844,12 +1849,24 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
       opt_response_content += anna::functions::asString("Pool repeats: %d%s (current cycle: %d)", repeats, nolimit.c_str(), testManager.getPoolCycle());
     }
     else if(param1 == "report") {
-      if (numParams > 2)
+      if (numParams > 3)
         throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION);
 
-      if(param2 == "") param2 = "yes";
-      testManager.setDumpReports((param2 == "yes"));
-      opt_response_content += (testManager.getDumpReports() ? "report enabled" : "report disabled");
+      if(param2 != "Failed" && param2 != "Success")
+        throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION);
+
+      if(param3 == "") param3 = "yes";
+      bool enable = (param3 == "yes");
+
+      if(param2 == "Success")
+        testManager.setDumpSuccessfulReports(enable);
+      else
+        testManager.setDumpFailedReports(enable);
+
+      opt_response_content += (enable ? "report enabled " : "report disabled ");
+      opt_response_content += "for ";
+      opt_response_content += param2;
+      opt_response_content += " tests";
     }
     else if(param1 == "report-hex") {
       if (numParams > 2)