{"id":24360592,"url":"https://github.com/cmccarthyirl/spring-cucumber-testng-parallel-test-harness","last_synced_at":"2025-04-10T08:59:00.783Z","repository":{"id":45483942,"uuid":"311402504","full_name":"cmccarthyIrl/spring-cucumber-testng-parallel-test-harness","owner":"cmccarthyIrl","description":"This project executes Cucumber tests sequentially or in parallel using TestNG, Spring, Cucumber, Java, Logback and Extent Reports to provide a basic test harness. Rest Assured and Selenium test examples are provided","archived":false,"fork":false,"pushed_at":"2025-01-07T10:35:16.000Z","size":15146,"stargazers_count":16,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T08:12:10.594Z","etag":null,"topics":["allure","allure-reports","cucumber","extent-report","extentreports","github-actions","io-cucumber","java-17","logging","parallel","rest-api","rest-assured","rest-assured-framework","selenium","spark-reports","spring-boot","test-automation","test-framework","test-harness","testng"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cmccarthyIrl.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-09T16:43:10.000Z","updated_at":"2024-12-29T11:32:02.000Z","dependencies_parsed_at":"2025-01-18T21:42:31.011Z","dependency_job_id":null,"html_url":"https://github.com/cmccarthyIrl/spring-cucumber-testng-parallel-test-harness","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmccarthyIrl%2Fspring-cucumber-testng-parallel-test-harness","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmccarthyIrl%2Fspring-cucumber-testng-parallel-test-harness/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmccarthyIrl%2Fspring-cucumber-testng-parallel-test-harness/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmccarthyIrl%2Fspring-cucumber-testng-parallel-test-harness/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmccarthyIrl","download_url":"https://codeload.github.com/cmccarthyIrl/spring-cucumber-testng-parallel-test-harness/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248190488,"owners_count":21062280,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["allure","allure-reports","cucumber","extent-report","extentreports","github-actions","io-cucumber","java-17","logging","parallel","rest-api","rest-assured","rest-assured-framework","selenium","spark-reports","spring-boot","test-automation","test-framework","test-harness","testng"],"created_at":"2025-01-18T21:31:51.217Z","updated_at":"2025-04-10T08:59:00.764Z","avatar_url":"https://github.com/cmccarthyIrl.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cucumber Automated Testing Framework\n\n[![run](https://github.com/cmccarthyIrl/spring-cucumber-testng-parallel-test-harness/actions/workflows/run.yml/badge.svg)](https://github.com/cmccarthyIrl/spring-cucumber-testng-parallel-test-harness/actions/workflows/run.yml)\n\n# Index\n\u003ctable\u003e \n\u003ctr\u003e\n  \u003cth\u003eStart\u003c/th\u003e\n  \u003ctd\u003e\n    | \u003ca href=\"#maven\"\u003eMaven\u003c/a\u003e \n    | \u003ca href=\"#quickstart\"\u003eQuickstart\u003c/a\u003e | \n  \u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n  \u003cth\u003eRun\u003c/th\u003e\n  \u003ctd\u003e\n     | \u003ca href=\"#junit\"\u003eTestNG\u003c/a\u003e\n    | \u003ca href=\"#command-line\"\u003eCommand Line\u003c/a\u003e\n    | \u003ca href=\"#ide-support\"\u003eIDE Support\u003c/a\u003e    \n    | \u003ca href=\"#java-jdk\"\u003eJava JDK\u003c/a\u003e    \n    | \u003ca href=\"#troubleshooting\"\u003eTroubleshooting\u003c/a\u003e    |\n  \u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n  \u003cth\u003eReport\u003c/th\u003e \n  \u003ctd\u003e\n     | \u003ca href=\"#configuration\"\u003eConfiguration\u003c/a\u003e \n    | \u003ca href=\"#environment-switching\"\u003eEnvironment Switching\u003c/a\u003e\n    | \u003ca href=\"#extent-reports\"\u003eSpark HTML Reports\u003c/a\u003e\n    | \u003ca href=\"#logging\"\u003eLogging\u003c/a\u003e |\n  \u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n  \u003cth\u003eAdvanced\u003c/th\u003e\n  \u003ctd\u003e\n    | \u003ca href=\"#hooks\"\u003eBefore / After Hooks\u003c/a\u003e\n    | \u003ca href=\"#json-transforms\"\u003eJSON Transforms\u003c/a\u003e\n    | \u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e |\n    \u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n# Maven\n\nThe Framework uses [Spring Boot Test](https://spring.io/guides/gs/testing-web/), [Cucumber](https://cucumber.io/)\n, [Rest Assured](https://rest-assured.io/) and [Selenium](https://www.selenium.dev/) client implementations.\n\nSpring `\u003cdependencies\u003e`:\n\n```xml\n\n\u003cdependecies\u003e\n    ...\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.springframework.amqp\u003c/groupId\u003e\n        \u003cartifactId\u003espring-rabbit\u003c/artifactId\u003e\n        \u003cversion\u003e${spring-rabbit.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.springframework.boot\u003c/groupId\u003e\n        \u003cartifactId\u003espring-boot-starter-test\u003c/artifactId\u003e\n    \u003c/dependency\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.springframework\u003c/groupId\u003e\n        \u003cartifactId\u003espring-test\u003c/artifactId\u003e\n    \u003c/dependency\u003e\n    ...\n\u003c/dependecies\u003e\n```\n\nCucumber \u0026 Rest Assured `\u003cdependencies\u003e`:\n\n```xml\n\n\u003cdependecies\u003e\n    ...\n    \u003cdependency\u003e\n        \u003cgroupId\u003eio.rest-assured\u003c/groupId\u003e\n        \u003cartifactId\u003erest-assured\u003c/artifactId\u003e\n        \u003cversion\u003e${restassured.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eio.cucumber\u003c/groupId\u003e\n        \u003cartifactId\u003ecucumber-java\u003c/artifactId\u003e\n        \u003cversion\u003e${cucumber.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eio.cucumber\u003c/groupId\u003e\n        \u003cartifactId\u003ecucumber-spring\u003c/artifactId\u003e\n        \u003cversion\u003e${cucumber.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eio.cucumber\u003c/groupId\u003e\n        \u003cartifactId\u003ecucumber-testng\u003c/artifactId\u003e\n        \u003cversion\u003e${cucumber.version}\u003c/version\u003e\n    \u003c/dependency\u003e\n    ...\n\u003c/dependecies\u003e\n```\n\nSelenium `\u003cdependencies\u003e`:\n\n```xml\n\n\u003cdependecies\u003e\n    ...\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.seleniumhq.selenium\u003c/groupId\u003e\n        \u003cartifactId\u003eselenium-java\u003c/artifactId\u003e\n        \u003cversion\u003e${selenium-version}\u003c/version\u003e\n    \u003c/dependency\u003e\n    \u003cdependency\u003e\n        \u003cgroupId\u003eorg.seleniumhq.selenium\u003c/groupId\u003e\n        \u003cartifactId\u003eselenium-server\u003c/artifactId\u003e\n        \u003cversion\u003e${selenium-version}\u003c/version\u003e\n    \u003c/dependency\u003e\n    ...\n\u003c/dependecies\u003e\n```\n\n# Quickstart\n\n- [Intellij IDE](https://www.jetbrains.com/idea/) - `Recommended`\n- [Java JDK 17](https://jdk.java.net/java-se-ri/11)\n- [Apache Maven](https://maven.apache.org/docs/3.6.3/release-notes.html)\n\n# TestNG\n\nBy using the [TestNG Framework](https://junit.org/junit4/) we can utilize the [Cucumber Framework](https://cucumber.io/)\nand the `@CucumberOptions` Annotation Type to execute the `*.feature` file tests\n\n\u003e Right click the `WikipediParallelRunner` class and select `Run`\n\n```java\n\n@CucumberOptions(\n        features = {\n                \"src/test/resources/feature\"\n        },\n        plugin = {\n                \"pretty\",\n                \"json:target/cucumber/report.json\",\n                \"com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:\"\n        })\npublic class WikipediaParallelRunnerTest extends AbstractTestNGCucumberTests {\n\n    @Override\n    @DataProvider(parallel = true)\n    public Object[][] scenarios() {\n        return super.scenarios();\n    }\n\n}\n```\n\n# Command Line\n\nNormally you will use your IDE to run a `*.feature` file directly or via the `*Test.java` class. With the `Test` class,\nwe can run tests from the command-line as well.\n\nNote that the `mvn test` command only runs test classes that follow the `*Test.java` naming convention.\n\nYou can run a single test or a suite or tests like so :\n\n```\nmvn test -Dtest=WikipediaParallelRunnerTest\n```\n\nNote that the `mvn clean install` command runs all test Classes that follow the `*Test.java` naming convention\n\n```\nmvn clean install\n```\n\n# IDE Support\n\nTo minimize the discrepancies between IDE versions and Locales the `\u003csourceEncoding\u003e` is set to `UTF-8`\n\n```xml\n\n\u003cproperties\u003e\n    ...\n    \u003cproject.build.sourceEncoding\u003eUTF-8\u003c/project.build.sourceEncoding\u003e\n    \u003cproject.reporting.outputEncoding\u003eUTF-8\u003c/project.reporting.outputEncoding\u003e\n    ...\n\u003c/properties\u003e\n```\n\n# Java JDK\n\nThe Java version to use is defined in the `maven-compiler-plugin`\n\n```xml\n\n\u003cbuild\u003e\n    ...\n    \u003cpluginManagement\u003e\n        \u003cplugins\u003e\n            ...\n            \u003cplugin\u003e\n                \u003cgroupId\u003eorg.apache.maven.plugins\u003c/groupId\u003e\n                \u003cartifactId\u003emaven-compiler-plugin\u003c/artifactId\u003e\n                \u003cconfiguration\u003e\n                    \u003csource\u003e17\u003c/source\u003e\n                    \u003ctarget\u003e17\u003c/target\u003e\n                \u003c/configuration\u003e\n            \u003c/plugin\u003e\n            ...\n        \u003c/plugins\u003e\n    \u003c/pluginManagement\u003e\n    ...\n\u003c/build\u003e\n```\n\n# Configuration\n\nThe `AbstractTestDefinition` class is responsible for specifying each Step class as `@SpringBootTest` and\nits `@ContextConfiguration`\n\n```java\n\n@ContextConfiguration(classes = {FrameworkContextConfiguration.class})\n@SpringBootTest\npublic class AbstractTestDefinition {\n}\n```\n\nThe `FrameworkContextConfiguration` class is responsible for specifying the Spring `@Configuration`, modules to scan,\nproperties to use etc\n\n```java\n\n@EnableRetry\n@Configuration\n@ComponentScan({\n        \"com.cmccarthy.api\", \"com.cmccarthy.common\",\n})\n@PropertySource(\"application.properties\")\npublic class FrameworkContextConfiguration {\n}\n```\n\n# Environment Switching\n\nThere is only one thing you need to do to switch the environment - which is to set `\u003cactiveByDefault\u003e` property in the\nMaster POM.\n\n\u003e By default, the value of `spring.profiles.active` is defined in the `application.properties` file which inherits its\n\u003e value from the Master POM property `\u003cactiveByDefault\u003e`\n\n```xml\n\n\u003cprofiles\u003e\n    ...\n    \u003cprofile\u003e\n        \u003cid\u003eprod\u003c/id\u003e\n        \u003cactivation\u003e\n            \u003cactiveByDefault\u003etrue\u003c/activeByDefault\u003e\n        \u003c/activation\u003e\n        \u003cproperties\u003e\n            \u003cactivatedProperties\u003eprod\u003c/activatedProperties\u003e\n        \u003c/properties\u003e\n    \u003c/profile\u003e\n    ...\n\u003c/profiles\u003e\n```\n\nYou can then specify the profile to use when running Maven from the command line like so:\n\n```\nmvn clean install -DactiveProfile=github-headless\n```\n\nBelow is an example of the `application.properties` file.\n\n```properties\nspring.profiles.active=@activatedProperties@\n```\n\n# Extent Reports\n\nThe Framework uses [Extent Reports Framework](https://extentreports.com/) to generate the HTML Test Reports\n\nThe example below is a report generated automatically by Extent Reports open-source library.\n\n\u003cimg src=\"https://github.com/cmccarthyIrl/spring-cucumber-testng-parallel-test-harness/blob/master/common/src/main/resources/demo/extent-report.jpg\" height=\"400px\"/\u003e\n\n# Allure Reports\n\nThe Framework uses [Allure Reports](https://docs.qameta.io/allure/) to generate the HTML Test Reports\n\nThe example below is a report generated by Allure Reports open-source library.\n\n\u003cimg src=\"https://github.com/cmccarthyIrl/spring-cucumber-testng-parallel-test-harness/blob/master/common/src/main/resources/demo/allure-report.png\" height=\"400px\"/\u003e\n\nTo generate the above report navigate to the root directory of the module under test and execute the following command\n\n`mvn allure:serve`  or `mvn allure:generate` (for an offline report)\n\n# Logging\n\nThe Framework uses [Log4j2](https://logging.apache.org/log4j/2.x/) You can instantiate the logging service in any Class\nlike so\n\n```java\nprivate final Logger logger=LoggerFactory.getLogger(WikipediaPageSteps.class);\n```\n\nyou can then use the logger like so :\n\n```java\nlogger.info(\"This is a info message\");\n        logger.warn(\"This is a warning message\");\n        logger.debug(\"This is a info message\");\n        logger.error(\"This is a error message\");\n```\n\n# Before / After Hooks\n\nThe [Logback](http://logback.qos.ch/) logging service is initialized from the `Hooks.class`\n\nAs the Cucumber Hooks are implemented by all steps we can configure the `@CucumberContextConfiguration` like so :\n\n```java\n\n@CucumberContextConfiguration\npublic class Hooks extends AbstractTestDefinition {\n\n    private static boolean initialized = false;\n    private static final Object lock = new Object();\n\n    @Autowired\n    private HookUtil hookUtil;\n    @Autowired\n    private DriverManager driverManager;\n\n    @Before\n    public void beforeScenario(Scenario scenario) {\n        synchronized (lock) {\n            if (!initialized) {\n                if (!driverManager.isDriverExisting()) {\n                    driverManager.downloadDriver();\n                }\n                initialized = true;\n            }\n        }\n        driverManager.createDriver();\n    }\n\n    @After\n    public void afterScenario(Scenario scenario) {\n        hookUtil.endOfTest(scenario);\n        WebDriverRunner.closeWebDriver();\n    }\n}\n```\n\n# JSON Transforms\n\n[Rest Assured IO](https://rest-assured.io/) is used to map the `Response` Objects to their respective `POJO` Classes\n\n```xml\n\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.rest-assured\u003c/groupId\u003e\n    \u003cartifactId\u003erest-assured\u003c/artifactId\u003e\n    \u003cversion\u003e3.0.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n# Troubleshooting\n\n- Execute the following commands to resolve any dependency issues\n    1. `cd ~/install directory path/spring-cucumber-testng-parallel-test-harness`\n    2. `mvn clean install -DskipTests`\n\n# Contributing\n\nSpotted a mistake? Questions? Suggestions?\n\n[Open an Issue](https://github.com/cmccarthyIrl/spring-cucumber-testng-parallel-test-harness/issues)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmccarthyirl%2Fspring-cucumber-testng-parallel-test-harness","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcmccarthyirl%2Fspring-cucumber-testng-parallel-test-harness","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcmccarthyirl%2Fspring-cucumber-testng-parallel-test-harness/lists"}