├── .codacy.yml ├── .codecov.yml ├── .gitattributes ├── .github └── workflows │ └── archive-docs.yml ├── .gitignore ├── BUILD.md ├── CMakeLists.txt ├── LICENSE ├── README.md ├── RELEASENOTES.md ├── ci └── pipelines │ ├── Build.jenkinsfile │ └── Release.jenkinsfile ├── cmake └── CodeCoverage.cmake ├── conanfile.py ├── src └── GTestAllureUtilities │ ├── AllureAPI.cpp │ ├── AllureAPI.h │ ├── CMakeLists.txt │ ├── Model │ ├── Action.cpp │ ├── Action.h │ ├── Attachment.cpp │ ├── Attachment.h │ ├── ExpectedResult.cpp │ ├── ExpectedResult.h │ ├── Format.h │ ├── Label.cpp │ ├── Label.h │ ├── Link.cpp │ ├── Link.h │ ├── Parameter.cpp │ ├── Parameter.h │ ├── Stage.h │ ├── Status.h │ ├── Step.cpp │ ├── Step.h │ ├── StepType.h │ ├── TestCase.cpp │ ├── TestCase.h │ ├── TestProgram.cpp │ ├── TestProgram.h │ ├── TestProperty.h │ ├── TestSuite.cpp │ └── TestSuite.h │ └── Services │ ├── EventHandlers │ ├── ITestCaseEndEventHandler.h │ ├── ITestCaseStartEventHandler.h │ ├── ITestProgramEndEventHandler.h │ ├── ITestProgramStartEventHandler.h │ ├── ITestStepEndEventHandler.h │ ├── ITestStepStartEventHandler.h │ ├── ITestSuiteEndEventHandler.h │ ├── ITestSuiteStartEventHandler.h │ ├── TestCaseEndEventHandler.cpp │ ├── TestCaseEndEventHandler.h │ ├── TestCaseStartEventHandler.cpp │ ├── TestCaseStartEventHandler.h │ ├── TestProgramEndEventHandler.cpp │ ├── TestProgramEndEventHandler.h │ ├── TestProgramStartEventHandler.cpp │ ├── TestProgramStartEventHandler.h │ ├── TestStepEndEventHandler.cpp │ ├── TestStepEndEventHandler.h │ ├── TestStepStartEventHandler.cpp │ ├── TestStepStartEventHandler.h │ ├── TestSuiteEndEventHandler.cpp │ ├── TestSuiteEndEventHandler.h │ ├── TestSuiteStartEventHandler.cpp │ └── TestSuiteStartEventHandler.h │ ├── GoogleTest │ ├── GTestEventListener.cpp │ ├── GTestEventListener.h │ ├── GTestStatusChecker.cpp │ ├── GTestStatusChecker.h │ └── IGTestStatusChecker.h │ ├── IServicesFactory.h │ ├── Property │ ├── ITestCasePropertySetter.h │ ├── ITestSuitePropertySetter.h │ ├── TestCasePropertySetter.cpp │ ├── TestCasePropertySetter.h │ ├── TestSuitePropertySetter.cpp │ └── TestSuitePropertySetter.h │ ├── Report │ ├── ITestProgramJSONBuilder.h │ ├── ITestSuiteJSONSerializer.h │ ├── TestProgramJSONBuilder.cpp │ ├── TestProgramJSONBuilder.h │ ├── TestSuiteJSONSerializer.cpp │ └── TestSuiteJSONSerializer.h │ ├── ServicesFactory.cpp │ ├── ServicesFactory.h │ └── System │ ├── FileService.cpp │ ├── FileService.h │ ├── IFileService.h │ ├── ITimeService.h │ ├── IUUIDGeneratorService.h │ ├── TimeService.cpp │ ├── TimeService.h │ ├── UUIDGeneratorService.cpp │ └── UUIDGeneratorService.h ├── test ├── IntegrationTest │ ├── CMakeLists.txt │ ├── Tests │ │ ├── BaseIntegrationTest.cpp │ │ ├── BaseIntegrationTest.h │ │ └── BasicTestCaseIntegrationTest.cpp │ ├── main.cpp │ └── stdafx.h ├── SampleTestProject │ ├── CMakeLists.txt │ ├── Tests │ │ ├── ComplexTestSuite.cpp │ │ ├── ParametricTestSuite.cpp │ │ └── SimpleTestSuite.cpp │ ├── main.cpp │ └── stdafx.h ├── TestUtilities │ ├── CMakeLists.txt │ ├── Mocks │ │ └── Services │ │ │ ├── EventHandlers │ │ │ ├── MockTestCaseEndEventHandler.cpp │ │ │ ├── MockTestCaseEndEventHandler.h │ │ │ ├── MockTestCaseStartEventHandler.cpp │ │ │ ├── MockTestCaseStartEventHandler.h │ │ │ ├── MockTestProgramEndEventHandler.cpp │ │ │ ├── MockTestProgramEndEventHandler.h │ │ │ ├── MockTestProgramStartEventHandler.cpp │ │ │ ├── MockTestProgramStartEventHandler.h │ │ │ ├── MockTestSuiteEndEventHandler.cpp │ │ │ ├── MockTestSuiteEndEventHandler.h │ │ │ ├── MockTestSuiteStartEventHandler.cpp │ │ │ └── MockTestSuiteStartEventHandler.h │ │ │ ├── MockServicesFactory.cpp │ │ │ ├── MockServicesFactory.h │ │ │ ├── Report │ │ │ ├── MockTestProgramJSONBuilder.cpp │ │ │ ├── MockTestProgramJSONBuilder.h │ │ │ ├── MockTestSuiteJSONSerializer.cpp │ │ │ └── MockTestSuiteJSONSerializer.h │ │ │ └── System │ │ │ ├── MockFileService.cpp │ │ │ ├── MockFileService.h │ │ │ ├── MockTimeService.cpp │ │ │ ├── MockTimeService.h │ │ │ ├── MockUUIDGeneratorService.cpp │ │ │ └── MockUUIDGeneratorService.h │ ├── Stubs │ │ └── Services │ │ │ ├── StubEventListener.cpp │ │ │ ├── StubEventListener.h │ │ │ ├── StubServicesFactory.cpp │ │ │ ├── StubServicesFactory.h │ │ │ └── System │ │ │ ├── StubFileService.cpp │ │ │ └── StubFileService.h │ └── stdafx.h └── UnitTest │ ├── CMakeLists.txt │ ├── Tests │ └── Services │ │ ├── EventHandlers │ │ ├── TestCaseEndEventHandlerTest.cpp │ │ ├── TestCaseStartEventHandlerTest.cpp │ │ ├── TestProgramEndEventHandlerTest.cpp │ │ ├── TestProgramStartEventHandlerTest.cpp │ │ ├── TestStepEndEventHandlerTest.cpp │ │ ├── TestStepStartEventHandlerTest.cpp │ │ ├── TestSuiteEndEventHandlerTest.cpp │ │ └── TestSuiteStartEventHandlerTest.cpp │ │ ├── GoogleTest │ │ └── GTestEventListenerTest.cpp │ │ ├── Property │ │ ├── TestCasePropertySetterTest.cpp │ │ └── TestSuitePropertySetterTest.cpp │ │ ├── Report │ │ ├── TestProgramJSONBuilderTest.cpp │ │ └── TestSuiteJSONSerializerTest.cpp │ │ └── System │ │ ├── FileServiceTest.cpp │ │ ├── TimeServiceTest.cpp │ │ └── UUIDGeneratorServiceTest.cpp │ ├── main.cpp │ └── stdafx.h └── vs2022.conanprofile /.codacy.yml: -------------------------------------------------------------------------------- 1 | exclude_paths: 2 | - "**.md" 3 | - test/**/* 4 | -------------------------------------------------------------------------------- /.codecov.yml: -------------------------------------------------------------------------------- 1 | ignore: 2 | - "cmake/.*" 3 | - "build/.*" 4 | - "test/.*" 5 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.cmake linguist-vendored 2 | *.txt linguist-vendored 3 | *.py linguist-vendored 4 | *.sh linguist-vendored 5 | -------------------------------------------------------------------------------- /.github/workflows/archive-docs.yml: -------------------------------------------------------------------------------- 1 | on: 2 | repository_dispatch: 3 | types: [doc-build] 4 | 5 | jobs: 6 | build_docs_job: 7 | runs-on: ubuntu-latest 8 | name: 'Automated generation of library documentation' 9 | steps: 10 | - name: 'Generate library documentation' 11 | id: archive-doc 12 | uses: systelab/cpp-library-doc-action@master 13 | env: 14 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 15 | with: 16 | owner: systelab 17 | repo_name: cpp-gtest-allure-utilities 18 | library_name: 'GTestAllureUtilities CSW library' 19 | tag_name: ${{ github.event.client_payload.tag }} 20 | configuration_name: ${{ github.event.client_payload.configuration }} 21 | ci_system: ${{ github.event.client_payload.ci }} 22 | job_id: ${{ github.event.client_payload.job }} 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | build-* 3 | -------------------------------------------------------------------------------- /BUILD.md: -------------------------------------------------------------------------------- 1 | # Build from sources 2 | 3 | ## Prerequisites 4 | - [Git](https://git-scm.com/) 5 | - [Conan](https://conan.io/) 6 | - [CMake](https://cmake.org/) 7 | - [Visual Studio](https://visualstudio.microsoft.com/) (only on Windows) 8 | 9 | ## Build steps 10 | ### Windows 11 | With your desired configuration (Debug, Release), architecture (x86, x86_64) and package info (version from tag, channel stable or testing). 12 | As example (config Release, arch x86_64, version 1.1.0, channel stable): 13 | 14 | ``` bash 15 | > git clone https://github.com/systelab/cpp-gtest-allure-utilities 16 | > conan install . --install-folder build-Release-x86_64 --profile=vs2022.conanprofile -s build_type=Release -s arch=x86_64 17 | > conan build . --build-folder build-Release-x86_64 18 | > conan export-pkg . GTestAllureUtilities/1.1.0@systelab/stable --build-folder build-Release-x86_64 --force 19 | ``` 20 | 21 | ### Others 22 | By creating your own profile or tweaking conan settings you can build it for Linux and/or with another compiler. 23 | Refer to [Conan documentation](https://docs.conan.io/1/reference.html) for more details. -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | 3 | project(GTestAllureUtilities) 4 | 5 | # Configure environment 6 | set(CMAKE_CXX_STANDARD 20) 7 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 8 | set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) 9 | set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) 10 | set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) 11 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) 12 | 13 | # Adjust compilation flags 14 | if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") 15 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=implicit-fallthrough") 16 | endif() 17 | 18 | # Configure include directories 19 | include_directories(${CMAKE_SOURCE_DIR}/src) 20 | include_directories(${CMAKE_SOURCE_DIR}/test) 21 | 22 | # Add subprojects 23 | add_subdirectory(${CMAKE_SOURCE_DIR}/src/GTestAllureUtilities) 24 | add_subdirectory(${CMAKE_SOURCE_DIR}/test/TestUtilities) 25 | add_subdirectory(${CMAKE_SOURCE_DIR}/test/UnitTest) 26 | add_subdirectory(${CMAKE_SOURCE_DIR}/test/IntegrationTest) 27 | add_subdirectory(${CMAKE_SOURCE_DIR}/test/SampleTestProject) 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | MIT License 3 | 4 | Copyright (c) 2017 Systelab Technologies 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /RELEASENOTES.md: -------------------------------------------------------------------------------- 1 | # Summary of changes 2 | 3 | ## Changes for version 1.0.5 (26 Oct 2021) 4 | 5 | ### Bug Fixes 6 | 7 | - Added continuous integration for Jenkins and removed the one for Appveyor and Travis. 8 | 9 | ## Changes for version 1.0.4 (31 Mar 2021) 10 | 11 | ### Bug Fixes 12 | 13 | - Updated continuous integration to: 14 | - Use GitHub Action to generate library documentation 15 | - Upload generated Conan packages to CSW JFrogPlatform 16 | 17 | 18 | ## Changes for version 1.0.3 (8 Sep 2020) 19 | 20 | ### Bug Fixes 21 | 22 | - Moved RapidJSONAdapter dependency to version 1.1.0 23 | 24 | 25 | ## Changes for version 1.0.2 (31 Aug 2020) 26 | 27 | ### Bug Fixes 28 | 29 | - Moved RapidJSONAdapter dependency to version 1.0.9 (to fix memory leak) 30 | 31 | 32 | ## Changes for version 1.0.1 (25 Aug 2020) 33 | 34 | ### Bug Fixes 35 | 36 | - Fixed deploy on Travis configurations 37 | 38 | 39 | ## Changes for version 1.0.0 (4 Apr 2020) 40 | 41 | ### Enhancements 42 | 43 | - Initial version on GitHub 44 | 45 | -------------------------------------------------------------------------------- /ci/pipelines/Build.jenkinsfile: -------------------------------------------------------------------------------- 1 | def channel = "testing" 2 | def version = "0.0.0" 3 | def packageName = "GTestAllureUtilities" 4 | def testApplications = ["UnitTest","IntegrationTest"] 5 | def profile = "vs2022.conanprofile" 6 | def archs = ['x86', 'x86_64'] 7 | def configs = ['Debug', 'Release'] 8 | 9 | library identifier: "cpp-jenkins-pipelines@master", retriever: modernSCM( 10 | [$class: "GitSCMSource", 11 | remote: "https://github.com/systelab/cpp-jenkins-pipelines.git", 12 | credentialsId: "GitHubCredentials"]) 13 | 14 | pipeline 15 | { 16 | agent 17 | { 18 | label 'lib-build' 19 | } 20 | 21 | parameters 22 | { 23 | booleanParam( name: 'uploadTestingPkg', 24 | description: 'Whether or not to upload testing conan package', 25 | defaultValue: false ) 26 | } 27 | 28 | options 29 | { 30 | skipDefaultCheckout(true) 31 | disableConcurrentBuilds() 32 | buildDiscarder(logRotator(numToKeepStr: '5')) 33 | } 34 | 35 | stages 36 | { 37 | stage('Checkout') 38 | { 39 | steps 40 | { 41 | deleteDir() 42 | checkoutSourceCode() 43 | } 44 | } 45 | 46 | stage('Build') 47 | { 48 | steps 49 | { 50 | script 51 | { 52 | archs.each 53 | { arch -> 54 | configs.each 55 | { config -> 56 | stage("Build ${config}|${arch}") 57 | { 58 | def buildFolder = "build-${config}-${arch}" 59 | bat "conan install . --install-folder ${buildFolder} --profile=${profile} -s build_type=${config} -s arch=${arch}" 60 | bat "conan build . --build-folder ${buildFolder}" 61 | bat "conan export-pkg . ${packageName}/${version}@systelab/${channel} --build-folder ${buildFolder} --force" 62 | dir("${buildFolder}/bin/${config}") 63 | { 64 | testApplications.each 65 | { testApplication -> 66 | bat "${testApplication}.exe --gtest_output=xml:${env.WORKSPACE}/${buildFolder}/test_reports/${testApplication}.xml" 67 | } 68 | } 69 | } 70 | } 71 | } 72 | } 73 | } 74 | } 75 | 76 | stage('Deploy') 77 | { 78 | when 79 | { 80 | expression { return params.uploadTestingPkg } 81 | } 82 | steps 83 | { 84 | bat "conan upload ${packageName}/${version}@systelab/${channel} --all -r systelab-conan-local --force" 85 | } 86 | } 87 | } 88 | 89 | post 90 | { 91 | always 92 | { 93 | junit allowEmptyResults: true, testResults: "build*/test_reports/*.xml" 94 | } 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /ci/pipelines/Release.jenkinsfile: -------------------------------------------------------------------------------- 1 | def channel = "testing" 2 | def version = "0.0.0" 3 | def packageName = "GTestAllureUtilities" 4 | def testApplications = ["UnitTest","IntegrationTest"] 5 | def profile = "vs2022.conanprofile" 6 | def archs = ['x86', 'x86_64'] 7 | def configs = ['Debug', 'Release'] 8 | 9 | library identifier: "cpp-jenkins-pipelines@master", retriever: modernSCM( 10 | [$class: "GitSCMSource", 11 | remote: "https://github.com/systelab/cpp-jenkins-pipelines.git", 12 | credentialsId: "GitHubCredentials"]) 13 | 14 | pipeline 15 | { 16 | agent 17 | { 18 | label 'lib-build' 19 | } 20 | 21 | parameters 22 | { 23 | string( name: 'version', 24 | description: 'Number of the version to build (must match the name of the tag that will be checked out)', 25 | defaultValue: '0.0.0' ) 26 | 27 | booleanParam( name: 'stable', 28 | description: 'Show if generated library should be uploaded as stable or testing', 29 | defaultValue: false ) 30 | } 31 | 32 | options 33 | { 34 | skipDefaultCheckout(true) 35 | disableConcurrentBuilds() 36 | } 37 | 38 | stages 39 | { 40 | stage('Checkout') 41 | { 42 | steps 43 | { 44 | script 45 | { 46 | version = params.version 47 | if (params.stable) 48 | { 49 | channel = "stable" 50 | } 51 | } 52 | deleteDir() 53 | checkoutSourceCodeFromTag(version) 54 | } 55 | } 56 | 57 | stage('Build') 58 | { 59 | steps 60 | { 61 | script 62 | { 63 | archs.each 64 | { arch -> 65 | configs.each 66 | { config -> 67 | stage("Build ${config}|${arch}") 68 | { 69 | def buildFolder = "build-${config}-${arch}" 70 | bat "conan install . --install-folder ${buildFolder} --profile=${profile} -s build_type=${config} -s arch=${arch}" 71 | bat "conan build . --build-folder ${buildFolder}" 72 | bat "conan export-pkg . ${packageName}/${version}@systelab/${channel} --build-folder ${buildFolder} --force" 73 | dir("${buildFolder}/bin/${config}") 74 | { 75 | testApplications.each 76 | { testApplication -> 77 | bat "${testApplication}.exe --gtest_output=xml:${env.WORKSPACE}/${buildFolder}/test_reports/${testApplication}.xml" 78 | } 79 | } 80 | } 81 | } 82 | } 83 | } 84 | } 85 | } 86 | 87 | stage('Deploy') 88 | { 89 | steps 90 | { 91 | bat "conan upload ${packageName}/${version}@systelab/${channel} --all -r systelab-conan-local --force" 92 | } 93 | } 94 | } 95 | 96 | post 97 | { 98 | always 99 | { 100 | junit allowEmptyResults: true, testResults: "build*/test_reports/*.xml" 101 | script 102 | { 103 | currentBuild.description = "${version}/${channel}" 104 | } 105 | } 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /conanfile.py: -------------------------------------------------------------------------------- 1 | from conans import ConanFile, CMake, tools 2 | 3 | class GTestAllureUtilitiesConan(ConanFile): 4 | name = "GTestAllureUtilities" 5 | description = "Allure reporting utilities for Google Test" 6 | url = "https://github.com/systelab/cpp-gtest-allure-utilities" 7 | homepage = "https://github.com/systelab/cpp-gtest-allure-utilities" 8 | author = "CSW " 9 | topics = ("conan", "allure", "gtest", "json") 10 | license = "MIT" 11 | generators = "cmake_find_package" 12 | settings = "os", "compiler", "build_type", "arch" 13 | exports_sources = "*","!build-*" 14 | 15 | def requirements(self): 16 | self.requires("RapidJSONAdapter/1.1.7@systelab/stable") 17 | self.requires("gtest/1.14.0#4372c5aed2b4018ed9f9da3e218d18b3") 18 | self.requires("JSONAdapterTestUtilities/1.1.6@systelab/stable", private=True) 19 | 20 | def build(self): 21 | cmake = CMake(self) 22 | cmake.configure(source_folder=".") 23 | cmake.build() 24 | 25 | def imports(self): 26 | self.copy("*.dll", dst="bin", src="bin") 27 | 28 | def package(self): 29 | self.copy("AllureAPI.h", dst="include/GTestAllureUtilities", src="src/GTestAllureUtilities") 30 | self.copy("*.h", dst="include/GTestAllureUtilities/Model", src="src/GTestAllureUtilities/Model") 31 | self.copy("*GTestAllureUtilities.lib", dst="lib", keep_path=False) 32 | self.copy("*GTestAllureUtilities.pdb", dst="lib", keep_path=False) 33 | 34 | def package_info(self): 35 | self.cpp_info.libs = tools.collect_libs(self) 36 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/AllureAPI.cpp: -------------------------------------------------------------------------------- 1 | #include "AllureAPI.h" 2 | 3 | #include "Model/TestProperty.h" 4 | #include "Services/ServicesFactory.h" 5 | #include "Services/EventHandlers/ITestStepStartEventHandler.h" 6 | #include "Services/EventHandlers/ITestStepEndEventHandler.h" 7 | #include "Services/GoogleTest/IGTestStatusChecker.h" 8 | #include "Services/Property/ITestCasePropertySetter.h" 9 | #include "Services/Property/ITestSuitePropertySetter.h" 10 | 11 | 12 | namespace systelab { namespace gtest_allure { 13 | 14 | model::TestProgram AllureAPI::m_testProgram = model::TestProgram(); 15 | service::IServicesFactory* AllureAPI::m_servicesFactory = new service::ServicesFactory(m_testProgram); 16 | 17 | std::unique_ptr<::testing::TestEventListener> AllureAPI::buildListener() 18 | { 19 | return getServicesFactory()->buildGTestEventListener(); 20 | } 21 | 22 | model::TestProgram& AllureAPI::getTestProgram() 23 | { 24 | return m_testProgram; 25 | } 26 | 27 | void AllureAPI::setTestProgramName(const std::string& name) 28 | { 29 | m_testProgram.setName(name); 30 | } 31 | 32 | void AllureAPI::setOutputFolder(const std::string& outputFolder) 33 | { 34 | m_testProgram.setOutputFolder(outputFolder); 35 | } 36 | 37 | void AllureAPI::setTMSLinksPattern(const std::string& tmsLinkPattern) 38 | { 39 | m_testProgram.setTMSLinksPattern(tmsLinkPattern); 40 | } 41 | 42 | void AllureAPI::setFormat(model::Format format) 43 | { 44 | m_testProgram.setFormat(format); 45 | } 46 | 47 | void AllureAPI::setTMSId(const std::string& value) 48 | { 49 | auto testSuitePropertySetter = getServicesFactory()->buildTestSuitePropertySetter(); 50 | testSuitePropertySetter->setProperty(model::test_property::TMS_ID_PROPERTY, value); 51 | } 52 | 53 | void AllureAPI::setTestSuiteName(const std::string& name) 54 | { 55 | setTestSuiteLabel(model::test_property::NAME_PROPERTY, name); 56 | } 57 | 58 | void AllureAPI::setTestSuiteDescription(const std::string& description) 59 | { 60 | setTestSuiteLabel(model::test_property::FEATURE_PROPERTY, description); 61 | } 62 | 63 | void AllureAPI::setTestSuiteEpic(const std::string& epic) 64 | { 65 | setTestSuiteLabel(model::test_property::EPIC_PROPERTY, epic); 66 | } 67 | 68 | void AllureAPI::setTestSuiteSeverity(const std::string& severity) 69 | { 70 | setTestSuiteLabel(model::test_property::SEVERITY_PROPERTY, severity); 71 | } 72 | 73 | void AllureAPI::setTestSuiteLabel(const std::string& name, const std::string& value) 74 | { 75 | auto testSuitePropertySetter = getServicesFactory()->buildTestSuitePropertySetter(); 76 | testSuitePropertySetter->setProperty(name, value); 77 | } 78 | 79 | void AllureAPI::setTestCaseName(const std::string& name) 80 | { 81 | auto testCasePropertySetter = getServicesFactory()->buildTestCasePropertySetter(); 82 | testCasePropertySetter->setProperty(model::test_property::NAME_PROPERTY, name); 83 | } 84 | 85 | void AllureAPI::addAction(const std::string& name, std::function actionFunction) 86 | { 87 | addStep(name, true, actionFunction); 88 | } 89 | 90 | void AllureAPI::addExpectedResult(const std::string& name, std::function verificationFunction) 91 | { 92 | addStep(name, false, verificationFunction); 93 | } 94 | 95 | void AllureAPI::addStep(const std::string& name, bool isAction, std::function stepFunction) 96 | { 97 | auto stepStartEventHandler = getServicesFactory()->buildTestStepStartEventHandler(); 98 | stepStartEventHandler->handleTestStepStart(name, isAction); 99 | 100 | stepFunction(); 101 | 102 | auto statusChecker = getServicesFactory()->buildGTestStatusChecker(); 103 | auto currentStatus = statusChecker->getCurrentTestStatus(); 104 | 105 | auto stepEndEventHandler = getServicesFactory()->buildTestStepEndEventHandler(); 106 | stepEndEventHandler->handleTestStepEnd(currentStatus); 107 | } 108 | 109 | service::IServicesFactory* AllureAPI::getServicesFactory() 110 | { 111 | auto configuredServicesFactoryInstance = service::ServicesFactory::getInstance(); 112 | if (configuredServicesFactoryInstance) 113 | { 114 | return configuredServicesFactoryInstance; 115 | } 116 | else 117 | { 118 | return m_servicesFactory; 119 | } 120 | } 121 | 122 | }} 123 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/AllureAPI.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Model/TestProgram.h" 4 | #include "Model/Format.h" 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | 11 | namespace systelab { namespace gtest_allure { 12 | 13 | namespace service { 14 | class IServicesFactory; 15 | } 16 | 17 | class AllureAPI 18 | { 19 | public: 20 | static std::unique_ptr<::testing::TestEventListener> buildListener(); 21 | 22 | static model::TestProgram& getTestProgram(); 23 | static void setTestProgramName(const std::string&); 24 | static void setOutputFolder(const std::string&); 25 | static void setTMSLinksPattern(const std::string&); 26 | static void setFormat(model::Format format); 27 | 28 | static void setTMSId(const std::string&); 29 | static void setTestSuiteName(const std::string&); 30 | static void setTestSuiteDescription(const std::string&); 31 | static void setTestSuiteEpic(const std::string&); 32 | static void setTestSuiteSeverity(const std::string&); 33 | static void setTestSuiteLabel(const std::string& name, const std::string& value); 34 | 35 | static void setTestCaseName(const std::string&); 36 | static void addAction(const std::string& name, std::function); 37 | static void addExpectedResult(const std::string& name, std::function); 38 | 39 | private: 40 | static void addStep(const std::string& name, bool isAction, std::function); 41 | static service::IServicesFactory* getServicesFactory(); 42 | 43 | private: 44 | static model::TestProgram m_testProgram; 45 | static service::IServicesFactory* m_servicesFactory; 46 | }; 47 | 48 | }} 49 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.2) 2 | 3 | # Find external dependencides 4 | find_package(GTest) 5 | find_package(RapidJSONAdapter) 6 | 7 | # Configure preprocessor definitions 8 | add_compile_options(-D RAPIDJSON_HAS_STDSTRING=1) 9 | 10 | # Add project folder into includes 11 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 12 | 13 | # Configure GTestAllureUtilities static library 14 | set(GTEST_ALLURE_UTILITIES GTestAllureUtilities) 15 | file(GLOB_RECURSE GTEST_ALLURE_UTILITIES_SRC "*.cpp") 16 | file(GLOB_RECURSE GTEST_ALLURE_UTILITIES_HDR "*.h") 17 | add_library(${GTEST_ALLURE_UTILITIES} STATIC ${GTEST_ALLURE_UTILITIES_SRC} ${GTEST_ALLURE_UTILITIES_HDR}) 18 | target_link_libraries(${GTEST_ALLURE_UTILITIES} GTest::GTest RapidJSONAdapter::RapidJSONAdapter) 19 | 20 | #Configure source groups 21 | foreach(FILE ${GTEST_ALLURE_UTILITIES_SRC} ${GTEST_ALLURE_UTILITIES_HDR}) 22 | get_filename_component(PARENT_DIR "${FILE}" DIRECTORY) 23 | string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}" "" GROUP "${PARENT_DIR}") 24 | string(REPLACE "/" "\\" GROUP "${GROUP}") 25 | 26 | if ("${FILE}" MATCHES ".*\\.cpp") 27 | set(GROUP "Source Files${GROUP}") 28 | elseif("${FILE}" MATCHES ".*\\.h") 29 | set(GROUP "Header Files${GROUP}") 30 | endif() 31 | 32 | source_group("${GROUP}" FILES "${FILE}") 33 | endforeach() 34 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Action.cpp: -------------------------------------------------------------------------------- 1 | #include "Action.h" 2 | 3 | #include "StepType.h" 4 | 5 | 6 | namespace systelab { namespace gtest_allure { namespace model { 7 | 8 | Action::Action() 9 | :Step() 10 | { 11 | } 12 | 13 | Action::Action(const Action& other) 14 | :Step(other) 15 | { 16 | } 17 | 18 | StepType Action::getStepType() const 19 | { 20 | return StepType::ACTION_STEP; 21 | } 22 | 23 | Step* Action::clone() const 24 | { 25 | return new Action(*this); 26 | } 27 | 28 | }}} 29 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Action.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Step.h" 4 | 5 | 6 | namespace systelab { namespace gtest_allure { namespace model { 7 | 8 | class Action : public Step 9 | { 10 | public: 11 | Action(); 12 | Action(const Action&); 13 | virtual ~Action() = default; 14 | 15 | StepType getStepType() const override; 16 | Step* clone() const override; 17 | 18 | }; 19 | 20 | }}} 21 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Attachment.cpp: -------------------------------------------------------------------------------- 1 | #include "Attachment.h" 2 | 3 | 4 | namespace systelab { namespace gtest_allure { namespace model { 5 | 6 | Attachment::Attachment() 7 | :m_name("") 8 | ,m_source("") 9 | ,m_type("") 10 | { 11 | } 12 | 13 | Attachment::Attachment(const Attachment& other) 14 | :m_name(other.m_name) 15 | ,m_source(other.m_source) 16 | ,m_type(other.m_type) 17 | { 18 | } 19 | 20 | std::string Attachment::getName() const 21 | { 22 | return m_name; 23 | } 24 | 25 | std::string Attachment::getSource() const 26 | { 27 | return m_source; 28 | } 29 | 30 | std::string Attachment::getType() const 31 | { 32 | return m_type; 33 | } 34 | 35 | void Attachment::setName(const std::string& name) 36 | { 37 | m_name = name; 38 | } 39 | 40 | void Attachment::setSource(const std::string& source) 41 | { 42 | m_source = source; 43 | } 44 | 45 | void Attachment::setType(const std::string& type) 46 | { 47 | m_type = type; 48 | } 49 | 50 | Attachment& Attachment::operator= (const Attachment& other) 51 | { 52 | m_name = other.m_name; 53 | m_source = other.m_source; 54 | m_type = other.m_type; 55 | return *this; 56 | } 57 | 58 | bool operator== (const Attachment& lhs, const Attachment& rhs) 59 | { 60 | return (lhs.m_name == rhs.m_name) && 61 | (lhs.m_source == rhs.m_source) && 62 | (lhs.m_type == rhs.m_type); 63 | } 64 | 65 | bool operator!= (const Attachment& lhs, const Attachment& rhs) 66 | { 67 | return !(lhs == rhs); 68 | } 69 | 70 | }}} -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Attachment.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | 6 | namespace systelab { namespace gtest_allure { namespace model { 7 | 8 | class Attachment 9 | { 10 | public: 11 | Attachment(); 12 | Attachment(const Attachment&); 13 | virtual ~Attachment() = default; 14 | 15 | std::string getName() const; 16 | std::string getSource() const; 17 | std::string getType() const; 18 | 19 | void setName(const std::string&); 20 | void setSource(const std::string&); 21 | void setType(const std::string&); 22 | 23 | virtual Attachment& operator= (const Attachment&); 24 | friend bool operator== (const Attachment& lhs, const Attachment& rhs); 25 | friend bool operator!= (const Attachment& lhs, const Attachment& rhs); 26 | 27 | private: 28 | std::string m_name; 29 | std::string m_source; 30 | std::string m_type; 31 | }; 32 | 33 | }}} 34 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/ExpectedResult.cpp: -------------------------------------------------------------------------------- 1 | #include "ExpectedResult.h" 2 | 3 | #include "StepType.h" 4 | 5 | 6 | namespace systelab { namespace gtest_allure { namespace model { 7 | 8 | ExpectedResult::ExpectedResult() 9 | :Step() 10 | { 11 | } 12 | 13 | ExpectedResult::ExpectedResult(const ExpectedResult& other) 14 | :Step(other) 15 | { 16 | } 17 | 18 | StepType ExpectedResult::getStepType() const 19 | { 20 | return StepType::EXPECTED_RESULT_STEP; 21 | } 22 | 23 | Step* ExpectedResult::clone() const 24 | { 25 | return new ExpectedResult(*this); 26 | } 27 | 28 | }}} 29 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/ExpectedResult.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Step.h" 4 | 5 | 6 | namespace systelab { namespace gtest_allure { namespace model { 7 | 8 | class ExpectedResult : public Step 9 | { 10 | public: 11 | ExpectedResult(); 12 | ExpectedResult(const ExpectedResult&); 13 | virtual ~ExpectedResult() = default; 14 | 15 | StepType getStepType() const override; 16 | Step* clone() const override; 17 | }; 18 | 19 | }}} 20 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Format.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | namespace systelab { namespace gtest_allure { namespace model { 5 | 6 | enum class Format 7 | { 8 | DEFAULT = 0, 9 | ALLURE_FOR_JENKINS = 1 10 | }; 11 | 12 | }}} 13 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Label.cpp: -------------------------------------------------------------------------------- 1 | #include "Label.h" 2 | 3 | 4 | namespace systelab { namespace gtest_allure { namespace model { 5 | 6 | Label::Label() 7 | :m_name("") 8 | ,m_value("") 9 | { 10 | } 11 | 12 | Label::Label(const Label& other) 13 | :m_name(other.m_name) 14 | ,m_value(other.m_value) 15 | { 16 | } 17 | 18 | std::string Label::getName() const 19 | { 20 | return m_name; 21 | } 22 | 23 | std::string Label::getValue() const 24 | { 25 | return m_value; 26 | } 27 | 28 | void Label::setName(const std::string& name) 29 | { 30 | m_name = name; 31 | } 32 | 33 | void Label::setValue(const std::string& value) 34 | { 35 | m_value = value; 36 | } 37 | 38 | Label& Label::operator= (const Label& other) 39 | { 40 | m_name = other.m_name; 41 | m_value = other.m_value; 42 | return *this; 43 | } 44 | 45 | bool operator== (const Label& lhs, const Label& rhs) 46 | { 47 | return (lhs.m_name == rhs.m_name) && 48 | (lhs.m_value == rhs.m_value); 49 | } 50 | 51 | bool operator!= (const Label& lhs, const Label& rhs) 52 | { 53 | return !(lhs == rhs); 54 | } 55 | 56 | }}} -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Label.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | 6 | namespace systelab { namespace gtest_allure { namespace model { 7 | 8 | class Label 9 | { 10 | public: 11 | Label(); 12 | Label(const Label&); 13 | virtual ~Label() = default; 14 | 15 | std::string getName() const; 16 | std::string getValue() const; 17 | 18 | void setName(const std::string&); 19 | void setValue(const std::string&); 20 | 21 | virtual Label& operator= (const Label&); 22 | friend bool operator== (const Label& lhs, const Label& rhs); 23 | friend bool operator!= (const Label& lhs, const Label& rhs); 24 | 25 | private: 26 | std::string m_name; 27 | std::string m_value; 28 | }; 29 | 30 | }}} 31 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Link.cpp: -------------------------------------------------------------------------------- 1 | #include "Link.h" 2 | 3 | 4 | namespace systelab { namespace gtest_allure { namespace model { 5 | 6 | Link::Link() 7 | :m_name("") 8 | ,m_url("") 9 | ,m_type("") 10 | { 11 | } 12 | 13 | Link::Link(const Link& other) 14 | :m_name(other.m_name) 15 | ,m_url(other.m_url) 16 | ,m_type(other.m_type) 17 | { 18 | } 19 | 20 | std::string Link::getName() const 21 | { 22 | return m_name; 23 | } 24 | 25 | std::string Link::getURL() const 26 | { 27 | return m_url; 28 | } 29 | 30 | std::string Link::getType() const 31 | { 32 | return m_type; 33 | } 34 | 35 | void Link::setName(const std::string& name) 36 | { 37 | m_name = name; 38 | } 39 | 40 | void Link::setURL(const std::string& url) 41 | { 42 | m_url = url; 43 | } 44 | 45 | void Link::setType(const std::string& type) 46 | { 47 | m_type = type; 48 | } 49 | 50 | Link& Link::operator= (const Link& other) 51 | { 52 | m_name = other.m_name; 53 | m_url = other.m_url; 54 | m_type = other.m_type; 55 | return *this; 56 | } 57 | 58 | bool operator== (const Link& lhs, const Link& rhs) 59 | { 60 | return (lhs.m_name == rhs.m_name) && 61 | (lhs.m_url == rhs.m_url) && 62 | (lhs.m_type == rhs.m_type); 63 | } 64 | 65 | bool operator!= (const Link& lhs, const Link& rhs) 66 | { 67 | return !(lhs == rhs); 68 | } 69 | 70 | }}} -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Link.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | 6 | namespace systelab { namespace gtest_allure { namespace model { 7 | 8 | class Link 9 | { 10 | public: 11 | Link(); 12 | Link(const Link&); 13 | virtual ~Link() = default; 14 | 15 | std::string getName() const; 16 | std::string getURL() const; 17 | std::string getType() const; 18 | 19 | void setName(const std::string&); 20 | void setURL(const std::string&); 21 | void setType(const std::string&); 22 | 23 | virtual Link& operator= (const Link&); 24 | friend bool operator== (const Link& lhs, const Link& rhs); 25 | friend bool operator!= (const Link& lhs, const Link& rhs); 26 | 27 | private: 28 | std::string m_name; 29 | std::string m_url; 30 | std::string m_type; 31 | }; 32 | 33 | }}} 34 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Parameter.cpp: -------------------------------------------------------------------------------- 1 | #include "Parameter.h" 2 | 3 | 4 | namespace systelab { namespace gtest_allure { namespace model { 5 | 6 | Parameter::Parameter() 7 | :m_name("") 8 | ,m_value("") 9 | { 10 | } 11 | 12 | Parameter::Parameter(const Parameter& other) 13 | :m_name(other.m_name) 14 | ,m_value(other.m_value) 15 | { 16 | } 17 | 18 | std::string Parameter::getName() const 19 | { 20 | return m_name; 21 | } 22 | 23 | std::string Parameter::getValue() const 24 | { 25 | return m_value; 26 | } 27 | 28 | void Parameter::setName(const std::string& name) 29 | { 30 | m_name = name; 31 | } 32 | 33 | void Parameter::setValue(const std::string& value) 34 | { 35 | m_value = value; 36 | } 37 | 38 | Parameter& Parameter::operator= (const Parameter& other) 39 | { 40 | m_name = other.m_name; 41 | m_value = other.m_value; 42 | return *this; 43 | } 44 | 45 | bool operator== (const Parameter& lhs, const Parameter& rhs) 46 | { 47 | return (lhs.m_name == rhs.m_name) && 48 | (lhs.m_value == rhs.m_value); 49 | } 50 | 51 | bool operator!= (const Parameter& lhs, const Parameter& rhs) 52 | { 53 | return !(lhs == rhs); 54 | } 55 | 56 | }}} -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Parameter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | 6 | namespace systelab { namespace gtest_allure { namespace model { 7 | 8 | class Parameter 9 | { 10 | public: 11 | Parameter(); 12 | Parameter(const Parameter&); 13 | virtual ~Parameter() = default; 14 | 15 | std::string getName() const; 16 | std::string getValue() const; 17 | 18 | void setName(const std::string&); 19 | void setValue(const std::string&); 20 | 21 | virtual Parameter& operator= (const Parameter&); 22 | friend bool operator== (const Parameter& lhs, const Parameter& rhs); 23 | friend bool operator!= (const Parameter& lhs, const Parameter& rhs); 24 | 25 | private: 26 | std::string m_name; 27 | std::string m_value; 28 | }; 29 | 30 | }}} 31 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Stage.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | namespace systelab { namespace gtest_allure { namespace model { 5 | 6 | enum class Stage 7 | { 8 | PENDING = 0, 9 | SCHEDULED = 1, 10 | RUNNING = 2, 11 | FINISHED = 3, 12 | INTERRUPTED = 4 13 | }; 14 | 15 | }}} 16 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Status.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | namespace systelab { namespace gtest_allure { namespace model { 5 | 6 | enum class Status 7 | { 8 | UNKNOWN = 0, 9 | PASSED = 1, 10 | FAILED = 2, 11 | BROKEN = 3, 12 | SKIPPED = 4 13 | }; 14 | 15 | }}} 16 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Step.cpp: -------------------------------------------------------------------------------- 1 | #include "Step.h" 2 | 3 | #include "Stage.h" 4 | #include "Status.h" 5 | 6 | 7 | namespace systelab { namespace gtest_allure { namespace model { 8 | 9 | Step::Step() 10 | :m_name("") 11 | ,m_status(Status::UNKNOWN) 12 | ,m_stage(Stage::PENDING) 13 | ,m_start(0) 14 | ,m_stop(0) 15 | { 16 | } 17 | 18 | Step::Step(const Step& other) 19 | :m_name(other.m_name) 20 | ,m_status(other.m_status) 21 | ,m_stage(other.m_stage) 22 | ,m_start(other.m_start) 23 | ,m_stop(other.m_stop) 24 | { 25 | } 26 | 27 | std::string Step::getName() const 28 | { 29 | return m_name; 30 | } 31 | 32 | model::Status Step::getStatus() const 33 | { 34 | return m_status; 35 | } 36 | 37 | model::Stage Step::getStage() const 38 | { 39 | return m_stage; 40 | } 41 | 42 | time_t Step::getStart() const 43 | { 44 | return m_start; 45 | } 46 | 47 | time_t Step::getStop() const 48 | { 49 | return m_stop; 50 | } 51 | 52 | void Step::setName(const std::string& name) 53 | { 54 | m_name = name; 55 | } 56 | 57 | void Step::setStatus(Status status) 58 | { 59 | m_status = status; 60 | } 61 | 62 | void Step::setStage(Stage stage) 63 | { 64 | m_stage = stage; 65 | } 66 | 67 | void Step::setStart(time_t start) 68 | { 69 | m_start = start; 70 | } 71 | 72 | void Step::setStop(time_t stop) 73 | { 74 | m_stop = stop; 75 | } 76 | 77 | Step& Step::operator= (const Step& other) 78 | { 79 | m_name = other.m_name; 80 | m_status = other.m_status; 81 | m_stage = other.m_stage; 82 | m_start = other.m_start; 83 | m_stop = other.m_stop; 84 | 85 | return *this; 86 | } 87 | 88 | bool operator== (const Step& lhs, const Step& rhs) 89 | { 90 | return (lhs.m_name == rhs.m_name) && 91 | (lhs.m_status == rhs.m_status) && 92 | (lhs.m_stage == rhs.m_stage) && 93 | (lhs.m_start == rhs.m_start) && 94 | (lhs.m_stop == rhs.m_stop); 95 | } 96 | 97 | bool operator!= (const Step& lhs, const Step& rhs) 98 | { 99 | return !(lhs == rhs); 100 | } 101 | 102 | }}} 103 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/Step.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | 7 | namespace systelab { namespace gtest_allure { namespace model { 8 | 9 | enum class Stage; 10 | enum class Status; 11 | enum class StepType; 12 | 13 | class Step 14 | { 15 | public: 16 | Step(); 17 | Step(const Step&); 18 | virtual ~Step() = default; 19 | 20 | virtual StepType getStepType() const = 0; 21 | virtual Step* clone() const = 0; 22 | 23 | std::string getName() const; 24 | Status getStatus() const; 25 | Stage getStage() const; 26 | time_t getStart() const; 27 | time_t getStop() const; 28 | 29 | void setName(const std::string&); 30 | void setStatus(Status); 31 | void setStage(Stage); 32 | void setStart(time_t); 33 | void setStop(time_t); 34 | 35 | virtual Step& operator= (const Step&); 36 | friend bool operator== (const Step& lhs, const Step& rhs); 37 | friend bool operator!= (const Step& lhs, const Step& rhs); 38 | 39 | private: 40 | std::string m_name; 41 | Status m_status; 42 | Stage m_stage; 43 | time_t m_start; 44 | time_t m_stop; 45 | }; 46 | 47 | }}} 48 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/StepType.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | 4 | namespace systelab { namespace gtest_allure { namespace model { 5 | 6 | enum class StepType 7 | { 8 | ACTION_STEP = 0, 9 | EXPECTED_RESULT_STEP = 1 10 | }; 11 | 12 | }}} 13 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/TestCase.cpp: -------------------------------------------------------------------------------- 1 | #include "TestCase.h" 2 | 3 | 4 | namespace systelab { namespace gtest_allure { namespace model { 5 | 6 | TestCase::TestCase() 7 | :m_name("") 8 | ,m_status(Status::UNKNOWN) 9 | ,m_stage(Stage::PENDING) 10 | ,m_start(0) 11 | ,m_stop(0) 12 | ,m_steps() 13 | { 14 | } 15 | 16 | TestCase::TestCase(const TestCase& other) 17 | :m_name(other.m_name) 18 | ,m_status(other.m_status) 19 | ,m_stage(other.m_stage) 20 | ,m_start(other.m_start) 21 | ,m_stop(other.m_stop) 22 | ,m_steps() 23 | { 24 | for (const auto& step : other.m_steps) 25 | { 26 | m_steps.push_back(std::unique_ptr(step->clone())); 27 | } 28 | } 29 | 30 | std::string TestCase::getName() const 31 | { 32 | return m_name; 33 | } 34 | 35 | Status TestCase::getStatus() const 36 | { 37 | return m_status; 38 | } 39 | 40 | Stage TestCase::getStage() const 41 | { 42 | return m_stage; 43 | } 44 | 45 | time_t TestCase::getStart() const 46 | { 47 | return m_start; 48 | } 49 | 50 | time_t TestCase::getStop() const 51 | { 52 | return m_stop; 53 | } 54 | 55 | void TestCase::setName(const std::string& name) 56 | { 57 | m_name = name; 58 | } 59 | 60 | void TestCase::setStatus(Status status) 61 | { 62 | m_status = status; 63 | } 64 | 65 | void TestCase::setStage(Stage stage) 66 | { 67 | m_stage = stage; 68 | } 69 | 70 | void TestCase::setStart(time_t start) 71 | { 72 | m_start = start; 73 | } 74 | 75 | void TestCase::setStop(time_t stop) 76 | { 77 | m_stop = stop; 78 | } 79 | 80 | unsigned int TestCase::getStepCount() const 81 | { 82 | return (unsigned int) m_steps.size(); 83 | } 84 | 85 | const Step* TestCase::getStep(unsigned int index) const 86 | { 87 | return m_steps[index].get(); 88 | } 89 | 90 | Step* TestCase::getStep(unsigned int index) 91 | { 92 | return m_steps[index].get(); 93 | } 94 | 95 | void TestCase::addStep(std::unique_ptr step) 96 | { 97 | m_steps.push_back(std::move(step)); 98 | } 99 | 100 | TestCase& TestCase::operator= (const TestCase& other) 101 | { 102 | m_name = other.m_name; 103 | m_status = other.m_status; 104 | m_stage = other.m_stage; 105 | m_start = other.m_start; 106 | m_stop = other.m_stop; 107 | 108 | m_steps = std::vector< std::unique_ptr >(); 109 | for (const auto& step : other.m_steps) 110 | { 111 | m_steps.push_back(std::unique_ptr(step->clone())); 112 | } 113 | 114 | return *this; 115 | } 116 | 117 | bool operator== (const TestCase& lhs, const TestCase& rhs) 118 | { 119 | if ((lhs.m_name != rhs.m_name) && 120 | (lhs.m_status != rhs.m_status) && 121 | (lhs.m_stage != rhs.m_stage) && 122 | (lhs.m_start != rhs.m_start) && 123 | (lhs.m_stop != rhs.m_stop) && 124 | (lhs.m_steps.size() != rhs.m_steps.size())) 125 | { 126 | return false; 127 | } 128 | 129 | unsigned int nSteps = (unsigned int) lhs.m_steps.size(); 130 | for (unsigned int i = 0; i < nSteps; i++) 131 | { 132 | if ((*lhs.m_steps[i]) != (*rhs.m_steps[i])) 133 | { 134 | return false; 135 | } 136 | } 137 | 138 | return true; 139 | } 140 | 141 | bool operator!= (const TestCase& lhs, const TestCase& rhs) 142 | { 143 | return !(lhs == rhs); 144 | } 145 | 146 | }}} 147 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/TestCase.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Stage.h" 4 | #include "Status.h" 5 | #include "Step.h" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | 12 | namespace systelab { namespace gtest_allure { namespace model { 13 | 14 | class TestCase 15 | { 16 | public: 17 | TestCase(); 18 | TestCase(const TestCase&); 19 | virtual ~TestCase() = default; 20 | 21 | std::string getName() const; 22 | Status getStatus() const; 23 | Stage getStage() const; 24 | time_t getStart() const; 25 | time_t getStop() const; 26 | 27 | void setName(const std::string&); 28 | void setStatus(Status); 29 | void setStage(Stage); 30 | void setStart(time_t); 31 | void setStop(time_t); 32 | 33 | unsigned int getStepCount() const; 34 | const Step* getStep(unsigned int index) const; 35 | Step* getStep(unsigned int index); 36 | void addStep(std::unique_ptr); 37 | 38 | virtual TestCase& operator= (const TestCase&); 39 | friend bool operator== (const TestCase& lhs, const TestCase& rhs); 40 | friend bool operator!= (const TestCase& lhs, const TestCase& rhs); 41 | 42 | private: 43 | std::string m_name; 44 | Status m_status; 45 | Stage m_stage; 46 | time_t m_start; 47 | time_t m_stop; 48 | 49 | std::vector< std::unique_ptr > m_steps; 50 | }; 51 | 52 | }}} 53 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/TestProgram.cpp: -------------------------------------------------------------------------------- 1 | #include "TestProgram.h" 2 | 3 | 4 | namespace systelab { namespace gtest_allure { namespace model { 5 | 6 | TestProgram::TestProgram() 7 | :m_name() 8 | ,m_outputFolder(".") 9 | ,m_tmsLinksPattern("http://{}") 10 | ,m_testSuites() 11 | ,m_format(Format::DEFAULT) 12 | { 13 | } 14 | 15 | TestProgram::TestProgram(const TestProgram& other) 16 | :m_name(other.m_name) 17 | ,m_outputFolder(other.m_outputFolder) 18 | ,m_tmsLinksPattern(other.m_tmsLinksPattern) 19 | ,m_testSuites(other.m_testSuites) 20 | ,m_format(other.m_format) 21 | { 22 | } 23 | 24 | std::string TestProgram::getName() const 25 | { 26 | return m_name; 27 | } 28 | 29 | std::string TestProgram::getOutputFolder() const 30 | { 31 | return m_outputFolder; 32 | } 33 | 34 | std::string TestProgram::getTMSLinksPattern() const 35 | { 36 | return m_tmsLinksPattern; 37 | } 38 | 39 | Format TestProgram::getFormat() const 40 | { 41 | return m_format; 42 | } 43 | 44 | void TestProgram::setName(const std::string& name) 45 | { 46 | m_name = name; 47 | } 48 | 49 | void TestProgram::setOutputFolder(const std::string& outputFolder) 50 | { 51 | m_outputFolder = outputFolder; 52 | } 53 | 54 | void TestProgram::setTMSLinksPattern(const std::string& tmsLinksPattern) 55 | { 56 | m_tmsLinksPattern = tmsLinksPattern; 57 | } 58 | 59 | void TestProgram::setFormat(Format format) 60 | { 61 | m_format = format; 62 | } 63 | 64 | size_t TestProgram::getTestSuitesCount() const 65 | { 66 | return m_testSuites.size(); 67 | } 68 | 69 | const TestSuite& TestProgram::getTestSuite(unsigned int index) const 70 | { 71 | return m_testSuites[index]; 72 | } 73 | 74 | TestSuite& TestProgram::getTestSuite(unsigned int index) 75 | { 76 | return m_testSuites[index]; 77 | } 78 | 79 | void TestProgram::addTestSuite(const TestSuite& testSuite) 80 | { 81 | m_testSuites.push_back(testSuite); 82 | } 83 | 84 | void TestProgram::clearTestSuites() 85 | { 86 | m_testSuites.clear(); 87 | } 88 | 89 | TestProgram& TestProgram::operator= (const TestProgram& other) 90 | { 91 | m_name = other.m_name; 92 | m_outputFolder = other.m_outputFolder; 93 | m_tmsLinksPattern = other.m_tmsLinksPattern; 94 | m_testSuites = other.m_testSuites; 95 | return *this; 96 | } 97 | 98 | bool operator== (const TestProgram& lhs, const TestProgram& rhs) 99 | { 100 | return (lhs.m_name == rhs.m_name) && 101 | (lhs.m_outputFolder == rhs.m_outputFolder) && 102 | (lhs.m_tmsLinksPattern == rhs.m_tmsLinksPattern) && 103 | (lhs.m_testSuites == rhs.m_testSuites); 104 | } 105 | 106 | bool operator!= (const TestProgram& lhs, const TestProgram& rhs) 107 | { 108 | return !(lhs == rhs); 109 | } 110 | 111 | }}} -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/TestProgram.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Format.h" 4 | #include "TestSuite.h" 5 | 6 | 7 | namespace systelab { namespace gtest_allure { namespace model { 8 | 9 | class TestProgram 10 | { 11 | public: 12 | TestProgram(); 13 | TestProgram(const TestProgram&); 14 | virtual ~TestProgram() = default; 15 | 16 | std::string getName() const; 17 | std::string getOutputFolder() const; 18 | std::string getTMSLinksPattern() const; 19 | Format getFormat() const; 20 | 21 | void setName(const std::string&); 22 | void setOutputFolder(const std::string&); 23 | void setTMSLinksPattern(const std::string&); 24 | void setFormat(Format); 25 | 26 | size_t getTestSuitesCount() const; 27 | const TestSuite& getTestSuite(unsigned int index) const; 28 | TestSuite& getTestSuite(unsigned int index); 29 | void addTestSuite(const TestSuite&); 30 | void clearTestSuites(); 31 | 32 | 33 | virtual TestProgram& operator= (const TestProgram&); 34 | friend bool operator== (const TestProgram& lhs, const TestProgram& rhs); 35 | friend bool operator!= (const TestProgram& lhs, const TestProgram& rhs); 36 | 37 | private: 38 | std::string m_name; 39 | std::string m_outputFolder; 40 | std::string m_tmsLinksPattern; 41 | std::vector m_testSuites; 42 | Format m_format; 43 | }; 44 | 45 | }}} 46 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/TestProperty.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace systelab { namespace gtest_allure { namespace model { namespace test_property { 6 | 7 | static const std::string TMS_ID_PROPERTY = "TMS_ID"; 8 | static const std::string NAME_PROPERTY = "NAME"; 9 | 10 | static const std::string EPIC_PROPERTY = "epic"; 11 | static const std::string FEATURE_PROPERTY = "feature"; 12 | static const std::string SEVERITY_PROPERTY = "severity"; 13 | 14 | }}}} 15 | -------------------------------------------------------------------------------- /src/GTestAllureUtilities/Model/TestSuite.cpp: -------------------------------------------------------------------------------- 1 | #include "TestSuite.h" 2 | 3 | 4 | namespace systelab { namespace gtest_allure { namespace model { 5 | 6 | TestSuite::TestSuite() 7 | :m_uuid() 8 | ,m_name() 9 | ,m_tmsId("") 10 | ,m_status(Status::UNKNOWN) 11 | ,m_stage(Stage::PENDING) 12 | ,m_start(0) 13 | ,m_stop(0) 14 | ,m_format(Format::DEFAULT) 15 | ,m_labels() 16 | ,m_links() 17 | ,m_testCases() 18 | { 19 | } 20 | 21 | TestSuite::TestSuite(const TestSuite& other) 22 | :m_uuid(other.m_uuid) 23 | ,m_name(other.m_name) 24 | ,m_tmsId(other.m_tmsId) 25 | ,m_status(other.m_status) 26 | ,m_stage(other.m_stage) 27 | ,m_start(other.m_start) 28 | ,m_stop(other.m_stop) 29 | ,m_format(other.m_format) 30 | ,m_labels(other.m_labels) 31 | ,m_links(other.m_links) 32 | ,m_testCases(other.m_testCases) 33 | { 34 | } 35 | 36 | std::string TestSuite::getUUID() const 37 | { 38 | return m_uuid; 39 | } 40 | 41 | std::string TestSuite::getName() const 42 | { 43 | return m_name; 44 | } 45 | 46 | std::string TestSuite::getTmsId() const 47 | { 48 | return m_tmsId; 49 | } 50 | 51 | Status TestSuite::getStatus() const 52 | { 53 | return m_status; 54 | } 55 | 56 | Stage TestSuite::getStage() const 57 | { 58 | return m_stage; 59 | } 60 | 61 | time_t TestSuite::getStart() const 62 | { 63 | return m_start; 64 | } 65 | 66 | time_t TestSuite::getStop() const 67 | { 68 | return m_stop; 69 | } 70 | 71 | Format TestSuite::getFormat() const 72 | { 73 | return m_format; 74 | } 75 | 76 | void TestSuite::setUUID(const std::string& uuid) 77 | { 78 | m_uuid = uuid; 79 | } 80 | 81 | void TestSuite::setName(const std::string& name) 82 | { 83 | m_name = name; 84 | } 85 | 86 | void TestSuite::setTmsId(const std::string& tmsId) 87 | { 88 | m_tmsId = tmsId; 89 | } 90 | 91 | void TestSuite::setStatus(Status status) 92 | { 93 | m_status = status; 94 | } 95 | 96 | void TestSuite::setStage(Stage stage) 97 | { 98 | m_stage = stage; 99 | } 100 | 101 | void TestSuite::setStart(time_t start) 102 | { 103 | m_start = start; 104 | } 105 | 106 | void TestSuite::setStop(time_t stop) 107 | { 108 | m_stop = stop; 109 | } 110 | 111 | void TestSuite::setFormat(Format format) 112 | { 113 | m_format = format; 114 | } 115 | 116 | const std::vector