### SelenideListener Configuration and Test Example Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-selenide/Readme.md This snippet demonstrates how to configure the SelenideListener to automatically save screenshots, page source, and logs upon test failure. It also shows how to include Selenide steps in the test report. The example includes a basic test structure with setup, test methods, and helper methods for opening pages and finding elements, illustrating the integration of Test IT annotations and Selenide functionalities. ```java import com.codeborne.selenide.SelenideElement; import com.codeborne.selenide.junit5.TextReportExtension; import com.codeborne.selenide.logevents.SelenideLogger; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import ru.testit.selenide.LogType; import ru.testit.selenide.SelenideListener; import ru.testit.annotations.Step; import ru.testit.annotations.Title; import java.util.logging.Level; import static com.codeborne.selenide.Selectors.byXpath; import static com.codeborne.selenide.Selenide.$; import static com.codeborne.selenide.Selenide.open; import static com.codeborne.selenide.Condition.text; @ExtendWith(TextReportExtension.class) public class ExampleTests { @BeforeEach public void setUp() { SelenideLogger.addListener( "TmsSelenide", new SelenideListener() .saveScreenshots(true) .savePageSource(true) .includeSelenideSteps(true) .saveLogs(LogType.BROWSER, Level.All)); } @Test public void TestFailed() { openPage(); SelenideElement searchField = getElementByXpath("//h1[contains(@class,\"title\")]"); searchField.shouldHave(text("Система для управления тестированием")); } @Test public void TestSuccess() { openPage(); SelenideElement searchField = getElementByXpath("//h1[contains(@class,\"title\")]"); searchField.shouldHave(text("Система управления тестированием")); } @Step public void openPage() { open("https://testit.software/"); } @Step @Title("Search element by xpath") public SelenideElement getElementByXpath(String xpath) { return $(byXpath(xpath)); } } ``` -------------------------------- ### Install JReleaser CLI Source: https://github.com/testit-tms/adapters-java/blob/main/scripts/PUBLISH.md Installs the JReleaser command-line interface using the SDK manager. This is a prerequisite for using JReleaser for publishing. ```bash # Install using SDK manager or download from https://jreleaser.org/guide/latest/tools/jreleaser-cli.html sdk install jreleaser ``` -------------------------------- ### Gradle Configuration Example Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-jbehave/Readme.md Example of how to configure TestIT TMS adapter properties using Gradle command-line arguments. This allows overriding default settings or providing dynamic values during the build process. ```bash gradle test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Maven Configuration Example Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-jbehave/Readme.md Example of how to configure TestIT TMS adapter properties using Maven command-line arguments. This method is useful for setting adapter configurations directly within the Maven build lifecycle. ```bash maven test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Parameterized Test with Examples Table Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-jbehave/Readme.md Illustrates how to define parameterized tests using Gherkin's Scenario Outline and Examples table, allowing for multiple test runs with different input data. ```gherkin Scenario: Scenario with Positive Examples Given a is And b is When I add a to b Then result is Examples: | a | b | result | | 1 | 3 | 4 | | 2 | 4 | 6 | ``` -------------------------------- ### Maven Command Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-testng/Readme.md Example of how to configure TestIT TMS adapter settings using Maven command-line arguments. This provides flexibility in setting adapter parameters during the build process. ```bash maven test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Gradle Command Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-testng/Readme.md Example of how to configure TestIT TMS adapter settings using Gradle command-line arguments. This allows for dynamic configuration without modifying the properties file directly. ```bash gradle test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Maven Command Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-junit5/Readme.md Example of how to configure TestIT TMS adapter settings using Maven command-line arguments. This provides flexibility in setting adapter parameters during the build process. ```bash maven test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Maven Configuration and Execution Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber5/Readme.md This snippet demonstrates how to set up and run tests with Maven and Test IT. It covers environment variable setup, autotest filtering, and executing the Maven build with Test IT-specific properties. ```bash $ export TMS_TOKEN= $ testit autotests_filter \ --url https://tms.testit.software \ --configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \ --testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \ --framework maven-cucumber \ --output tmp/filter.txt $ maven test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 -Dcucumber.filter.name="$(cat tmp/filter.txt)" ``` -------------------------------- ### Maven Configuration and Execution Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber6/Readme.md This snippet demonstrates how to set up and run tests with Maven and Test IT. It covers environment variable setup, autotest filtering, and executing the Maven build with Test IT-specific properties. ```bash $ export TMS_TOKEN= $ testit autotests_filter \ --url https://tms.testit.software \ --configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \ --testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \ --framework maven-cucumber \ --output tmp/filter.txt $ maven test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 -Dcucumber.filter.name="$(cat tmp/filter.txt)" ``` -------------------------------- ### Maven Command-Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber5/Readme.md Example of how to configure Test IT TMS adapter properties using Maven command-line arguments. This is useful for setting adapter configurations during the build process. ```bash maven test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Maven Command-Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-selenide/Readme.md Example of how to configure TestIT TMS adapter properties using Maven command-line arguments. This is useful for setting adapter-specific parameters during the build and test execution. ```bash maven test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Maven Command-Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber6/Readme.md Example of how to configure Test IT TMS adapter properties using Maven command-line arguments. This is useful for setting adapter configurations during the build process. ```bash maven test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Gradle Command Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-junit5/Readme.md Example of how to configure TestIT TMS adapter settings using Gradle command-line arguments. This allows for dynamic configuration without modifying the properties file directly. ```bash gradle test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Maven Configuration and Execution Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber4/Readme.md This snippet demonstrates how to set up and run tests with Maven and Test IT. It covers environment variable setup, autotest filtering, and executing the Maven build with Test IT-specific properties. ```bash $ export TMS_TOKEN= $ testit autotests_filter \ --url https://tms.testit.software \ --configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \ --testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \ --framework maven-cucumber \ --output tmp/filter.txt $ maven test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 -Dcucumber.filter.name="$(cat tmp/filter.txt)" ``` -------------------------------- ### Maven Command Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-junit4/Readme.md Example of how to configure TestIT TMS adapter settings using Maven command-line arguments. This provides flexibility in setting adapter parameters during the build process. ```bash maven test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Gradle Command-Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-selenide/Readme.md Example of how to configure TestIT TMS adapter properties using Gradle command-line arguments. This allows overriding default settings or providing specific values for test runs. ```bash gradle test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Gradle Command-Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber5/Readme.md Example of how to configure Test IT TMS adapter properties using Gradle command-line arguments. This allows overriding or setting properties directly when running tests. ```bash gradle test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Gradle Command Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-junit4/Readme.md Example of how to configure TestIT TMS adapter settings using Gradle command-line arguments. This allows for dynamic configuration without modifying the properties file directly. ```bash gradle test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Maven Command-Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber7/Readme.md Example of how to configure Test IT TMS adapter properties using Maven command-line arguments. This is useful for setting adapter configurations during the build process. ```bash maven test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Gradle Command-Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber6/Readme.md Example of how to configure Test IT TMS adapter properties using Gradle command-line arguments. This allows overriding or setting properties directly when running tests. ```bash gradle test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### TestIT TMS Adapter Configuration Properties Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-jbehave/Readme.md This section details the configuration properties for the TestIT TMS adapters in Java. It maps file properties to their corresponding environment variables and system properties, providing a comprehensive guide for setting up the adapter. ```APIDOC Configuration Properties: URL: Description: Location of the TMS instance File property: url Environment variable: TMS_URL System property: tmsUrl Private Token: Description: API secret key. See [how to get API secret key](https://github.com/testit-tms/.github/tree/main/configuration#privatetoken) File property: privateToken Environment variable: TMS_PRIVATE_TOKEN System property: tmsPrivateToken Project ID: Description: ID of project in TMS instance. See [how to get project ID](https://github.com/testit-tms/.github/tree/main/configuration#projectid) File property: projectId Environment variable: TMS_PROJECT_ID System property: tmsProjectId Configuration ID: Description: ID of configuration in TMS instance. See [how to get configuration ID](https://github.com/testit-tms/.github/tree/main/configuration#configurationid) File property: configurationId Environment variable: TMS_CONFIGURATION_ID System property: tmsConfigurationId Test Run ID: Description: ID of the created test run in TMS instance. Necessary for adapterMode 0 or 1. File property: testRunId Environment variable: TMS_TEST_RUN_ID System property: tmsTestRunId Test Run Name: Description: Parameter for specifying the name of test run in TMS instance (optional). If not provided, it is created automatically. File property: testRunName Environment variable: TMS_TEST_RUN_NAME System property: tmsTestRunName Adapter Mode: Description: Adapter mode. Default value - 0. The adapter supports following modes: 0 - filters tests by test run ID and configuration ID, and sends the results to the test run 1 - sends all results to the test run without filtering 2 - creates a new test run and sends results to the new test run File property: adapterMode Environment variable: TMS_ADAPTER_MODE System property: tmsAdapterMode ``` -------------------------------- ### TestIT TMS Adapter Configuration Properties Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-selenide/Readme.md This section details the configuration properties for the TestIT TMS adapters in Java. It maps file properties to their corresponding environment variables and system properties, providing a comprehensive guide for setting up the adapter. ```APIDOC Configuration Properties: URL: Description: Location of the TMS instance File property: url Environment variable: TMS_URL System property: tmsUrl Private Token: Description: API secret key. See [how to get API secret key](https://github.com/testit-tms/.github/tree/main/configuration#privatetoken) File property: privateToken Environment variable: TMS_PRIVATE_TOKEN System property: tmsPrivateToken Project ID: Description: ID of project in TMS instance. See [how to get project ID](https://github.com/testit-tms/.github/tree/main/configuration#projectid) File property: projectId Environment variable: TMS_PROJECT_ID System property: tmsProjectId Configuration ID: Description: ID of configuration in TMS instance. See [how to get configuration ID](https://github.com/testit-tms/.github/tree/main/configuration#configurationid) File property: configurationId Environment variable: TMS_CONFIGURATION_ID System property: tmsConfigurationId Test Run ID: Description: ID of the created test run in TMS instance. Necessary for adapterMode 0 or 1. File property: testRunId Environment variable: TMS_TEST_RUN_ID System property: tmsTestRunId Test Run Name: Description: Parameter for specifying the name of test run in TMS instance (optional). If not provided, it is created automatically. File property: testRunName Environment variable: TMS_TEST_RUN_NAME System property: tmsTestRunName Adapter Mode: Description: Adapter mode. Default value - 0. The adapter supports following modes: 0 - filters tests by test run ID and configuration ID, and sends the results to the test run 1 - sends all results to the test run without filtering 2 - creates a new test run and sends results to the new test run File property: adapterMode Environment variable: TMS_ADAPTER_MODE System property: tmsAdapterMode ``` -------------------------------- ### TestIT TMS Adapter Configuration Properties Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-junit5/Readme.md This section details the configuration properties for the TestIT TMS adapters in Java. It maps file properties to their corresponding environment variables and system properties, providing a comprehensive guide for setting up the adapter. ```APIDOC Configuration Properties: URL: Description: Location of the TMS instance File property: url Environment variable: TMS_URL System property: tmsUrl Private Token: Description: API secret key. See [how to get API secret key](https://github.com/testit-tms/.github/tree/main/configuration#privatetoken) File property: privateToken Environment variable: TMS_PRIVATE_TOKEN System property: tmsPrivateToken Project ID: Description: ID of project in TMS instance. See [how to get project ID](https://github.com/testit-tms/.github/tree/main/configuration#projectid) File property: projectId Environment variable: TMS_PROJECT_ID System property: tmsProjectId Configuration ID: Description: ID of configuration in TMS instance. See [how to get configuration ID](https://github.com/testit-tms/.github/tree/main/configuration#configurationid) File property: configurationId Environment variable: TMS_CONFIGURATION_ID System property: tmsConfigurationId Test Run ID: Description: ID of the created test run in TMS instance. Necessary for adapterMode 0 or 1. File property: testRunId Environment variable: TMS_TEST_RUN_ID System property: tmsTestRunId Test Run Name: Description: Parameter for specifying the name of test run in TMS instance (optional). If not provided, it is created automatically. File property: testRunName Environment variable: TMS_TEST_RUN_NAME System property: tmsTestRunName Adapter Mode: Description: Adapter mode. Default value - 0. The adapter supports following modes: 0 - filters tests by test run ID and configuration ID, and sends the results to the test run 1 - sends all results to the test run without filtering 2 - creates a new test run and sends results to the new test run File property: adapterMode Environment variable: TMS_ADAPTER_MODE System property: tmsAdapterMode ``` -------------------------------- ### Manual Publishing Steps Source: https://github.com/testit-tms/adapters-java/blob/main/scripts/PUBLISH.md Provides a sequence of manual commands to publish TestIT Java Adapters. This includes loading environment variables, updating the version in jreleaser.yml, cleaning and staging modules, validating configuration, and deploying. ```bash # 1. Load environment variables source .env # 2. Update version in jreleaser.yml sed -i "s/version: .*/version: '2.7.2-TMS-CLOUD'/" jreleaser.yml # 3. Clean and stage all modules (with Gradle signing disabled) ./gradlew clean ./gradlew jreleaserStage -DdisableSign=true # 4. Validate configuration jreleaser config --assembly # 5. Deploy to Maven Central (with JReleaser signing enabled) jreleaser deploy ``` -------------------------------- ### Create and Push Version Tag Source: https://github.com/testit-tms/adapters-java/blob/main/scripts/PUBLISH.md Demonstrates how to create a Git tag for a new version and push it to the remote repository, which can trigger automatic publishing via GitHub Actions. ```bash # Create and push a version tag git tag v2.7.1-TMS-CLOUD git push origin v2.7.1-TMS-CLOUD ``` -------------------------------- ### Quick Publish Script Source: https://github.com/testit-tms/adapters-java/blob/main/scripts/PUBLISH.md Executes a script to quickly publish the TestIT Java Adapters to Maven Central. Requires the PROJECT_VERSION to be set. ```bash PROJECT_VERSION="2.7.1-TEST" ./scripts/publish-maven-central.sh ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/testit-tms/adapters-java/blob/main/scripts/PUBLISH.md Sets up the necessary environment variables for publishing by copying a template file and editing it with user credentials. This includes Maven Central and GPG details. ```bash # Copy template and fill in your credentials cp env.example .env # Edit .env with your actual values ``` -------------------------------- ### Maven Command-Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber4/Readme.md Example of how to configure Test IT TMS adapter properties using Maven command-line arguments. This is useful for setting adapter configurations during the build process. ```bash maven test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Gradle Command-Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber4/Readme.md Example of how to configure Test IT TMS adapter properties using Gradle command-line arguments. This allows overriding or setting properties directly when running tests. ```bash gradle test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Gradle Command-Line Configuration Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber7/Readme.md Example of how to configure Test IT TMS adapter properties using Gradle command-line arguments. This allows overriding or setting properties directly when running tests. ```bash gradle test -DtmsUrl=http://localhost:8080 -DtmsPrivateToken=Token -DtmsProjectId=f5da5bab-380a-4382-b36f-600083fdd795 -DtmsConfigurationId=3a14fa45-b54e-4859-9998-cc502d4cc8c6 -DtmsAdapterMode=0 -DtmsTestRunId=a17269da-bc65-4671-90dd-d3e3da92af80 -DtmsTestRunName=Regress -DtmsAutomaticCreationTestCases=true -DtmsAutomaticUpdationLinksToTestCases=true -DtmsCertValidation=true -DtmsImportRealtime=true -DtmsTestIt=true ``` -------------------------------- ### Environment Variables for Publishing Source: https://github.com/testit-tms/adapters-java/blob/main/scripts/PUBLISH.md Lists the required environment variables for publishing to Maven Central, including Sonatype username/password and GPG credentials. ```properties # Maven Central Portal credentials JRELEASER_MAVENCENTRAL_USERNAME=your_sonatype_username JRELEASER_MAVENCENTRAL_PASSWORD=your_sonatype_password # GPG signing configuration JRELEASER_GPG_PASSPHRASE=your_gpg_passphrase JRELEASER_GPG_SECRET_KEY=your_base64_encoded_secret_key JRELEASER_GPG_PUBLIC_KEY=your_base64_encoded_public_key ``` -------------------------------- ### Parameterized Cucumber Test with Scenario Outline Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber7/Readme.md A Java Cucumber test class demonstrating parameterized tests using Scenario Outlines and Examples. It includes a simple addition operation with assertions. ```java import io.cucumber.java.en.Then; import io.cucumber.java.en.When; import org.testng.Assert; public class ParameterizedTest { private int result; @When("Summing {int}+{int}") public void sum(int left, int right){ this.result = left + right; } @Then("Result is {int}") public void result(int result){ Assert.assertEquals(this.result, result); } } ``` -------------------------------- ### GitHub Secrets for Publishing Source: https://github.com/testit-tms/adapters-java/blob/main/scripts/PUBLISH.md Lists the required secrets that need to be configured in the GitHub repository settings for the publishing workflow to access necessary credentials. ```properties MAVEN_CENTRAL_USERNAME=your_sonatype_username MAVEN_CENTRAL_PASSWORD=your_sonatype_password GPG_PASSPHRASE=your_gpg_passphrase GPG_SECRET_KEY=your_base64_encoded_secret_key GPG_PUBLIC_KEY=your_base64_encoded_public_key ``` -------------------------------- ### Test IT TMS Meta Tags and Adapter Methods Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-jbehave/Readme.md Provides a reference for Test IT TMS meta-tags used to enrich autotests with metadata like IDs, titles, descriptions, labels, and links. Also lists essential adapter methods for reporting results. ```APIDOC Meta Tags: WorkItemIds: Links autotests with manual tests. Receives an array of manual tests' IDs. DisplayName: Internal autotest name (used in Test IT). ExternalId: Unique internal autotest ID (used in Test IT). Title: Autotest name specified in the autotest card. If not specified, the name from the displayName method is used. Description: Autotest description specified in the autotest card. Labels: Tags listed in the autotest card. Links: Links listed in the autotest card. Adapter Methods: Adapter.addLinks(String url, String title, String description, LinkType type): Adds links to the autotest result. Adapter.addAttachments(String name, String path): Adds attachments to the autotest result. Adapter.addMessage(String message): Adds a message to the autotest result. ``` -------------------------------- ### Set CI/CD Environment Variables Source: https://github.com/testit-tms/adapters-java/blob/main/scripts/PUBLISH.md Configures essential environment variables for the CI/CD pipeline, including project version, JReleaser credentials for Maven Central, GPG keys for signing, and sets the CI flag to true. These variables are crucial for automated builds and deployments. ```bash export PROJECT_VERSION=$VERSION export JRELEASER_MAVENCENTRAL_USERNAME=$MAVEN_CENTRAL_USERNAME export JRELEASER_MAVENCENTRAL_PASSWORD=$MAVEN_CENTRAL_PASSWORD export JRELEASER_GPG_PASSPHRASE=$GPG_PASSPHRASE export JRELEASER_GPG_SECRET_KEY=$GPG_SECRET_KEY export JRELEASER_GPG_PUBLIC_KEY=$GPG_PUBLIC_KEY export CI=true ``` -------------------------------- ### Run Publish Script Source: https://github.com/testit-tms/adapters-java/blob/main/scripts/PUBLISH.md Executes the publish script located at './scripts/publish-maven-central.sh'. This script is responsible for publishing artifacts, likely to Maven Central, and it automatically picks up the project version from the previously set PROJECT_VERSION environment variable. ```bash ./scripts/publish-maven-central.sh ``` -------------------------------- ### GPG Key Encoding Source: https://github.com/testit-tms/adapters-java/blob/main/scripts/PUBLISH.md Commands to export GPG public and secret keys in armored format and then base64 encode them for use in environment variables. ```bash # Export public key gpg --armor --export your-key-id | base64 -w 0 # Export secret key gpg --armor --export-secret-keys your-key-id | base64 -w 0 ``` -------------------------------- ### Parameterized Cucumber Test Scenario Outline Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber7/Readme.md A Gherkin feature file defining a parameterized test scenario using Scenario Outline and Examples for a summing operation. It includes tags for display name and external ID. ```gherkin Feature: Rule Tests that use Rule @DisplayName=sum:{left}+{right}={result} @ExternalId={result} Scenario Outline: Summing When Summing + Then Result is Examples: | left | right | result | | 1 | 1 | 3 | | 9 | 9 | 18 | ``` -------------------------------- ### Parameterized Test Example (Java) Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber6/Readme.md This Java code illustrates how to implement parameterized tests using Cucumber step definitions. It defines a method to perform addition and another to verify the result, allowing for multiple test data sets. ```java import io.cucumber.java.en.Then; import io.cucumber.java.en.When; import org.testng.Assert; public class ParameterizedTest { private int result; @When("Summing {int}+{int}") public void sum(int left, int right){ this.result = left + right; } @Then("Result is {int}") public void result(int result){ Assert.assertEquals(this.result, result); } } ``` -------------------------------- ### Simple Test with Annotations and Adapter Methods Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-jbehave/Readme.md Demonstrates a basic JBehave scenario with Test IT TMS annotations for metadata and adapter methods for reporting links and assertions. ```java import org.jbehave.core.annotations.Given; import org.jbehave.core.annotations.Then; import org.jbehave.core.annotations.When; import ru.testit.models.LinkType; import ru.testit.services.Adapter; import static org.junit.jupiter.api.Assertions.assertEquals; public class SampleSteps { private int a; private int b; private int c; @Given("a is $number") public void a_is(int arg1) { this.a = arg1; } @Given("b is $number") public void b_is(int arg1) { this.b = arg1; } @When("I add a to b") public void i_add_a_to_b() { this.c = this.a + this.b; } @Then("result is $number") public void result_is(int arg1) { Adapter.addLinks("https://testit.ru/", "Test 1", "Desc 1", LinkType.ISSUE); assertEquals(this.c, arg1); } } ``` ```gherkin Scenario: Add a to b Meta: @ExternalId failed_with_all_annotations @DisplayName Failed_test_with_all_annotations @WorkItemIds 123 @Title Title_in_the_autotest_card @Description Test_with_all_annotations @Labels Tag1,Tag2 @Links {"url":"https://dumps.example.com/module/repository","title":"Repository","description":"Example_of_repository","type":"Repository"} Given a is 5 And b is 10 When I add a to b Then result is 14 ``` -------------------------------- ### Parameterized Test Example (Java) Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber5/Readme.md This Java code illustrates how to implement parameterized tests using Cucumber step definitions. It defines a method to perform addition and another to verify the result, allowing for multiple test data sets. ```java import io.cucumber.java.en.Then; import io.cucumber.java.en.When; import org.testng.Assert; public class ParameterizedTest { private int result; @When("Summing {int}+{int}") public void sum(int left, int right){ this.result = left + right; } @Then("Result is {int}") public void result(int result){ Assert.assertEquals(this.result, result); } } ``` -------------------------------- ### Gradle Configuration and Execution Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber5/Readme.md This snippet shows how to configure your environment and execute tests using Gradle with Test IT. It includes setting the TMS_TOKEN, filtering autotests, and running the Gradle build with specific Test IT parameters. ```bash $ export TMS_TOKEN= $ testit autotests_filter \ --url https://tms.testit.software \ --configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \ --testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \ --framework gradle-cucumber \ --output tmp/filter.txt $ gradle test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 -Dcucumber.filter.name="$(cat tmp/filter.txt)" ``` -------------------------------- ### Parameterized Test Example (Java) Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber4/Readme.md This Java code illustrates how to implement parameterized tests using Cucumber step definitions. It defines a method to perform addition and another to verify the result, allowing for multiple test data sets. ```java import io.cucumber.java.en.Then; import io.cucumber.java.en.When; import org.testng.Assert; public class ParameterizedTest { private int result; @When("Summing {int}+{int}") public void sum(int left, int right){ this.result = left + right; } @Then("Result is {int}") public void result(int result){ Assert.assertEquals(this.result, result); } } ``` -------------------------------- ### Gradle Configuration and Execution Source: https://github.com/testit-tms/adapters-java/blob/main/testit-adapter-cucumber6/Readme.md This snippet shows how to configure your environment and execute tests using Gradle with Test IT. It includes setting the TMS_TOKEN, filtering autotests, and running the Gradle build with specific Test IT parameters. ```bash $ export TMS_TOKEN= $ testit autotests_filter \ --url https://tms.testit.software \ --configuration-id 5236eb3f-7c05-46f9-a609-dc0278896464 \ --testrun-id 6d4ac4b7-dd67-4805-b879-18da0b89d4a8 \ --framework gradle-cucumber \ --output tmp/filter.txt $ gradle test -DtmsTestRunId=6d4ac4b7-dd67-4805-b879-18da0b89d4a8 -DtmsAdapterMode=1 -Dcucumber.filter.name="$(cat tmp/filter.txt)" ```