Collectors can be registered by --output parameter (see HOW TO RUN section) but
there is also another collector created to write summary.
-tests-common
- summary_collector.h
+dpl-test-framework
+ test_results_collector_summary.h
SummaryCollector
Collector writing tests summary. Call SummaryCollector::Register() to
register it
${PROJECT_SOURCE_DIR}/tests/common/tests_common.cpp
${PROJECT_SOURCE_DIR}/tests/common/access_provider.cpp
${PROJECT_SOURCE_DIR}/tests/common/smack_access.cpp
- ${PROJECT_SOURCE_DIR}/tests/common/summary_collector.cpp
${PROJECT_SOURCE_DIR}/tests/common/dbus_access.cpp
${PROJECT_SOURCE_DIR}/tests/common/memory.cpp
${PROJECT_SOURCE_DIR}/tests/common/db_sqlite.cpp
*/
#include <dpl/test/test_runner.h>
-#include <summary_collector.h>
int main (int argc, char *argv[])
{
- SummaryCollector::Register();
int status = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
return status;
}
${PROJECT_SOURCE_DIR}/tests/framework/src/test_results_collector_commons.cpp
${PROJECT_SOURCE_DIR}/tests/framework/src/test_results_collector_console.cpp
${PROJECT_SOURCE_DIR}/tests/framework/src/test_results_collector_html.cpp
+ ${PROJECT_SOURCE_DIR}/tests/framework/src/test_results_collector_summary.cpp
${PROJECT_SOURCE_DIR}/tests/framework/src/test_results_collector_xml.cpp
${PROJECT_SOURCE_DIR}/tests/framework/src/test_runner_child.cpp
${PROJECT_SOURCE_DIR}/tests/framework/src/test_runner.cpp
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/*
- * @file summary_collector.h
+ * @file test_results_collector_summary.h
+ * @author Marcin Niesluchowski (m.niesluchow@samsung.com)
* @author Michal Witanowski (m.witanowski@samsung.com)
* @version 1.0
- * @brief Implementation of custom test results collector needed by summary view.
+ * @brief Header file containing SummaryCollector class declaration.
*/
-#ifndef _RAW_RESULTS_COLLECTOR_H_
-#define _RAW_RESULTS_COLLECTOR_H_
+#ifndef DPL_TEST_RESULTS_COLLECTOR_SUMMARY_H
+#define DPL_TEST_RESULTS_COLLECTOR_SUMMARY_H
#include <dpl/test/test_results_collector.h>
-#include <chrono>
+
+namespace DPL {
+namespace Test {
/*
* Custom test runner results collector. The results (total test cases, failed, etc.) are
* appended to a file, wihich is parsed after execution of all tests in oreder to
* display summary view.
*/
-class SummaryCollector : public DPL::Test::TestResultsCollectorBase
+class SummaryCollector : public TestResultsCollectorBase
{
unsigned int m_total, m_succeeded, m_failed, m_ignored; // counters
const FailStatus status,
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());
+ const std::chrono::system_clock::duration& performanceTime
+ = std::chrono::microseconds::zero(),
+ const std::chrono::system_clock::duration& performanceMaxTime
+ = std::chrono::microseconds::zero());
public:
static TestResultsCollectorBase* Constructor();
- static void Register();
};
-#endif
+} // namespace Test
+} // namespace DPL
+
+#endif // DPL_TEST_RESULTS_COLLECTOR_SUMMARY_H
#include <dpl/test/test_results_collector.h>
#include <dpl/test/test_results_collector_console.h>
#include <dpl/test/test_results_collector_html.h>
+#include <dpl/test/test_results_collector_summary.h>
#include <dpl/test/test_results_collector_xml.h>
namespace DPL {
"html",
&HtmlCollector::Constructor);
TestResultsCollectorBase::RegisterCollectorConstructor(
+ "summary",
+ &SummaryCollector::Constructor);
+ TestResultsCollectorBase::RegisterCollectorConstructor(
"xml",
&XmlCollector::Constructor);
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
/*
- * @file summary_collector.cpp
+ * @file test_results_collector_summary.cpp
+ * @author Marcin Niesluchowski (m.niesluchow@samsung.com)
* @author Michal Witanowski (m.witanowski@samsung.com)
* @version 1.0
- * @brief Implementation of custom test results collector needed by summary view.
+ * @brief Source file containing SummaryCollector class definition.
*/
-#include <summary_collector.h>
#include <fstream>
+#include "dpl/test/test_results_collector_summary.h"
+
+namespace DPL {
+namespace Test {
+
namespace {
+
const char* summaryFileName = "/tmp/security-tests-summary-file";
- const char* summaryCollectorName = "summary";
-};
+
+}
SummaryCollector::SummaryCollector()
{
}
-// Overrides DPL::Test::TestResultsCollectorBase::Start() virtual method.
+// Overrides TestResultsCollectorBase::Start() virtual method.
void SummaryCollector::Start()
{
m_total = m_succeeded = m_failed = m_ignored = 0;
}
void SummaryCollector::CollectResult(const std::string& /*id*/,
- const std::string& /*description*/,
- const FailStatus status,
- const std::string& /*reason = ""*/,
- const bool& isPerformanceTest,
- const std::chrono::system_clock::duration& performanceTime,
- const std::chrono::system_clock::duration& performanceMaxTime)
+ const std::string& /*description*/,
+ const FailStatus status,
+ const std::string& /*reason = ""*/,
+ const bool& isPerformanceTest,
+ const std::chrono::system_clock::duration& performanceTime,
+ const std::chrono::system_clock::duration& performanceMaxTime)
{
(void)isPerformanceTest;
(void)performanceTime;
}
void SummaryCollector::CollectResult(const std::string& /*id*/,
- const std::string& /*description*/,
- const FailStatus status,
- const std::string& /*reason = ""*/)
+ const std::string& /*description*/,
+ const FailStatus status,
+ const std::string& /*reason = ""*/)
{
switch (status) {
case FailStatus::IGNORED: ++m_ignored; break;
++m_total;
}
-DPL::Test::TestResultsCollectorBase* SummaryCollector::Constructor()
+TestResultsCollectorBase* SummaryCollector::Constructor()
{
return new SummaryCollector();
}
-void SummaryCollector::Register()
-{
- //register custom results collector
- DPL::Test::TestResultsCollectorBase::RegisterCollectorConstructor(summaryCollectorName,
- &SummaryCollector::Constructor);
-}
+} // namespace Test
+} // namespace DPL
/*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <dpl/test/test_runner.h>
#include <dpl/log/log.h>
-#include <summary_collector.h>
int main (int argc, char *argv[])
{
LogInfo("Starting libprivilege-control tests");
- SummaryCollector::Register();
int status = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
return status;
}
/*
- * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* @brief libsmack test runer
*/
#include <dpl/test/test_runner.h>
-#include <summary_collector.h>
int main (int argc, char *argv[])
{
- SummaryCollector::Register();
int status = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
return status;
}
#include <fcntl.h>
#include <stdio.h>
#include <memory.h>
-#include <summary_collector.h>
#include <string>
#include <unordered_set>
#include <sys/capability.h>
int main(int argc, char *argv[])
{
- SummaryCollector::Register();
return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
}
/*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
*
* Contact: Bumjin Im <bj.im@samsung.com>
*
#include <unistd.h>
#include <memory.h>
#include "security_server_mockup.h"
-#include <summary_collector.h>
#include <smack_access.h>
IMPLEMENT_SAFE_SINGLETON(DPL::Log::LogSystem);
int main(int argc, char *argv[])
{
- SummaryCollector::Register();
securityClientEnableLogSystem();
DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
return 0;
/*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
*/
/*
* @file security_server_tests_client_smack.cpp
#include <security-server.h>
#include <access_provider.h>
#include "tests_common.h"
-#include <summary_collector.h>
#include <memory.h>
#define PROPER_COOKIE_SIZE 20
int main(int argc, char *argv[])
{
- SummaryCollector::Register();
return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
}
/*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
*/
/*
* @file security_server_tests_password.cpp
#include <dlog.h>
#include "security_server_clean_env.h"
#include "security_server_tests_common.h"
-#include <summary_collector.h>
// the maximum time (in seconds) passwords can expire in
int main(int argc, char *argv[])
{
- SummaryCollector::Register();
return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
}
#include <dpl/test/test_runner.h>
-#include <summary_collector.h>
-
#include <libprivilege-control_test_common.h>
#include <security-server.h>
int main(int argc, char *argv[])
{
- SummaryCollector::Register();
return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
}
/*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
*/
/*
* @file security_server_tests_stress.cpp
#include <dpl/test/test_runner.h>
#include <dpl/test/test_runner_multiprocess.h>
#include <tests_common.h>
-#include <summary_collector.h>
#include <iostream>
#include <sys/smack.h>
#include <cstddef>
int main (int argc, char *argv[])
{
- SummaryCollector::Register();
return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
}
/*
- * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
*/
/*
* @file security_server_tests_server.cpp
#include "tests_common.h"
#include <smack_access.h>
#include <access_provider.h>
-#include <summary_collector.h>
const char *TEST03_SUBJECT = "subject_0f09f7cc";
const char *TEST04_SUBJECT = "subject_57dfbfc5";
printf("Error: %s must be executed by root\n", argv[0]);
exit(1);
}
- SummaryCollector::Register();
return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
}
#include <dpl/test/test_runner.h>
#include <dpl/test/test_runner_multiprocess.h>
#include <dbus/dbus.h>
-#include <summary_collector.h>
#include "tests_common.h"
#define DBUS_SERVER_NAME "test.method.server"
int main(int argc, char *argv[])
{
- SummaryCollector::Register();
return DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);
}