From: Eduardo Ramos Testillano Date: Thu, 17 Sep 2015 11:44:07 +0000 (+0200) Subject: Command execution for system test cases X-Git-Tag: REFACTORING_TESTING_LIBRARY~113 X-Git-Url: https://git.teslayout.com/public/public/public/?a=commitdiff_plain;h=eb1546671c9e29befae4bd5052de9ee804b1a389;p=anna.git Command execution for system test cases --- diff --git a/example/diameter/launcher/Launcher.cpp b/example/diameter/launcher/Launcher.cpp index 4452ee4..ffc814b 100644 --- a/example/diameter/launcher/Launcher.cpp +++ b/example/diameter/launcher/Launcher.cpp @@ -1673,9 +1673,9 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons else if(param1 == "repeats") { if (numParams > 2 || numParams < 2) throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION); - - testManager.setPoolRepeats(atoi(param2.c_str())); - int repeats = testManager.getPoolRepeats(); + int repeats = atoi(param2.c_str()); + if (repeats < 0) repeats = -1; + testManager.setPoolRepeats(repeats); std::string nolimit = (repeats != -1) ? "":" [no limit]"; opt_response_content += anna::functions::asString("Pool repeats: %d%s (current cycle: %d)", repeats, nolimit.c_str(), testManager.getPoolCycle()); } diff --git a/example/diameter/launcher/testing/TestCase.cpp b/example/diameter/launcher/testing/TestCase.cpp index b3d2f2f..a8b9643 100644 --- a/example/diameter/launcher/testing/TestCase.cpp +++ b/example/diameter/launcher/testing/TestCase.cpp @@ -9,6 +9,10 @@ // Standard #include #include +#include +#include + +#include // Project #include @@ -111,7 +115,17 @@ void TestCase::setState(const State::_v &state) throw() { if (isFinished()) { if (!testManager.getDumpReports()) return; // report file name: cycle-.testcase-.xml - std::string file = testManager.getReportsDirectory() + anna::functions::asString("/cycle-%d.testcase-%llu.xml", testManager.getPoolCycle(), a_id); + + // FORMAT: We tabulate the cycle and test case in order to ease ordering of files by mean ls: + int cycles = testManager.getPoolRepeats(); + int tests = testManager.tests(); + int cyclesWidth = (cycles<=0) ? 3 /* 1000 cycles !! */: ((int) log10 ((double) cycles) + 1); + int testsWidth = (tests<=0) ? 9 /* subscribers */: ((int) log10 ((double) tests) + 1); + std::stringstream format; + format << "/cycle-%0" << cyclesWidth << "d.testcase-%0" << testsWidth << "llu.xml"; + + // FILE NAME: + std::string file = testManager.getReportsDirectory() + anna::functions::asString(format.str().c_str(), testManager.getPoolCycle(), a_id); std::ofstream out; out.open(file.c_str(), std::ofstream::out | std::ofstream::app); if(out.is_open() == false) {