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
+++ /dev/null
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * @file summary_collector.cpp
- * @author Michal Witanowski (m.witanowski@samsung.com)
- * @version 1.0
- * @brief Implementation of custom test results collector needed by summary view.
- */
-
-#include <summary_collector.h>
-#include <fstream>
-
-namespace {
- const char* summaryFileName = "/tmp/security-tests-summary-file";
- const char* summaryCollectorName = "summary";
-};
-
-SummaryCollector::SummaryCollector()
-{
- Start();
-}
-
-
-// Overrides DPL::Test::TestResultsCollectorBase::Start() virtual method.
-void SummaryCollector::Start()
-{
- m_total = m_succeeded = m_failed = m_ignored = 0;
-}
-
-// append results to the file
-void SummaryCollector::Finish()
-{
- std::ofstream outputFile;
- outputFile.open(summaryFileName, std::ofstream::out | std::ofstream::app);
- if (!outputFile)
- return; //failed to open file
-
- outputFile << m_total << ' '
- << m_succeeded << ' '
- << m_failed << ' '
- << m_ignored << std::endl;
- outputFile.close();
-}
-
-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)
-{
- (void)isPerformanceTest;
- (void)performanceTime;
- (void)performanceMaxTime;
- switch (status) {
- case FailStatus::IGNORED: ++m_ignored; break;
- case FailStatus::FAILED: ++m_failed; break;
- case FailStatus::NONE: ++m_succeeded; break;
- };
- ++m_total;
-}
-
-void SummaryCollector::CollectResult(const std::string& /*id*/,
- const std::string& /*description*/,
- const FailStatus status,
- const std::string& /*reason = ""*/)
-{
- switch (status) {
- case FailStatus::IGNORED: ++m_ignored; break;
- case FailStatus::FAILED: ++m_failed; break;
- case FailStatus::NONE: ++m_succeeded; break;
- };
- ++m_total;
-}
-
-DPL::Test::TestResultsCollectorBase* SummaryCollector::Constructor()
-{
- return new SummaryCollector();
-}
-
-void SummaryCollector::Register()
-{
- //register custom results collector
- DPL::Test::TestResultsCollectorBase::RegisterCollectorConstructor(summaryCollectorName,
- &SummaryCollector::Constructor);
-}
+++ /dev/null
-/*
- * 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/*
- * @file summary_collector.h
- * @author Michal Witanowski (m.witanowski@samsung.com)
- * @version 1.0
- * @brief Implementation of custom test results collector needed by summary view.
- */
-
-#ifndef _RAW_RESULTS_COLLECTOR_H_
-#define _RAW_RESULTS_COLLECTOR_H_
-
-#include <dpl/test/test_results_collector.h>
-#include <chrono>
-
-/*
- * 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
-{
- unsigned int m_total, m_succeeded, m_failed, m_ignored; // counters
-
- SummaryCollector();
- void Start();
- void Finish();
- void CollectResult(const std::string& /*id*/,
- const std::string& /*description*/,
- const FailStatus status,
- const std::string& /*reason = ""*/);
- void CollectResult(const std::string& /*id*/,
- const std::string& /*description*/,
- 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());
-
-public:
- static TestResultsCollectorBase* Constructor();
- static void Register();
-};
-
-#endif
*/
#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
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file test_results_collector_summary.h
+ * @author Marcin Niesluchowski (m.niesluchow@samsung.com)
+ * @author Michal Witanowski (m.witanowski@samsung.com)
+ * @version 1.0
+ * @brief Header file containing SummaryCollector class declaration.
+ */
+
+#ifndef DPL_TEST_RESULTS_COLLECTOR_SUMMARY_H
+#define DPL_TEST_RESULTS_COLLECTOR_SUMMARY_H
+
+#include <dpl/test/test_results_collector.h>
+
+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 TestResultsCollectorBase
+{
+ unsigned int m_total, m_succeeded, m_failed, m_ignored; // counters
+
+ SummaryCollector();
+ void Start();
+ void Finish();
+ void CollectResult(const std::string& /*id*/,
+ const std::string& /*description*/,
+ const FailStatus status,
+ const std::string& /*reason = ""*/);
+ void CollectResult(const std::string& /*id*/,
+ const std::string& /*description*/,
+ 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());
+
+public:
+ static TestResultsCollectorBase* Constructor();
+};
+
+} // 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 {
TestResultsCollectorBase::RegisterCollectorConstructor(
"html",
&HtmlCollector::Constructor);
+ TestResultsCollectorBase::RegisterCollectorConstructor(
+ "summary",
+ &SummaryCollector::Constructor);
TestResultsCollectorBase::RegisterCollectorConstructor(
"xml",
&XmlCollector::Constructor);
--- /dev/null
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/*
+ * @file test_results_collector_summary.cpp
+ * @author Marcin Niesluchowski (m.niesluchow@samsung.com)
+ * @author Michal Witanowski (m.witanowski@samsung.com)
+ * @version 1.0
+ * @brief Source file containing SummaryCollector class definition.
+ */
+
+#include <fstream>
+
+#include "dpl/test/test_results_collector_summary.h"
+
+namespace DPL {
+namespace Test {
+
+namespace {
+
+ const char* summaryFileName = "/tmp/security-tests-summary-file";
+
+}
+
+SummaryCollector::SummaryCollector()
+{
+ Start();
+}
+
+
+// Overrides TestResultsCollectorBase::Start() virtual method.
+void SummaryCollector::Start()
+{
+ m_total = m_succeeded = m_failed = m_ignored = 0;
+}
+
+// append results to the file
+void SummaryCollector::Finish()
+{
+ std::ofstream outputFile;
+ outputFile.open(summaryFileName, std::ofstream::out | std::ofstream::app);
+ if (!outputFile)
+ return; //failed to open file
+
+ outputFile << m_total << ' '
+ << m_succeeded << ' '
+ << m_failed << ' '
+ << m_ignored << std::endl;
+ outputFile.close();
+}
+
+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)
+{
+ (void)isPerformanceTest;
+ (void)performanceTime;
+ (void)performanceMaxTime;
+ switch (status) {
+ case FailStatus::IGNORED: ++m_ignored; break;
+ case FailStatus::FAILED: ++m_failed; break;
+ case FailStatus::NONE: ++m_succeeded; break;
+ };
+ ++m_total;
+}
+
+void SummaryCollector::CollectResult(const std::string& /*id*/,
+ const std::string& /*description*/,
+ const FailStatus status,
+ const std::string& /*reason = ""*/)
+{
+ switch (status) {
+ case FailStatus::IGNORED: ++m_ignored; break;
+ case FailStatus::FAILED: ++m_failed; break;
+ case FailStatus::NONE: ++m_succeeded; break;
+ };
+ ++m_total;
+}
+
+TestResultsCollectorBase* SummaryCollector::Constructor()
+{
+ return new SummaryCollector();
+}
+
+} // 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);
}