return new XmlCollector();
}
-class CSVCollector :
- public TestResultsCollectorBase
-{
- public:
- static TestResultsCollectorBase* Constructor();
-
- private:
- CSVCollector() {}
-
- virtual void Start()
- {
- printf("GROUP;ID;RESULT;REASON;ELAPSED [s];EXPECTED [s]\n");
- }
-
- virtual void CollectCurrentTestGroupName(const std::string& name)
- {
- m_currentGroup = name;
- }
-
- virtual void CollectResult(const std::string& id,
- const std::string& /*description*/,
- const FailStatus::Type status = FailStatus::NONE,
- const std::string& reason = "",
- const bool& isPerformanceTest = false,
- const std::chrono::system_clock::duration& performanceTime = std::chrono::microseconds::zero(),
- const std::chrono::system_clock::duration& performanceMaxTime = std::chrono::microseconds::zero())
- {
- std::string statusMsg = "";
- switch (status) {
- case TestResultsCollectorBase::FailStatus::NONE:
- statusMsg = "OK";
- if (isPerformanceTest) {
- statusMsg.append(";;");
- std::ostringstream ostr;
- ostr << performanceTime.count();
- statusMsg.append(ostr.str());
- if (performanceMaxTime <= std::chrono::microseconds::zero()) {
- statusMsg.append(";");
- ostr.str("");
- ostr << performanceMaxTime.count();
- statusMsg.append(ostr.str());
- }
- }
- break;
- case TestResultsCollectorBase::FailStatus::FAILED: statusMsg = "FAILED";
- break;
- case TestResultsCollectorBase::FailStatus::IGNORED: statusMsg =
- "IGNORED";
- break;
- case TestResultsCollectorBase::FailStatus::INTERNAL: statusMsg =
- "FAILED";
- break;
- default:
- Assert(false && "Bad status");
- }
- printf("%s;%s;%s;%s\n",
- m_currentGroup.c_str(),
- id.c_str(),
- statusMsg.c_str(),
- reason.c_str());
- }
-
- std::string m_currentGroup;
-};
-
-TestResultsCollectorBase* CSVCollector::Constructor()
-{
- return new CSVCollector();
-}
}
void TestResultsCollectorBase::RegisterCollectorConstructor(
"html",
&HtmlCollector::Constructor);
TestResultsCollectorBase::RegisterCollectorConstructor(
- "csv",
- &CSVCollector::Constructor);
- TestResultsCollectorBase::RegisterCollectorConstructor(
"xml",
&XmlCollector::Constructor);