├── .circleci └── config.yml ├── .github └── workflows │ └── run-all.yml ├── .gitlab-ci.yml ├── LICENSE.md ├── README.md ├── azure-pipelines.yml ├── misc ├── azure-pipelines-agent-docker │ ├── Dockerfile │ ├── README.md │ └── start.sh └── jenkins-docker │ ├── README.md │ └── dockerfile_jenkins_python_chrome └── samples ├── dotnet └── nunit │ ├── .gitignore │ ├── README.md │ ├── SimpleTestProject.sln │ ├── SimpleTestProject │ ├── SimpleTestProject.csproj │ ├── SimpleTestProject.csproj.user │ ├── Tests │ │ ├── MultiplicationTests.cs │ │ ├── SubtractionTests.cs │ │ └── SumTests.cs │ └── nunit3-junit.xslt │ ├── nuget.config │ ├── sample_reports │ └── junit-report.xml │ └── trcli-config.yml ├── java ├── cucumber-selenium │ ├── .gitignore │ ├── README.md │ ├── pom.xml │ ├── src │ │ └── test │ │ │ ├── java │ │ │ └── demo │ │ │ │ ├── RunCucumberTest.java │ │ │ │ └── StepDefinitions.java │ │ │ └── resources │ │ │ └── demo │ │ │ └── login_demo.feature │ └── trcli-config.yml ├── junit5-selenium │ ├── .circleci │ │ └── config.yml │ ├── .gitignore │ ├── README.md │ ├── java-junit5.iml │ ├── pom.xml │ ├── sample_reports │ │ └── TEST-junit-jupiter.xml │ ├── src │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ └── idera │ │ │ │ └── testrail │ │ │ │ └── tests │ │ │ │ └── HomePageTest.java │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── org.junit.platform.launcher.TestExecutionListener │ └── trcli-config.yml ├── junit5 │ ├── .gitignore │ ├── README.md │ ├── java-junit5.iml │ ├── pom.xml │ ├── sample_reports │ │ ├── TEST-junit-jupiter.xml │ │ └── testrail.jpg │ ├── src │ │ └── test │ │ │ ├── java │ │ │ └── com │ │ │ │ └── idera │ │ │ │ └── testrail │ │ │ │ └── tests │ │ │ │ ├── MultiplicationTests.java │ │ │ │ ├── SubtractionTests.java │ │ │ │ └── SumTests.java │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── services │ │ │ └── org.junit.platform.launcher.TestExecutionListener │ └── trcli-config.yml ├── testng-selenium │ ├── .gitignore │ ├── .travis.yml │ ├── README.md │ ├── pom.xml │ ├── sample_reports │ │ ├── TEST-TestSuite.xml │ │ ├── TestRail suite │ │ │ ├── TestRail Tests .html │ │ │ ├── TestRail Tests .xml │ │ │ └── testng-failed.xml │ │ ├── TestSuite.txt │ │ ├── bullet_point.png │ │ ├── collapseall.gif │ │ ├── emailable-report.html │ │ ├── failed.png │ │ ├── index.html │ │ ├── jquery-3.6.0.min.js │ │ ├── junitreports │ │ │ └── TEST-com.idera.testrail.tests.HomePageTest.xml │ │ ├── navigator-bullet.png │ │ ├── old │ │ │ ├── TestRail suite │ │ │ │ ├── TestRail Tests .properties │ │ │ │ ├── classes.html │ │ │ │ ├── groups.html │ │ │ │ ├── index.html │ │ │ │ ├── main.html │ │ │ │ ├── methods-alphabetical.html │ │ │ │ ├── methods-not-run.html │ │ │ │ ├── methods.html │ │ │ │ ├── reporter-output.html │ │ │ │ ├── testng.xml.html │ │ │ │ └── toc.html │ │ │ └── index.html │ │ ├── passed.png │ │ ├── skipped.png │ │ ├── testng-failed.xml │ │ ├── testng-reports.css │ │ ├── testng-reports.js │ │ ├── testng-reports1.css │ │ ├── testng-reports2.js │ │ ├── testng-results.xml │ │ └── testng.css │ ├── src │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── idera │ │ │ └── testrail │ │ │ └── tests │ │ │ └── HomePageTest.java │ ├── testng.xml │ └── trcli-config.yml └── testng │ ├── .gitignore │ ├── README.md │ ├── java-testng.iml │ ├── pom.xml │ ├── sample_reports │ ├── Surefire suite │ │ ├── Surefire test.html │ │ ├── Surefire test.xml │ │ └── testng-failed.xml │ ├── TEST-TestSuite.xml │ ├── TestSuite.txt │ ├── bullet_point.png │ ├── collapseall.gif │ ├── emailable-report.html │ ├── failed.png │ ├── index.html │ ├── jquery.min.js │ ├── junitreports │ │ ├── TEST-com.idera.testrail.tests.MultiplicationTest.xml │ │ ├── TEST-com.idera.testrail.tests.SubtractionTests.xml │ │ └── TEST-com.idera.testrail.tests.SumTests.xml │ ├── navigator-bullet.png │ ├── old │ │ ├── Surefire suite │ │ │ ├── Surefire test.properties │ │ │ ├── classes.html │ │ │ ├── groups.html │ │ │ ├── index.html │ │ │ ├── main.html │ │ │ ├── methods-alphabetical.html │ │ │ ├── methods-not-run.html │ │ │ ├── methods.html │ │ │ ├── reporter-output.html │ │ │ ├── testng.xml.html │ │ │ └── toc.html │ │ └── index.html │ ├── passed.png │ ├── skipped.png │ ├── testng-failed.xml │ ├── testng-reports.css │ ├── testng-reports.js │ ├── testng-reports1.css │ ├── testng-reports2.js │ ├── testng-results.xml │ └── testng.css │ ├── src │ └── test │ │ └── java │ │ └── com │ │ └── idera │ │ └── testrail │ │ └── tests │ │ ├── MultiplicationTest.java │ │ ├── SubtractionTests.java │ │ └── SumTests.java │ └── trcli-config.yml ├── javascript ├── cypress-saucectl │ ├── .sauce │ │ └── config.yml │ ├── .sauceignore │ ├── README.md │ ├── cypress.config.js │ ├── cypress │ │ ├── e2e │ │ │ └── examples │ │ │ │ ├── actions.cy.js │ │ │ │ ├── assertions.cy.js │ │ │ │ └── traversal.cy.js │ │ ├── fixtures │ │ │ └── example.json │ │ └── support │ │ │ ├── commands.js │ │ │ └── e2e.js │ ├── report-samples │ │ └── saucectl-report.xml │ └── trcli-config.yml ├── cypress-specfirst │ ├── .gitignore │ ├── README.md │ ├── cypress.config.js │ ├── cypress │ │ ├── e2e │ │ │ └── todo_app │ │ │ │ ├── todo_interactions.cy.js │ │ │ │ └── todo_smoke.cy.js │ │ ├── fixtures │ │ │ ├── example.json │ │ │ ├── profile.json │ │ │ └── users.json │ │ ├── plugins │ │ │ └── index.js │ │ └── support │ │ │ ├── commands.js │ │ │ ├── e2e.js │ │ │ └── index.js │ ├── package-lock.json │ ├── package.json │ ├── sample_reports │ │ ├── junit-7c43e91b9f0e5cb6d8f8fd0659575f08.xml │ │ ├── junit-e5562d1b42dfb626769f480e17833736.xml │ │ └── junit-report.xml │ └── trcli-config.yml ├── cypress │ ├── .gitignore │ ├── README.md │ ├── cypress.config.js │ ├── cypress │ │ ├── e2e │ │ │ └── todo_app │ │ │ │ ├── todo_interactions.cy.js │ │ │ │ └── todo_smoke.cy.js │ │ ├── fixtures │ │ │ ├── example.json │ │ │ ├── profile.json │ │ │ └── users.json │ │ ├── plugins │ │ │ └── index.js │ │ └── support │ │ │ ├── commands.js │ │ │ ├── e2e.js │ │ │ └── index.js │ ├── package-lock.json │ ├── package.json │ ├── sample_reports │ │ ├── junit-aa137e1fa1986273534459f6edd78e16.xml │ │ ├── junit-bf08629137ecb6cdf75c19ac700c98cd.xml │ │ └── junit-report.xml │ └── trcli-config.yml ├── playwright │ ├── .gitignore │ ├── README.md │ ├── azure-pipelines.yml │ ├── playwright.config.js │ ├── sample_reports │ │ ├── index.html │ │ └── junit-report.xml │ ├── tests │ │ ├── smoke-tests.spec.js │ │ └── todo-tests.spec.js │ └── trcli-config.yml ├── postman_newmanCLI │ ├── API_Test_Script.postman_collection.json │ ├── README.md │ ├── package-lock.json │ ├── reports │ │ └── newman_junit.xml │ ├── run_newman.sh │ └── trcli-config.yml └── webdriverIO │ ├── .gitignore │ ├── README.md │ ├── features │ ├── login.feature │ ├── pageobjects │ │ ├── login.page.js │ │ ├── page.js │ │ └── secure.page.js │ └── step-definitions │ │ └── steps.js │ ├── package-lock.json │ ├── package.json │ ├── run_webdriverio_tests.sh │ ├── trcli-config.yml │ └── wdio.conf.js ├── jmeter ├── .gitignore ├── README.md ├── jmeter.log ├── jmeter_performance_test.jmx ├── jmeter_trcli.sh ├── sample_result.xml └── trcli-config.yml ├── k6 ├── README.md ├── k6_new_run.sh ├── reports │ └── junit.xml ├── test_k6.js └── trcli-config.yml ├── python ├── pytest-selenium │ ├── .gitignore │ ├── README.md │ ├── pytest.ini │ ├── requirements.txt │ ├── sample_reports │ │ ├── 16a20c01-a2aa-4f30-8724-25a76c11e241_browser_logs.json │ │ ├── 16a20c01-a2aa-4f30-8724-25a76c11e241_screenshot.png │ │ └── junit-report.xml │ ├── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_footer.py │ │ └── test_homepage.py │ └── trcli-config.yml └── pytest │ ├── .gitignore │ ├── README.md │ ├── pytest.ini │ ├── requirements.txt │ ├── sample_reports │ ├── junit-report.xml │ └── testrail.jpg │ ├── tests │ ├── __init__.py │ ├── test_subtraction.py │ └── test_sum.py │ └── trcli-config.yml └── robotframework ├── robotframework-browser ├── .gitignore ├── README.md ├── bitbucket-pipelines.yml ├── requirements.txt ├── sample_reports │ ├── browser │ │ └── screenshot │ │ │ ├── fail-screenshot-1.png │ │ │ └── homepage.png │ ├── junit-report.xml │ ├── log.html │ ├── output.xml │ └── playwright-log.txt ├── tests │ ├── footer-tests.robot │ ├── homepage-tests.robot │ └── keywords.robot └── trcli-config.yml └── robotframework-selenium ├── .gitignore ├── README.md ├── requirements.txt ├── sample_reports ├── failure-1.png ├── log.html ├── output.xml ├── report.html └── selenium-screenshot-1.png ├── tests ├── footer-tests.robot ├── homepage-tests.robot └── keywords.robot └── trcli-config.yml /LICENSE.md: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2022, TestRail - An Idera, Inc. Company 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Tests](https://github.com/gurock/automation-frameworks-integration/actions/workflows/run-all.yml/badge.svg) 2 | 3 | # TestRail test automation frameworks integration 4 | Sample projects on how to integrate your favorite test automation frameworks with TestRail using the TestRail CLI. 5 | 6 | For more information on how to use the TestRail CLI, please refer to the [TestRail CLI documentation](https://support.gurock.com/hc/en-us/articles/7146548750868). 7 | 8 | ## Sample projects 9 | 10 | - [JUnit5](https://github.com/gurock/automation-frameworks-integration/blob/main/samples/java/junit5) 11 | - [JUnit5 with Selenium](https://github.com/gurock/automation-frameworks-integration/blob/main/samples/java/junit5-selenium) 12 | - [TestNG](https://github.com/gurock/automation-frameworks-integration/blob/main/samples/java/testng) 13 | - [NUnit](https://github.com/gurock/automation-frameworks-integration/blob/main/samples/dotnet/nunit) 14 | - [Robot Framework with Selenium](https://github.com/gurock/automation-frameworks-integration/tree/main/samples/robotframework/robotframework-selenium) 15 | - [Robot Framework with Browser (Playwright)](https://github.com/gurock/automation-frameworks-integration/tree/main/samples/robotframework/robotframework-browser) 16 | - [Pytest](https://github.com/gurock/automation-frameworks-integration/tree/main/samples/python/pytest) 17 | - [Pytest with Selenium](https://github.com/gurock/automation-frameworks-integration/tree/main/samples/python/pytest-selenium) 18 | - [Cypress](https://github.com/gurock/automation-frameworks-integration/tree/main/samples/javascript/cypress) 19 | - [Cypress with saucectl](https://github.com/gurock/automation-frameworks-integration/tree/main/samples/javascript/cypress-saucectl) 20 | 21 | ## Misc 22 | 23 | - [Jenkins docker images](https://github.com/gurock/automation-frameworks-integration/blob/main/misc/jenkins-docker) 24 | - [Azure pipelines agent image](https://github.com/gurock/automation-frameworks-integration/blob/main/misc/azure-pipelines-agent-docker) 25 | 26 | ## License 27 | [BSD 3-Clause License](https://github.com/gurock/automation-frameworks-integration/tree/main/LICENSE.md) 28 | -------------------------------------------------------------------------------- /misc/azure-pipelines-agent-docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # Original source: https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/docker 2 | # Added Python installation 3 | 4 | FROM ubuntu:20.04 5 | RUN DEBIAN_FRONTEND=noninteractive apt-get update 6 | RUN DEBIAN_FRONTEND=noninteractive apt-get upgrade -y 7 | 8 | RUN DEBIAN_FRONTEND=noninteractive apt-get install -y -qq --no-install-recommends \ 9 | apt-transport-https \ 10 | apt-utils \ 11 | ca-certificates \ 12 | curl \ 13 | git \ 14 | iputils-ping \ 15 | jq \ 16 | lsb-release \ 17 | software-properties-common 18 | 19 | RUN curl -sL https://aka.ms/InstallAzureCLIDeb | bash 20 | 21 | # Can be 'linux-x64', 'linux-arm64', 'linux-arm', 'rhel.6-x64'. 22 | ENV TARGETARCH=linux-x64 23 | 24 | # Custom for Python 3.10 installation 25 | RUN add-apt-repository ppa:deadsnakes/ppa && \ 26 | apt install -y python3.10-dev python3.10-venv 27 | 28 | RUN mkdir azp && cd /azp && \ 29 | mkdir _work && cd _work && \ 30 | mkdir _tool && cd _tool && \ 31 | mkdir Python && cd Python && \ 32 | mkdir "3.10.12" && cd "3.10.12" && \ 33 | python3.10 -m venv x64 && \ 34 | touch x64.complete 35 | 36 | WORKDIR /azp 37 | 38 | COPY ./start.sh . 39 | RUN chmod +x start.sh 40 | 41 | ENTRYPOINT [ "./start.sh" ] 42 | -------------------------------------------------------------------------------- /misc/azure-pipelines-agent-docker/README.md: -------------------------------------------------------------------------------- 1 | # Azure Pipelines agents docker images repository 2 | 3 | ### Building and running an Azure DevOps pipelines agent with Python 3.10.12 4 | 5 | > Scripts are modified versions of the original sources in the [Azure DevOps documentation](https://learn.microsoft.com/en-us/azure/devops/pipelines/agents/docker) 6 | 7 | 1. Execute the following commands on your terminal 8 | ```shell 9 | docker build -t azureagent:latest . 10 | docker run -e AZP_URL="" -e AZP_TOKEN="" -e AZP_AGENT_NAME="SelfHostedLinux" azureagent:latest 11 | ``` 12 | -------------------------------------------------------------------------------- /misc/azure-pipelines-agent-docker/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | if [ -z "$AZP_URL" ]; then 5 | echo 1>&2 "error: missing AZP_URL environment variable" 6 | exit 1 7 | fi 8 | 9 | if [ -z "$AZP_TOKEN_FILE" ]; then 10 | if [ -z "$AZP_TOKEN" ]; then 11 | echo 1>&2 "error: missing AZP_TOKEN environment variable" 12 | exit 1 13 | fi 14 | 15 | AZP_TOKEN_FILE=/azp/.token 16 | echo -n $AZP_TOKEN > "$AZP_TOKEN_FILE" 17 | fi 18 | 19 | unset AZP_TOKEN 20 | 21 | if [ -n "$AZP_WORK" ]; then 22 | mkdir -p "$AZP_WORK" 23 | fi 24 | 25 | export AGENT_ALLOW_RUNASROOT="1" 26 | 27 | cleanup() { 28 | if [ -e config.sh ]; then 29 | print_header "Cleanup. Removing Azure Pipelines agent..." 30 | 31 | # If the agent has some running jobs, the configuration removal process will fail. 32 | # So, give it some time to finish the job. 33 | while true; do 34 | ./config.sh remove --unattended --auth PAT --token $(cat "$AZP_TOKEN_FILE") && break 35 | 36 | echo "Retrying in 30 seconds..." 37 | sleep 30 38 | done 39 | fi 40 | } 41 | 42 | print_header() { 43 | lightcyan='\033[1;36m' 44 | nocolor='\033[0m' 45 | echo -e "${lightcyan}$1${nocolor}" 46 | } 47 | 48 | # Let the agent ignore the token env variables 49 | export VSO_AGENT_IGNORE=AZP_TOKEN,AZP_TOKEN_FILE 50 | 51 | print_header "1. Determining matching Azure Pipelines agent..." 52 | 53 | AZP_AGENT_PACKAGES=$(curl -LsS \ 54 | -u user:$(cat "$AZP_TOKEN_FILE") \ 55 | -H 'Accept:application/json;' \ 56 | "$AZP_URL/_apis/distributedtask/packages/agent?platform=$TARGETARCH&top=1") 57 | 58 | AZP_AGENT_PACKAGE_LATEST_URL=$(echo "$AZP_AGENT_PACKAGES" | jq -r '.value[0].downloadUrl') 59 | 60 | if [ -z "$AZP_AGENT_PACKAGE_LATEST_URL" -o "$AZP_AGENT_PACKAGE_LATEST_URL" == "null" ]; then 61 | echo 1>&2 "error: could not determine a matching Azure Pipelines agent" 62 | echo 1>&2 "check that account '$AZP_URL' is correct and the token is valid for that account" 63 | exit 1 64 | fi 65 | 66 | print_header "2. Downloading and extracting Azure Pipelines agent..." 67 | 68 | curl -LsS $AZP_AGENT_PACKAGE_LATEST_URL | tar -xz & wait $! 69 | 70 | source ./env.sh 71 | 72 | trap 'cleanup; exit 0' EXIT 73 | trap 'cleanup; exit 130' INT 74 | trap 'cleanup; exit 143' TERM 75 | 76 | print_header "3. Configuring Azure Pipelines agent..." 77 | 78 | ./config.sh --unattended \ 79 | --agent "${AZP_AGENT_NAME:-$(hostname)}" \ 80 | --url "$AZP_URL" \ 81 | --auth PAT \ 82 | --token $(cat "$AZP_TOKEN_FILE") \ 83 | --pool "${AZP_POOL:-Default}" \ 84 | --work "${AZP_WORK:-_work}" \ 85 | --replace \ 86 | --acceptTeeEula & wait $! 87 | 88 | #echo "Configuring Python 3.10.12" 89 | #mkdir _work && cd _work 90 | #mkdir _tool && cd _tool 91 | #mkdir Python && cd Python 92 | #mkdir "3.10.12" && cd "3.10.12" 93 | #python3.10 -m venv x64 94 | #touch x64.complete 95 | #cd /azp 96 | 97 | print_header "4. Running Azure Pipelines agent..." 98 | 99 | trap 'cleanup; exit 0' EXIT 100 | trap 'cleanup; exit 130' INT 101 | trap 'cleanup; exit 143' TERM 102 | 103 | chmod +x ./run.sh 104 | 105 | # To be aware of TERM and INT signals call run.sh 106 | # Running it with the --once flag at the end will shut down the agent after the build is executed 107 | ./run.sh "$@" & wait $! -------------------------------------------------------------------------------- /misc/jenkins-docker/README.md: -------------------------------------------------------------------------------- 1 | # Jenkins docker images repository 2 | 3 | ### Building and running Jenkins with Python and Chrome 4 | 5 | 1. Execute the following commands on your terminal 6 | ```shell 7 | docker build -t jenkins-python-chrome:local -f dockerfile_jenkins_python_chrome . 8 | docker run -p 8080:8080 -p 50000:50000 jenkins-python-chrome:local 9 | ``` 10 | 11 | 2. Copy the admin key from the logs on the terminal 12 | 3. Jenkins should be running on http://localhost:8080 13 | -------------------------------------------------------------------------------- /misc/jenkins-docker/dockerfile_jenkins_python_chrome: -------------------------------------------------------------------------------- 1 | FROM jenkins/jenkins:lts 2 | 3 | USER root 4 | RUN apt-get update 5 | 6 | # Install Python 7 | RUN apt-get install -y \ 8 | build-essential \ 9 | zlib1g-dev \ 10 | libncurses5-dev \ 11 | libgdbm-dev \ 12 | libnss3-dev \ 13 | libssl-dev \ 14 | libreadline-dev \ 15 | libffi-dev \ 16 | libsqlite3-dev \ 17 | wget \ 18 | libbz2-dev 19 | RUN wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz && \ 20 | tar -xvf Python-3.10.0.tgz && \ 21 | cd Python-3.10.0 && \ 22 | ./configure --enable-optimizations && \ 23 | make -j 2 && \ 24 | make altinstall && \ 25 | python3.10 --version 26 | 27 | # Install Google Chrome 28 | # Check versions at: https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable 29 | RUN CHROME_VERSION="113.0.5672.92-1" && \ 30 | wget -O google-chrome.deb "https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb" && \ 31 | apt-get install -y -f ./google-chrome.deb && \ 32 | rm google-chrome.deb && \ 33 | google-chrome --version 34 | 35 | USER jenkins 36 | -------------------------------------------------------------------------------- /samples/dotnet/nunit/.gitignore: -------------------------------------------------------------------------------- 1 | /.vs 2 | /.vscode 3 | /NuGet 4 | */bin 5 | */obj 6 | /reports 7 | -------------------------------------------------------------------------------- /samples/dotnet/nunit/README.md: -------------------------------------------------------------------------------- 1 | # NUnit sample project 2 | 3 | ## How to use the project 4 | 5 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 6 | - Execute the commands on the script below 7 | 8 | ```sh 9 | # Install TR CLI 10 | pip install trcli 11 | 12 | # Install test project 13 | dotnet restore 14 | dotnet build 15 | 16 | # Run tests 17 | ./NuGet/nunit.consolerunner/3.16.3/tools/nunit3-console SimpleTestProject/bin/Debug/net6.0/SimpleTestProject.dll --trace off --result "reports/junit-report.xml;transform=SimpleTestProject/nunit3-junit.xslt" 18 | 19 | # Upload test results 20 | trcli -y -c "trcli-config.yml" parse_junit -f "reports/junit-report.xml" 21 | ``` 22 | -------------------------------------------------------------------------------- /samples/dotnet/nunit/SimpleTestProject.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.1.32421.90 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SimpleTestProject", "SimpleTestProject\SimpleTestProject.csproj", "{55915922-41F7-480F-8AA5-BF1B91378538}" 7 | EndProject 8 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{63C2BF2B-26D7-420A-B225-12208E995191}" 9 | ProjectSection(SolutionItems) = preProject 10 | .gitignore = .gitignore 11 | EndProjectSection 12 | EndProject 13 | Global 14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 15 | Debug|Any CPU = Debug|Any CPU 16 | Release|Any CPU = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 19 | {55915922-41F7-480F-8AA5-BF1B91378538}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 20 | {55915922-41F7-480F-8AA5-BF1B91378538}.Debug|Any CPU.Build.0 = Debug|Any CPU 21 | {55915922-41F7-480F-8AA5-BF1B91378538}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {55915922-41F7-480F-8AA5-BF1B91378538}.Release|Any CPU.Build.0 = Release|Any CPU 23 | EndGlobalSection 24 | GlobalSection(SolutionProperties) = preSolution 25 | HideSolutionNode = FALSE 26 | EndGlobalSection 27 | GlobalSection(ExtensibilityGlobals) = postSolution 28 | SolutionGuid = {8E55A870-F1CD-4AC6-AEE0-6C6A4E13478A} 29 | EndGlobalSection 30 | EndGlobal 31 | -------------------------------------------------------------------------------- /samples/dotnet/nunit/SimpleTestProject/SimpleTestProject.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6.0 5 | enable 6 | 7 | false 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /samples/dotnet/nunit/SimpleTestProject/SimpleTestProject.csproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | Designer 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/dotnet/nunit/SimpleTestProject/Tests/MultiplicationTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace SimpleTestProject 4 | { 5 | [TestFixture] 6 | public class MultiplicationTests 7 | { 8 | [SetUp] 9 | public void Setup() 10 | { 11 | } 12 | 13 | [Test, Property("test_id", "33")] 14 | [TestCase(2, 1, 2)] 15 | [TestCase(2, 2, 4)] 16 | [TestCase(2, 3, 5)] 17 | public void MultiplyDataset(int a, int b, int expected) 18 | { 19 | Assert.That(a*b, Is.EqualTo(expected)); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /samples/dotnet/nunit/SimpleTestProject/Tests/SubtractionTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace SimpleTestProject 4 | { 5 | [TestFixture] 6 | [Category("SimpleMaths")] 7 | public class SubtractionTests 8 | { 9 | [Test] 10 | public void SubtractTwoNumbers() 11 | { 12 | Assert.AreEqual(1, 3-2); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /samples/dotnet/nunit/SimpleTestProject/Tests/SumTests.cs: -------------------------------------------------------------------------------- 1 | using NUnit.Framework; 2 | 3 | namespace SimpleTestProject 4 | { 5 | [TestFixture] 6 | [Category("SimpleMaths")] 7 | public class SumTests 8 | { 9 | [Test] 10 | public void SumTwoNumbers() 11 | { 12 | Assert.AreEqual(2, 1+1); 13 | } 14 | 15 | [Test] 16 | public void SumTwoNumbersWithDecimals() 17 | { 18 | Assert.AreEqual(2.5, 1 + 1.49); 19 | } 20 | 21 | [Category("SimpleMaths")] 22 | class SumMultipleNumbersTests 23 | { 24 | [Test] 25 | public void SumThreeNumbers() 26 | { 27 | Assert.AreEqual(3, 1 + 1 + 1); 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /samples/dotnet/nunit/SimpleTestProject/nunit3-junit.xslt: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /samples/dotnet/nunit/nuget.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | > 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /samples/dotnet/nunit/sample_reports/junit-report.xml: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | at SimpleTestProject.MultiplicationTests.MultiplyDataset(Int32 a, Int32 b, Int32 expected) in C:\Github\automation-frameworks-integration\samples\dotnet\nunit\SimpleTestProject\Tests\MultiplicationTests.cs:line 19 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | at SimpleTestProject.SumTests.SumTwoNumbersWithDecimals() in C:\Github\automation-frameworks-integration\samples\dotnet\nunit\SimpleTestProject\Tests\SumTests.cs:line 18 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /samples/dotnet/nunit/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | project: PROJECT NAME 3 | username: USERNAME 4 | password: PASSWORD 5 | title: NUnit Automated Test Run 6 | -------------------------------------------------------------------------------- /samples/java/cucumber-selenium/.gitignore: -------------------------------------------------------------------------------- 1 | ############################## 2 | ## Java 3 | ############################## 4 | .mtj.tmp/ 5 | *.class 6 | *.jar 7 | *.war 8 | *.ear 9 | *.nar 10 | hs_err_pid* 11 | replay_pid* 12 | 13 | ############################## 14 | ## Maven 15 | ############################## 16 | target/ 17 | pom.xml.tag 18 | pom.xml.releaseBackup 19 | pom.xml.versionsBackup 20 | pom.xml.next 21 | pom.xml.bak 22 | release.properties 23 | dependency-reduced-pom.xml 24 | buildNumber.properties 25 | .mvn/timing.properties 26 | .mvn/wrapper/maven-wrapper.jar 27 | 28 | ############################## 29 | ## Gradle 30 | ############################## 31 | bin/ 32 | build/ 33 | .gradle 34 | .gradletasknamecache 35 | gradle-app.setting 36 | !gradle-wrapper.jar 37 | 38 | ############################## 39 | ## IntelliJ 40 | ############################## 41 | out/ 42 | .idea/ 43 | .idea_modules/ 44 | *.iml 45 | *.ipr 46 | *.iws 47 | 48 | ############################## 49 | ## Eclipse 50 | ############################## 51 | .settings/ 52 | bin/ 53 | tmp/ 54 | .metadata 55 | .classpath 56 | .project 57 | *.tmp 58 | *.bak 59 | *.swp 60 | *~.nib 61 | local.properties 62 | .loadpath 63 | .factorypath 64 | 65 | ############################## 66 | ## NetBeans 67 | ############################## 68 | nbproject/private/ 69 | build/ 70 | nbbuild/ 71 | dist/ 72 | nbdist/ 73 | nbactions.xml 74 | nb-configuration.xml 75 | 76 | ############################## 77 | ## Visual Studio Code 78 | ############################## 79 | .vscode/ 80 | .code-workspace 81 | 82 | ############################## 83 | ## OS X 84 | ############################## 85 | .DS_Store -------------------------------------------------------------------------------- /samples/java/cucumber-selenium/README.md: -------------------------------------------------------------------------------- 1 | # Cucumber Selenium Sample Project 2 | 3 | ## Pre-requisites for running the tests in the project 4 | 5 | You need to install the following on your local machine: 6 | - Java (JDK 8 or higher) 7 | - Maven 8 | - Python3 9 | - Chrome browser 10 | 11 | ## How to upload the test results to TestRail from your local machine 12 | 13 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 14 | - Execute the commands on the script below 15 | 16 | ```sh 17 | # Install TR CLI 18 | pip install trcli 19 | 20 | # Install test project 21 | mvn clean compile 22 | 23 | # Run tests 24 | mvn clean compile test 25 | 26 | # Upload test results to Testrail 27 | trcli -y -c "trcli-config.yml" parse_junit -f "./target/cucumber-results.xml" 28 | 29 | ``` -------------------------------------------------------------------------------- /samples/java/cucumber-selenium/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | demo 7 | java-selenium-bdd 8 | 1.0-SNAPSHOT 9 | 10 | 6.10.4 11 | 5.0.0-ALPHA 12 | UTF-8 13 | 14 | 15 | 16 | io.cucumber 17 | cucumber-java 18 | ${cucumber.version} 19 | test 20 | 21 | 22 | 23 | io.cucumber 24 | cucumber-junit 25 | ${cucumber.version} 26 | test 27 | 28 | 29 | 30 | org.junit 31 | junit5-engine 32 | ${junit.version} 33 | test 34 | 35 | 36 | org.seleniumhq.selenium 37 | selenium-java 38 | 4.12.1 39 | 40 | 41 | io.github.bonigarcia 42 | webdrivermanager 43 | 5.5.3 44 | test 45 | 46 | 47 | 48 | 49 | 50 | org.apache.maven.plugins 51 | maven-compiler-plugin 52 | 3.8.1 53 | 54 | UTF-8 55 | 1.8 56 | 1.8 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /samples/java/cucumber-selenium/src/test/java/demo/RunCucumberTest.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import io.cucumber.junit.Cucumber; 4 | import io.cucumber.junit.CucumberOptions; 5 | import org.junit.runner.RunWith; 6 | 7 | @RunWith(Cucumber.class) 8 | @CucumberOptions(plugin = {"junit:target/cucumber-results.xml"}) 9 | public class RunCucumberTest { 10 | 11 | } -------------------------------------------------------------------------------- /samples/java/cucumber-selenium/src/test/java/demo/StepDefinitions.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import io.cucumber.java.After; 4 | import io.cucumber.java.Before; 5 | import io.cucumber.java.en.Given; 6 | import io.cucumber.java.en.Then; 7 | import io.cucumber.java.en.When; 8 | import io.github.bonigarcia.wdm.WebDriverManager; 9 | 10 | import java.time.Duration; 11 | 12 | import org.junit.Assert; 13 | import org.openqa.selenium.By; 14 | import org.openqa.selenium.WebDriver; 15 | import org.openqa.selenium.WebElement; 16 | import org.openqa.selenium.chrome.ChromeDriver; 17 | import org.openqa.selenium.chrome.ChromeOptions; 18 | import org.openqa.selenium.support.ui.ExpectedConditions; 19 | import org.openqa.selenium.support.ui.WebDriverWait; 20 | 21 | public class StepDefinitions { 22 | private WebDriver driver = null; 23 | private WebDriverWait wait; 24 | 25 | @Before 26 | public void initWebDriverSetup() { 27 | WebDriverManager.chromedriver().setup(); 28 | ChromeOptions options = new ChromeOptions(); 29 | options.addArguments("headless"); 30 | options.addArguments("--remote-allow-origins=*"); 31 | options.addArguments("--window-size=1920,1080"); 32 | options.addArguments("--start-maximized"); 33 | options.addArguments("--no-proxy-server"); 34 | options.addArguments("disable-infobars"); 35 | options.addArguments("--disable-web-security"); 36 | options.addArguments("--allow-running-insecure-content"); 37 | options.addArguments("--ignore-certificate-errors"); 38 | options.addArguments("--disable-extensions"); 39 | options.addArguments("--disable-dev-shm-usage"); // Overcome limited resource problems 40 | options.addArguments("--no-sandbox"); // Bypass OS security model 41 | driver = new ChromeDriver(options); 42 | wait = new WebDriverWait(driver, Duration.ofSeconds(10)); 43 | } 44 | 45 | @Given("^I navigate to the testrail website$") 46 | public void i_navigate_to_the_testrail_website() { 47 | driver.navigate().to("https://www.testrail.com"); 48 | } 49 | 50 | @When("^I validate the page is loaded$") 51 | public void i_validate_the_page_is_loaded() { 52 | Assert.assertTrue(driver.getTitle().contains("TestRail")); 53 | } 54 | 55 | @Then("^the testrail request demo button is present$") 56 | public void the_testrail_request_demo_button_is_present() throws InterruptedException { 57 | By demoButtonSelector = By.linkText("Try TestRail"); 58 | wait.until(ExpectedConditions.elementToBeClickable(demoButtonSelector)); 59 | WebElement demoButton = driver.findElement(demoButtonSelector); 60 | Assert.assertTrue(demoButton.isDisplayed()); 61 | } 62 | 63 | @After 64 | public void terminateWebDriver() { 65 | driver.quit(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /samples/java/cucumber-selenium/src/test/resources/demo/login_demo.feature: -------------------------------------------------------------------------------- 1 | @REQ_LOGIN-9345 2 | Feature: Selenium BDD Demo 3 | 4 | Scenario: Verify TestRail Website Navigation 5 | Given I navigate to the testrail website 6 | When I validate the page is loaded 7 | Then the testrail request demo button is present 8 | -------------------------------------------------------------------------------- /samples/java/cucumber-selenium/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | project: PROJECT NAME 3 | username: USERNAME 4 | password: PASSWORD 5 | title: Cucumber Selenium Automated Test Run -------------------------------------------------------------------------------- /samples/java/junit5-selenium/.circleci/config.yml: -------------------------------------------------------------------------------- 1 | # Use the latest 2.1 version of CircleCI pipeline process engine. 2 | # See: https://circleci.com/docs/2.0/configuration-reference 3 | version: 2.1 4 | orbs: 5 | browser-tools: circleci/browser-tools@1.4.1 6 | working_directory: ~/automation-framework-integration 7 | jobs: 8 | build-and-test: 9 | docker: 10 | - image: cimg/openjdk:15.0 11 | steps: 12 | - browser-tools/install-browser-tools: 13 | chrome-version: 109.0.5414.74 14 | # Checkout the code as the first step. 15 | - checkout 16 | # Build and run the tests 17 | - run: 18 | name: Build and run the tests 19 | command: | 20 | mvn clean compile test 21 | - persist_to_workspace: 22 | root: ./ 23 | paths: 24 | - target/TEST-junit-jupiter.xml 25 | install-trcli-and-parse-results: 26 | docker: 27 | - image: cimg/python:3.11 28 | steps: 29 | - attach_workspace: 30 | at: ./automation-framework-integration 31 | - run: 32 | name: Install TR CLI and upload the test results to TestRail 33 | command: | 34 | pip install trcli 35 | trcli -y \ 36 | -h https://INSTANCE.testrail.io/ \ 37 | --project "PROJECT NAME" \ 38 | -u USER_EMAIL \ 39 | -p PASSWORD \ 40 | parse_junit \ 41 | --title "JUnit5 Selenium Automated Test Run" \ 42 | --run-description $CIRCLE_BUILD_URL \ 43 | -f "./automation-framework-integration/target/TEST-junit-jupiter.xml" 44 | # Invoke jobs via workflows 45 | workflows: 46 | sample: # This is the name of the workflow, feel free to change it to better match your workflow. 47 | jobs: 48 | - build-and-test 49 | - install-trcli-and-parse-results: 50 | requires: 51 | - build-and-test 52 | -------------------------------------------------------------------------------- /samples/java/junit5-selenium/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /.idea -------------------------------------------------------------------------------- /samples/java/junit5-selenium/README.md: -------------------------------------------------------------------------------- 1 | # JUnit5 sample project 2 | 3 | ## Pre-requisites for running the tests in the project 4 | 5 | You need to install the following on your local machine: 6 | - Java (JDK 8 or higher) 7 | - Maven 8 | - Python3 9 | - Chrome browser 10 | 11 | ## How to upload the test results to TestRail from your local machine 12 | 13 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 14 | - Execute the commands on the script below 15 | 16 | ```sh 17 | # Install TR CLI 18 | pip install trcli 19 | 20 | # Install test project 21 | mvn clean compile 22 | 23 | # Run tests 24 | mvn clean compile test 25 | 26 | # Upload test results to Testrail 27 | trcli -y -c "trcli-config.yml" parse_junit -f "./target/TEST-junit-jupiter.xml" 28 | 29 | ``` -------------------------------------------------------------------------------- /samples/java/junit5-selenium/java-junit5.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /samples/java/junit5-selenium/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.idera.testrail.tests.junit5 8 | java-junit5 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 5.7.1 13 | 1.7.1 14 | 1.7.36 15 | 16 | 17 | 18 | 19 | 20 | maven-compiler-plugin 21 | 22 | true 23 | 1.8 24 | 1.8 25 | 26 | 27 | -parameters 28 | 29 | 30 | 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-surefire-plugin 35 | 2.22.2 36 | 37 | true 38 | true 39 | false 40 | 41 | 42 | 43 | 44 | 45 | 46 | org.junit.jupiter 47 | junit-jupiter-engine 48 | 5.8.2 49 | test 50 | 51 | 52 | org.junit.jupiter 53 | junit-jupiter-params 54 | 5.8.2 55 | test 56 | 57 | 58 | org.apache.commons 59 | commons-lang3 60 | 3.9 61 | 62 | 63 | com.testrail 64 | testrail-junit-extensions 65 | 0.1.0 66 | test 67 | 68 | 69 | org.seleniumhq.selenium 70 | selenium-java 71 | 4.12.1 72 | 73 | 74 | io.github.bonigarcia 75 | webdrivermanager 76 | 5.5.3 77 | test 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /samples/java/junit5-selenium/src/test/java/com/idera/testrail/tests/HomePageTest.java: -------------------------------------------------------------------------------- 1 | package com.idera.testrail.tests; 2 | 3 | import io.github.bonigarcia.wdm.WebDriverManager; 4 | import org.junit.jupiter.api.AfterEach; 5 | import org.junit.jupiter.api.BeforeEach; 6 | import org.junit.jupiter.api.Test; 7 | import org.openqa.selenium.By; 8 | import org.openqa.selenium.WebDriver; 9 | import org.openqa.selenium.WebElement; 10 | import org.openqa.selenium.chrome.ChromeDriver; 11 | import org.openqa.selenium.chrome.ChromeOptions; 12 | 13 | import static org.junit.jupiter.api.Assertions.assertTrue; 14 | 15 | 16 | class HomePageTest { 17 | 18 | public static WebDriver driver; 19 | 20 | @BeforeEach 21 | public void setUp() { 22 | WebDriverManager.chromedriver().setup(); 23 | ChromeOptions options = new ChromeOptions(); 24 | options.addArguments("headless"); 25 | options.addArguments("--remote-allow-origins=*"); 26 | options.addArguments("--window-size=1920,1080"); 27 | options.addArguments("--start-maximized"); 28 | options.addArguments("--no-proxy-server"); 29 | options.addArguments("disable-infobars"); // Disabling infobars 30 | options.addArguments("--disable-web-security"); 31 | options.addArguments("--allow-running-insecure-content"); 32 | options.addArguments("--ignore-certificate-errors"); 33 | options.addArguments("--disable-extensions"); // Disabling extensions 34 | options.addArguments("--disable-dev-shm-usage"); // Overcome limited resource problems 35 | options.addArguments("--no-sandbox"); // Bypass OS security model 36 | driver = new ChromeDriver(options); 37 | // Navigation: Open a website 38 | driver.navigate().to("https://www.gurock.com/testrail"); 39 | } 40 | 41 | @AfterEach 42 | public void tearDown() { 43 | // Quit Driver after each test is completed 44 | driver.quit(); 45 | } 46 | 47 | @Test 48 | void verifyTitleOfHomePage() { 49 | // Assertion: Check its title is correct 50 | assertTrue(driver.getTitle().contains("TestRail")); 51 | } 52 | 53 | @Test 54 | void verifyPresenceOfDemoLinkOnHomePage() { 55 | // Assertion: Check the presence of demo link 56 | By demoButtonSelector = By.linkText("Get a Demo"); 57 | WebElement demoButton = driver.findElement(demoButtonSelector); 58 | assertTrue(demoButton.isDisplayed()); 59 | } 60 | 61 | @Test 62 | void invalidTest() { 63 | assertTrue(driver.getTitle().contains("WRONG TITLE")); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /samples/java/junit5-selenium/src/test/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener: -------------------------------------------------------------------------------- 1 | com.testrail.junit.customjunitxml.EnhancedLegacyXmlReportGeneratingListener -------------------------------------------------------------------------------- /samples/java/junit5-selenium/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | project: PROJECT NAME 3 | username: USERNAME 4 | password: PASSWORD 5 | title: JUnit5 Selenium Automated Test Run -------------------------------------------------------------------------------- /samples/java/junit5/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /.idea -------------------------------------------------------------------------------- /samples/java/junit5/README.md: -------------------------------------------------------------------------------- 1 | # JUnit5 sample project 2 | 3 | ## How to use the project 4 | 5 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 6 | - Execute the commands on the script below 7 | 8 | ```sh 9 | # Install TR CLI 10 | pip install trcli 11 | 12 | # Install test project 13 | mvn clean compile 14 | 15 | # Run tests 16 | mvn clean compile test 17 | 18 | # Upload test results 19 | trcli -y -c "trcli-config.yml" parse_junit -f "./target/TEST-junit-jupiter.xml" 20 | 21 | ``` 22 | 23 | In case you want to run the project using docker instead, you can use the script below. 24 | ```sh 25 | # Install TR CLI 26 | pip install trcli 27 | 28 | # Execute tests project in docker 29 | docker run -it -v ${PWD}:/usr/src/junit5 -w "/usr/src/junit5" maven:3.6.3-jdk-11-openj9 mvn clean compile test 30 | 31 | # Upload test results 32 | trcli -y -c "trcli-config.yml" parse_junit -f "./target/TEST-junit-jupiter.xml" 33 | 34 | ``` -------------------------------------------------------------------------------- /samples/java/junit5/java-junit5.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /samples/java/junit5/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.idera.testrail.tests.junit5 8 | java-junit5 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 5.7.1 13 | 1.7.1 14 | 1.7.36 15 | 16 | 17 | 18 | 19 | 20 | maven-compiler-plugin 21 | 22 | true 23 | 1.8 24 | 1.8 25 | 26 | 27 | -parameters 28 | 29 | 30 | 31 | 32 | 33 | org.apache.maven.plugins 34 | maven-surefire-plugin 35 | 2.22.2 36 | 37 | true 38 | true 39 | false 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | org.junit.jupiter 48 | junit-jupiter-engine 49 | 5.8.2 50 | test 51 | 52 | 53 | org.junit.jupiter 54 | junit-jupiter-params 55 | 5.8.2 56 | test 57 | 58 | 59 | com.testrail 60 | testrail-junit-extensions 61 | 0.1.0 62 | test 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /samples/java/junit5/sample_reports/testrail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/java/junit5/sample_reports/testrail.jpg -------------------------------------------------------------------------------- /samples/java/junit5/src/test/java/com/idera/testrail/tests/MultiplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.idera.testrail.tests; 2 | 3 | import org.junit.jupiter.api.Test; 4 | 5 | import static org.junit.jupiter.api.Assertions.assertEquals; 6 | 7 | 8 | class MultiplicationTests { 9 | 10 | @Test 11 | void MultiplyTwoNumbers() { 12 | assertEquals(4, 2*2, "Should equal 4"); 13 | } 14 | } -------------------------------------------------------------------------------- /samples/java/junit5/src/test/java/com/idera/testrail/tests/SubtractionTests.java: -------------------------------------------------------------------------------- 1 | package com.idera.testrail.tests; 2 | 3 | import org.junit.jupiter.api.DisplayName; 4 | import org.junit.jupiter.api.Test; 5 | 6 | import static org.junit.jupiter.api.Assertions.assertEquals; 7 | 8 | class SubtractionTests { 9 | 10 | @Test 11 | @DisplayName("Subtract Two Numbers") 12 | void SubtractTwoNumbers() { 13 | assertEquals(1, 2-1, "Should equal 1"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/java/junit5/src/test/java/com/idera/testrail/tests/SumTests.java: -------------------------------------------------------------------------------- 1 | package com.idera.testrail.tests; 2 | 3 | import com.testrail.junit.customjunitxml.TestRailTestReporter; 4 | import com.testrail.junit.customjunitxml.TestRailTestReporterParameterResolver; 5 | import com.testrail.junit.customjunitxml.annotations.TestRail; 6 | import org.junit.jupiter.api.DisplayName; 7 | import org.junit.jupiter.api.Nested; 8 | import org.junit.jupiter.api.Test; 9 | import org.junit.jupiter.api.extension.ExtendWith; 10 | 11 | import static org.junit.jupiter.api.Assertions.assertEquals; 12 | 13 | @ExtendWith(TestRailTestReporterParameterResolver.class) 14 | class SumTests { 15 | 16 | @Test 17 | @DisplayName("Add Two Numbers") 18 | void AddTwoNumbers() { 19 | assertEquals(3, 1+2, "1 + 2 should equal 3"); 20 | } 21 | 22 | @Test 23 | @DisplayName("Add Two Numbers With Decimals") 24 | void AddTwoNumbersWithDecimals(TestRailTestReporter customReporter) { 25 | customReporter.setProperty("testrail_attachment", "sample_reports/testrail.jpg"); 26 | assertEquals(3, 1.5+1.4, "1.5+1.4 should equal 3"); 27 | } 28 | 29 | @Nested 30 | class AddMoreNumbersTests { 31 | 32 | @Test 33 | @DisplayName("Add Three Numbers") 34 | void AddThreeNumbers() { 35 | assertEquals(3, 1+1+1, "1+1+1 should equal 3"); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /samples/java/junit5/src/test/resources/META-INF/services/org.junit.platform.launcher.TestExecutionListener: -------------------------------------------------------------------------------- 1 | com.testrail.junit.customjunitxml.EnhancedLegacyXmlReportGeneratingListener -------------------------------------------------------------------------------- /samples/java/junit5/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | project: PROJECT NAME 3 | username: USERNAME 4 | password: PASSWORD 5 | title: JUnit5 Automated Test Run 6 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /report_sample 3 | /.idea -------------------------------------------------------------------------------- /samples/java/testng-selenium/.travis.yml: -------------------------------------------------------------------------------- 1 | dist: xenial 2 | jobs: 3 | include: 4 | - language: python 5 | python: 3.9-dev 6 | addons: 7 | chrome: stable 8 | stage: Run tests and upload results to TestRail 9 | script: 10 | - mvn clean compile test 11 | after_script : 12 | - pip install trcli 13 | - trcli -y 14 | -h https://INSTANCE.testrail.io/ 15 | --project "PROJECT NAME" 16 | -u USER_EMAIL 17 | -p PASSWORD 18 | parse_junit 19 | --title "TestNG Selenium Automated Test Run" 20 | --run-description $TRAVIS_JOB_WEB_URL 21 | -f "./target/surefire-reports/TEST-TestSuite.xml" -------------------------------------------------------------------------------- /samples/java/testng-selenium/README.md: -------------------------------------------------------------------------------- 1 | # TestNG sample project 2 | 3 | ## Pre-requisites for running the tests in the project 4 | You need to install the following on your local machine: 5 | - Java (JDK 8 or higher) 6 | - Maven 7 | - Python3 8 | - Chrome browser 9 | 10 | ## How to upload the test results to TestRail from your local machine 11 | 12 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 13 | - Execute the commands on the script below 14 | 15 | ```sh 16 | # Install TR CLI 17 | pip install trcli 18 | 19 | # Install test project 20 | mvn clean compile 21 | 22 | # Run tests 23 | mvn clean compile test 24 | 25 | # Upload test results 26 | trcli -y -c "trcli-config.yml" parse_junit -f "./reports/TEST-TestSuite.xml" 27 | 28 | ``` -------------------------------------------------------------------------------- /samples/java/testng-selenium/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.idera.testrail.tests.testng 8 | java-testng 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 11 13 | 11 14 | 15 | 16 | 17 | 18 | maven-compiler-plugin 19 | 3.7.0 20 | 21 | 1.8 22 | 1.8 23 | 24 | 25 | 26 | org.apache.maven.plugins 27 | maven-surefire-plugin 28 | 3.0.0 29 | 30 | true 31 | false 32 | reports 33 | 34 | testng.xml 35 | 36 | 37 | 38 | reporter 39 | 40 | org.testng.reporters.XMLReporter:generateTestResultAttributes=true,generateGroupsAttribute=true 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | org.testng 51 | testng 52 | 7.7.0 53 | compile 54 | 55 | 56 | org.seleniumhq.selenium 57 | selenium-java 58 | 4.0.0 59 | 60 | 61 | io.github.bonigarcia 62 | webdrivermanager 63 | 5.3.2 64 | test 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | org.apache.maven.plugins 75 | maven-surefire-report-plugin 76 | 3.0.0 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/TestRail suite/TestRail Tests .xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/TestRail suite/testng-failed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/TestSuite.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------- 2 | Test set: TestSuite 3 | ------------------------------------------------------------------------------- 4 | Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 35.439 s <<< FAILURE! - in TestSuite 5 | com.idera.testrail.tests.HomePageTest.invalidTest Time elapsed: 0.024 s <<< FAILURE! 6 | java.lang.AssertionError: 7 | at org.testng.AssertJUnit.fail(AssertJUnit.java:65) 8 | at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:23) 9 | at org.testng.AssertJUnit.assertTrue(AssertJUnit.java:33) 10 | at com.idera.testrail.tests.HomePageTest.invalidTest(HomePageTest.java:54) 11 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 12 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 13 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 14 | at java.base/java.lang.reflect.Method.invoke(Method.java:566) 15 | at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:139) 16 | at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:677) 17 | at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:221) 18 | at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50) 19 | at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:969) 20 | at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:194) 21 | at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:148) 22 | at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128) 23 | at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) 24 | at org.testng.TestRunner.privateRun(TestRunner.java:829) 25 | at org.testng.TestRunner.run(TestRunner.java:602) 26 | at org.testng.SuiteRunner.runTest(SuiteRunner.java:437) 27 | at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:431) 28 | at org.testng.SuiteRunner.privateRun(SuiteRunner.java:391) 29 | at org.testng.SuiteRunner.run(SuiteRunner.java:330) 30 | at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) 31 | at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95) 32 | at org.testng.TestNG.runSuitesSequentially(TestNG.java:1256) 33 | at org.testng.TestNG.runSuitesLocally(TestNG.java:1176) 34 | at org.testng.TestNG.runSuites(TestNG.java:1099) 35 | at org.testng.TestNG.run(TestNG.java:1067) 36 | at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:308) 37 | at org.apache.maven.surefire.testng.TestNGXmlTestSuite.execute(TestNGXmlTestSuite.java:71) 38 | at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:113) 39 | at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385) 40 | at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162) 41 | at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507) 42 | at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495) 43 | 44 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/bullet_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/java/testng-selenium/sample_reports/bullet_point.png -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/collapseall.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/java/testng-selenium/sample_reports/collapseall.gif -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/emailable-report.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TestNG Report 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
Test# Passed# Skipped# Retried# FailedTime (ms)Included GroupsExcluded Groups
TestRail suite
TestRail Tests 200134.674
14 | 15 |
ClassMethodStartTime (ms)
TestRail suite
TestRail Tests — failed
com.idera.testrail.tests.HomePageTestinvalidTest168060516264417
TestRail Tests — passed
com.idera.testrail.tests.HomePageTestverifyPresenceOfDemoLinkOnHomePage1680605168971165
verifyTitleOfHomePage168060517480910
16 |

TestRail Tests

com.idera.testrail.tests.HomePageTest#invalidTest

Exception
java.lang.AssertionError: 17 | at com.idera.testrail.tests.HomePageTest.invalidTest(HomePageTest.java:54) 18 | at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) 19 | ... Removed 34 stack frames

back to summary

20 |

com.idera.testrail.tests.HomePageTest#verifyPresenceOfDemoLinkOnHomePage

back to summary

21 |

com.idera.testrail.tests.HomePageTest#verifyTitleOfHomePage

back to summary

22 | 23 | 24 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/java/testng-selenium/sample_reports/failed.png -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/junitreports/TEST-com.idera.testrail.tests.HomePageTest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/navigator-bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/java/testng-selenium/sample_reports/navigator-bullet.png -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/old/TestRail suite/TestRail Tests .properties: -------------------------------------------------------------------------------- 1 | [SuiteResult context=TestRail Tests ] -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/old/TestRail suite/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 |
Class nameMethod nameGroups
com.idera.testrail.tests.HomePageTest  
@Test
 invalidTest 
 verifyTitleOfHomePage 
 verifyPresenceOfDemoLinkOnHomePage 
@BeforeClass
@BeforeMethod
 setup 
@AfterMethod
 tearDown 
@AfterClass
45 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/old/TestRail suite/groups.html: -------------------------------------------------------------------------------- 1 |

Groups used for this test run

-------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/old/TestRail suite/index.html: -------------------------------------------------------------------------------- 1 | Results for TestRail suite 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/old/TestRail suite/main.html: -------------------------------------------------------------------------------- 1 | Results for TestRail suite 2 | Select a result on the left-hand pane. 3 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/old/TestRail suite/methods-alphabetical.html: -------------------------------------------------------------------------------- 1 |

Methods run, sorted chronologically

>> means before, << means after


TestRail suite

(Hover the method name to see the test class name)

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
TimeDelta (ms)Suite
configuration
Test
configuration
Class
configuration
Groups
configuration
Method
configuration
Test
method
ThreadInstances
23/04/04 12:46:02 0      invalidTestmain@2142565033
23/04/04 12:46:09 7082     >>setup  main@2142565033
23/04/04 12:46:09 7082     >>setup  main@2142565033
23/04/04 12:46:09 7082     >>setup  main@2142565033
23/04/04 12:46:14 12176     <<tearDown  main@2142565033
23/04/04 12:46:14 12176     <<tearDown  main@2142565033
23/04/04 12:46:14 12176     <<tearDown  main@2142565033
23/04/04 12:46:08 6327      verifyPresenceOfDemoLinkOnHomePagemain@2142565033
23/04/04 12:46:14 12165      verifyTitleOfHomePagemain@2142565033
23 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/old/TestRail suite/methods-not-run.html: -------------------------------------------------------------------------------- 1 |

Methods that were not run

2 |
-------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/old/TestRail suite/methods.html: -------------------------------------------------------------------------------- 1 |

Methods run, sorted chronologically

>> means before, << means after


TestRail suite

(Hover the method name to see the test class name)

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
TimeDelta (ms)Suite
configuration
Test
configuration
Class
configuration
Groups
configuration
Method
configuration
Test
method
ThreadInstances
23/04/04 12:46:14 0      verifyTitleOfHomePagemain@2142565033
23/04/04 12:46:09 -5083     >>setup  main@2142565033
23/04/04 12:46:14 11     <<tearDown  main@2142565033
23/04/04 12:46:02 -12165      invalidTestmain@2142565033
23/04/04 12:46:09 -5083     >>setup  main@2142565033
23/04/04 12:46:08 -5838      verifyPresenceOfDemoLinkOnHomePagemain@2142565033
23/04/04 12:46:09 -5083     >>setup  main@2142565033
23/04/04 12:46:14 11     <<tearDown  main@2142565033
23/04/04 12:46:14 11     <<tearDown  main@2142565033
23 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/old/TestRail suite/reporter-output.html: -------------------------------------------------------------------------------- 1 |

Reporter output

-------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/old/TestRail suite/testng.xml.html: -------------------------------------------------------------------------------- 1 | testng.xml for TestRail suite<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="TestRail suite" guice-stage="DEVELOPMENT" verbose="0">
  <test thread-count="5" name="TestRail Tests " verbose="0">
    <classes>
      <class name="com.idera.testrail.tests.HomePageTest"/>
    </classes>
  </test> <!-- TestRail Tests  -->
</suite> <!-- TestRail suite -->
-------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/old/TestRail suite/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Results for TestRail suite 4 | 5 | 6 | 7 | 8 |

Results for
TestRail suite

9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 |
1 test1 class3 methods:
14 |   chronological
15 |   alphabetical
16 |   not run (0)
0 groupreporter outputtestng.xml
23 | 24 |

29 |

25 |
TestRail Tests (2/1/0) 26 | Results 27 |
28 |
30 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/old/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Test results

6 | 7 | 8 | 9 |
SuitePassedFailedSkippedtestng.xml
Total210 
TestRail suite210Link
10 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/passed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/java/testng-selenium/sample_reports/passed.png -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/skipped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/java/testng-selenium/sample_reports/skipped.png -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/testng-failed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/testng-reports2.js: -------------------------------------------------------------------------------- 1 | window.onload = function () { 2 | let cookies = document.cookie; 3 | let cookieValue = cookies.split('='); 4 | if (cookieValue[1] === 'null' || localStorage.getItem('Theme') === 'null') { 5 | document.getElementById('retro').setAttribute('disabled', 'false'); 6 | } else if (cookieValue[1] === 'Switch Ultra Theme' || 7 | localStorage.getItem('Theme') === 'Switch Ultra Theme') { 8 | document.getElementById('button').innerText = "Switch Retro Theme"; 9 | document.getElementById('retro').setAttribute('disabled', 'false'); 10 | 11 | } else if (cookieValue[1] === 'Switch Retro Theme' || 12 | localStorage.getItem('Theme') === 'Switch Retro Theme') { 13 | if (cookieValue[1] === 'Switch Ultra Theme' || 14 | localStorage.getItem('Theme') === 'Switch Ultra Theme') { 15 | document.getElementById('button').innerText = "Switch Retro Theme"; 16 | document.getElementById('retro').setAttribute('disabled', 'false'); 17 | 18 | document.getElementById('button').innerText = "Switch Ultra Theme"; 19 | document.getElementById('retro').removeAttribute('disabled'); 20 | document.getElementById('ultra').setAttribute('disabled', 'false'); 21 | localStorage.setItem('Theme', select); 22 | 23 | } else if (select === 'Switch Ultra Theme') { 24 | document.getElementById('button').innerText = "Switch Retro Theme"; 25 | document.getElementById('ultra').removeAttribute('disabled'); 26 | document.getElementById('retro').setAttribute('disabled', 'false'); 27 | localStorage.setItem('Theme', select); 28 | } 29 | } else if (cookieValue[1] === 'Switch Retro Theme' || 30 | localStorage.getItem('Theme') === 'Switch Retro Theme') { 31 | document.getElementById('button').innerText = "Switch Ultra Theme"; 32 | document.getElementById('ultra').setAttribute('disabled', 'false'); 33 | } 34 | } 35 | document.getElementById('button').onclick = function () { 36 | let select = document.getElementById('button').innerText; 37 | if (select === 'Switch Retro Theme') { 38 | let d = new Date(); 39 | days = 365; 40 | d.setTime(+d + (days * 86400000)); //24 * 60 * 60 * 1000 41 | document.cookie = "Theme =" + select + "; expires=" + d.toGMTString() + ";"; 42 | document.getElementById('button').innerText = "Switch Ultra Theme"; 43 | document.getElementById('retro').removeAttribute('disabled'); 44 | document.getElementById('ultra').setAttribute('disabled', 'false'); 45 | localStorage.setItem('Theme', select); 46 | 47 | } else if (select === 'Switch Ultra Theme') { 48 | let d = new Date(); 49 | days = 365; 50 | d.setTime(+d + (days * 86400000)); //24 * 60 * 60 * 1000 51 | document.cookie = "Theme =" + select + "; expires=" + d.toGMTString() + ";"; 52 | document.getElementById('button').innerText = "Switch Retro Theme"; 53 | document.getElementById('ultra').removeAttribute('disabled'); 54 | document.getElementById('retro').setAttribute('disabled', 'false'); 55 | localStorage.setItem('Theme', select); 56 | } 57 | } 58 | //Function to mouse hovering affect. 59 | document.getElementById('button').onmouseover = function () { 60 | document.getElementById('button').style.borderRadius = "25px"; 61 | document.getElementById('button').style.width = "180px"; 62 | document.getElementById('button').style.height = "45px"; 63 | document.getElementById('button').style.marginTop = "1px"; 64 | 65 | } 66 | //Function to mouse out affect 67 | document.getElementById('button').onmouseout = function () { 68 | document.getElementById('button').style.borderRadius = "25px"; 69 | document.getElementById('button').style.width = "150px"; 70 | document.getElementById('button').style.height = "30px"; 71 | document.getElementById('button').style.marginTop = "8px"; 72 | 73 | } 74 | 75 | //This is the file where we handle the switching of the Themes. 76 | /*Author:- Akhil Gullapalli*/ 77 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/sample_reports/testng.css: -------------------------------------------------------------------------------- 1 | .invocation-failed, .test-failed { background-color: #DD0000; } 2 | .invocation-percent, .test-percent { background-color: #006600; } 3 | .invocation-passed, .test-passed { background-color: #00AA00; } 4 | .invocation-skipped, .test-skipped { background-color: #CCCC00; } 5 | 6 | .main-page { 7 | font-size: x-large; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/src/test/java/com/idera/testrail/tests/HomePageTest.java: -------------------------------------------------------------------------------- 1 | package com.idera.testrail.tests; 2 | 3 | import io.github.bonigarcia.wdm.WebDriverManager; 4 | import org.openqa.selenium.By; 5 | import org.openqa.selenium.WebDriver; 6 | import org.openqa.selenium.WebElement; 7 | import org.openqa.selenium.chrome.ChromeDriver; 8 | import org.openqa.selenium.chrome.ChromeOptions; 9 | import org.testng.annotations.AfterMethod; 10 | import org.testng.annotations.BeforeMethod; 11 | import org.testng.annotations.Test; 12 | 13 | import static org.testng.AssertJUnit.assertTrue; 14 | 15 | 16 | public class HomePageTest { 17 | 18 | public static WebDriver driver; 19 | 20 | @BeforeMethod 21 | void setup() { 22 | WebDriverManager.chromedriver().setup(); 23 | ChromeOptions options = new ChromeOptions(); 24 | options.addArguments("headless"); 25 | options.addArguments("--remote-allow-origins=*"); 26 | options.addArguments("--window-size=1920,1080"); 27 | options.addArguments("--start-maximized"); 28 | options.addArguments("--no-proxy-server"); 29 | options.addArguments("disable-infobars"); // Disabling infobars 30 | options.addArguments("--disable-web-security"); 31 | options.addArguments("--allow-running-insecure-content"); 32 | options.addArguments("--ignore-certificate-errors"); 33 | options.addArguments("--disable-extensions"); // Disabling extensions 34 | options.addArguments("--disable-dev-shm-usage"); // Overcome limited resource problems 35 | options.addArguments("--no-sandbox"); // Bypass OS security model 36 | driver = new ChromeDriver(options); 37 | // Navigation: Open a website 38 | driver.navigate().to("https://www.gurock.com/testrail"); 39 | } 40 | 41 | @Test 42 | public void verifyTitleOfHomePage() { 43 | assertTrue(driver.getTitle().contains("TestRail")); 44 | } 45 | 46 | @Test 47 | void verifyPresenceOfDemoLinkOnHomePage() { 48 | By demoButtonSelector = By.linkText("Get a Demo"); 49 | WebElement demoButton = driver.findElement(demoButtonSelector); 50 | assertTrue(demoButton.isDisplayed()); 51 | } 52 | 53 | @Test 54 | void invalidTest() { 55 | assertTrue(driver.getTitle().contains("WRONG TITLE")); 56 | } 57 | 58 | @AfterMethod 59 | void tearDown() { 60 | // Quit Driver after each test is completed 61 | driver.quit(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/testng.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/java/testng-selenium/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | project: PROJECT NAME 3 | username: USERNAME 4 | password: PASSWORD 5 | title: TestNG Selenium Automated Test Run 6 | -------------------------------------------------------------------------------- /samples/java/testng/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /report_sample 3 | /.idea -------------------------------------------------------------------------------- /samples/java/testng/README.md: -------------------------------------------------------------------------------- 1 | # TestNG sample project 2 | 3 | ## How to use the project 4 | 5 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 6 | - Execute the commands on the script below 7 | 8 | ```sh 9 | # Install TR CLI 10 | pip install trcli 11 | 12 | # Install test project 13 | mvn clean compile 14 | 15 | # Run tests 16 | mvn clean compile test 17 | 18 | # Upload test results 19 | trcli -y -c "trcli-config.yml" parse_junit -f "./reports/TEST-TestSuite.xml" 20 | 21 | ``` -------------------------------------------------------------------------------- /samples/java/testng/java-testng.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /samples/java/testng/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | com.idera.testrail.tests.testng 8 | java-testng 9 | 1.0-SNAPSHOT 10 | 11 | 12 | 11 13 | 11 14 | 15 | 16 | 17 | 18 | 19 | maven-compiler-plugin 20 | 21 | true 22 | 1.8 23 | 1.8 24 | 25 | 26 | 27 | org.apache.maven.plugins 28 | maven-surefire-plugin 29 | 2.22.2 30 | 31 | true 32 | false 33 | reports 34 | 35 | 36 | reporter 37 | org.testng.reporters.XMLReporter:generateTestResultAttributes=true,generateGroupsAttribute=true 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | org.testng 49 | testng 50 | 7.5 51 | test 52 | 53 | 54 | org.apache.maven.surefire 55 | surefire-testng 56 | 2.22.2 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | maven-surefire-report-plugin 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/Surefire suite/Surefire test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/Surefire suite/testng-failed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/TestSuite.txt: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------- 2 | Test set: TestSuite 3 | ------------------------------------------------------------------------------- 4 | Tests run: 4, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.419 s <<< FAILURE! - in TestSuite 5 | AddTwoNumbersWithDecimals(com.idera.testrail.tests.SumTests) Time elapsed: 0.004 s <<< FAILURE! 6 | java.lang.AssertionError: 1.5+1.4 should equal 3 expected [2.9] but found [3.0] 7 | at com.idera.testrail.tests.SumTests.AddTwoNumbersWithDecimals(SumTests.java:15) 8 | 9 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/bullet_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/java/testng/sample_reports/bullet_point.png -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/collapseall.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/java/testng/sample_reports/collapseall.gif -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/emailable-report.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | TestNG Report 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
Test# Passed# Skipped# Retried# FailedTime (ms)Included GroupsExcluded Groups
Surefire suite
Surefire test300134
14 | 15 |
ClassMethodStartTime (ms)
Surefire suite
Surefire test — failed
com.idera.testrail.tests.SumTestsAddTwoNumbersWithDecimals16558974286620
Surefire test — passed
com.idera.testrail.tests.MultiplicationTestMultiplyTwoNumbers16558974286544
com.idera.testrail.tests.SubtractionTestsSubtractTwoNumbers16558974286610
com.idera.testrail.tests.SumTestsAddTwoNumbers16558974286611
16 |

Surefire test

com.idera.testrail.tests.SumTests#AddTwoNumbersWithDecimals

Exception
java.lang.AssertionError: 1.5+1.4 should equal 3 expected [2.9] but found [3.0] 17 | at com.idera.testrail.tests.SumTests.AddTwoNumbersWithDecimals(SumTests.java:15) 18 | at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) 19 | ... Removed 35 stack frames

back to summary

20 |

com.idera.testrail.tests.MultiplicationTest#MultiplyTwoNumbers

back to summary

21 |

com.idera.testrail.tests.SubtractionTests#SubtractTwoNumbers

back to summary

22 |

com.idera.testrail.tests.SumTests#AddTwoNumbers

back to summary

23 | 24 | 25 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/failed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/java/testng/sample_reports/failed.png -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/junitreports/TEST-com.idera.testrail.tests.MultiplicationTest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/junitreports/TEST-com.idera.testrail.tests.SubtractionTests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/junitreports/TEST-com.idera.testrail.tests.SumTests.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/navigator-bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/java/testng/sample_reports/navigator-bullet.png -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/old/Surefire suite/Surefire test.properties: -------------------------------------------------------------------------------- 1 | [SuiteResult context=Surefire test] -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/old/Surefire suite/classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 |
Class nameMethod nameGroups
com.idera.testrail.tests.SubtractionTests  
@Test
 SubtractTwoNumbers 
@BeforeClass
@BeforeMethod
@AfterMethod
@AfterClass
com.idera.testrail.tests.MultiplicationTest  
@Test
 MultiplyTwoNumbers 
@BeforeClass
@BeforeMethod
@AfterMethod
@AfterClass
com.idera.testrail.tests.SumTests  
@Test
 AddTwoNumbers 
 AddTwoNumbersWithDecimals 
@BeforeClass
@BeforeMethod
@AfterMethod
@AfterClass
77 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/old/Surefire suite/groups.html: -------------------------------------------------------------------------------- 1 |

Groups used for this test run

-------------------------------------------------------------------------------- /samples/java/testng/sample_reports/old/Surefire suite/index.html: -------------------------------------------------------------------------------- 1 | Results for Surefire suite 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/old/Surefire suite/main.html: -------------------------------------------------------------------------------- 1 | Results for Surefire suite 2 | Select a result on the left-hand pane. 3 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/old/Surefire suite/methods-alphabetical.html: -------------------------------------------------------------------------------- 1 |

Methods run, sorted chronologically

>> means before, << means after


Surefire suite

(Hover the method name to see the test class name)

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
TimeDelta (ms)Suite
configuration
Test
configuration
Class
configuration
Groups
configuration
Method
configuration
Test
method
ThreadInstances
22/06/22 12:30:28 0      AddTwoNumbersmain@794075965
22/06/22 12:30:28 1      AddTwoNumbersWithDecimalsmain@794075965
22/06/22 12:30:28 -7      MultiplyTwoNumbersmain@794075965
22/06/22 12:30:28 0      SubtractTwoNumbersmain@794075965
13 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/old/Surefire suite/methods-not-run.html: -------------------------------------------------------------------------------- 1 |

Methods that were not run

2 |
-------------------------------------------------------------------------------- /samples/java/testng/sample_reports/old/Surefire suite/methods.html: -------------------------------------------------------------------------------- 1 |

Methods run, sorted chronologically

>> means before, << means after


Surefire suite

(Hover the method name to see the test class name)

2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
TimeDelta (ms)Suite
configuration
Test
configuration
Class
configuration
Groups
configuration
Method
configuration
Test
method
ThreadInstances
22/06/22 12:30:28 0      AddTwoNumbersmain@794075965
22/06/22 12:30:28 1      AddTwoNumbersWithDecimalsmain@794075965
22/06/22 12:30:28 -7      MultiplyTwoNumbersmain@794075965
22/06/22 12:30:28 0      SubtractTwoNumbersmain@794075965
13 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/old/Surefire suite/reporter-output.html: -------------------------------------------------------------------------------- 1 |

Reporter output

-------------------------------------------------------------------------------- /samples/java/testng/sample_reports/old/Surefire suite/testng.xml.html: -------------------------------------------------------------------------------- 1 | testng.xml for Surefire suite<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite thread-count="1" name="Surefire suite" verbose="0">
  <test thread-count="1" name="Surefire test" verbose="0">
    <classes>
      <class name="com.idera.testrail.tests.MultiplicationTest"/>
      <class name="com.idera.testrail.tests.SubtractionTests"/>
      <class name="com.idera.testrail.tests.SumTests"/>
    </classes>
  </test> <!-- Surefire test -->
</suite> <!-- Surefire suite -->
-------------------------------------------------------------------------------- /samples/java/testng/sample_reports/old/Surefire suite/toc.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Results for Surefire suite 4 | 5 | 6 | 7 | 8 |

Results for
Surefire suite

9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 |
1 test3 classes4 methods:
14 |   chronological
15 |   alphabetical
16 |   not run (0)
0 groupreporter outputtestng.xml
23 | 24 |

29 |

25 |
Surefire test (3/1/0) 26 | Results 27 |
28 |
30 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/old/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

Test results

6 | 7 | 8 | 9 |
SuitePassedFailedSkippedtestng.xml
Total310 
Surefire suite310Link
10 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/passed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/java/testng/sample_reports/passed.png -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/skipped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/java/testng/sample_reports/skipped.png -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/testng-failed.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/testng-reports2.js: -------------------------------------------------------------------------------- 1 | window.onload = function () { 2 | let cookies = document.cookie; 3 | let cookieValue = cookies.split('='); 4 | if (cookieValue[1] === 'null' || localStorage.getItem('Theme') === 'null') { 5 | document.getElementById('retro').setAttribute('disabled', 'false'); 6 | } else if (cookieValue[1] === 'Switch Ultra Theme' || 7 | localStorage.getItem('Theme') === 'Switch Ultra Theme') { 8 | document.getElementById('button').innerText = "Switch Retro Theme"; 9 | document.getElementById('retro').setAttribute('disabled', 'false'); 10 | 11 | } else if (cookieValue[1] === 'Switch Retro Theme' || 12 | localStorage.getItem('Theme') === 'Switch Retro Theme') { 13 | if (cookieValue[1] === 'Switch Ultra Theme' || 14 | localStorage.getItem('Theme') === 'Switch Ultra Theme') { 15 | document.getElementById('button').innerText = "Switch Retro Theme"; 16 | document.getElementById('retro').setAttribute('disabled', 'false'); 17 | 18 | document.getElementById('button').innerText = "Switch Ultra Theme"; 19 | document.getElementById('retro').removeAttribute('disabled'); 20 | document.getElementById('ultra').setAttribute('disabled', 'false'); 21 | localStorage.setItem('Theme', select); 22 | 23 | } else if (select === 'Switch Ultra Theme') { 24 | document.getElementById('button').innerText = "Switch Retro Theme"; 25 | document.getElementById('ultra').removeAttribute('disabled'); 26 | document.getElementById('retro').setAttribute('disabled', 'false'); 27 | localStorage.setItem('Theme', select); 28 | } 29 | } else if (cookieValue[1] === 'Switch Retro Theme' || 30 | localStorage.getItem('Theme') === 'Switch Retro Theme') { 31 | document.getElementById('button').innerText = "Switch Ultra Theme"; 32 | document.getElementById('ultra').setAttribute('disabled', 'false'); 33 | } 34 | } 35 | document.getElementById('button').onclick = function () { 36 | let select = document.getElementById('button').innerText; 37 | if (select === 'Switch Retro Theme') { 38 | let d = new Date(); 39 | days = 365; 40 | d.setTime(+d + (days * 86400000)); //24 * 60 * 60 * 1000 41 | document.cookie = "Theme =" + select + "; expires=" + d.toGMTString() + ";"; 42 | document.getElementById('button').innerText = "Switch Ultra Theme"; 43 | document.getElementById('retro').removeAttribute('disabled'); 44 | document.getElementById('ultra').setAttribute('disabled', 'false'); 45 | localStorage.setItem('Theme', select); 46 | 47 | } else if (select === 'Switch Ultra Theme') { 48 | let d = new Date(); 49 | days = 365; 50 | d.setTime(+d + (days * 86400000)); //24 * 60 * 60 * 1000 51 | document.cookie = "Theme =" + select + "; expires=" + d.toGMTString() + ";"; 52 | document.getElementById('button').innerText = "Switch Retro Theme"; 53 | document.getElementById('ultra').removeAttribute('disabled'); 54 | document.getElementById('retro').setAttribute('disabled', 'false'); 55 | localStorage.setItem('Theme', select); 56 | } 57 | } 58 | //Function to mouse hovering affect. 59 | document.getElementById('button').onmouseover = function () { 60 | document.getElementById('button').style.borderRadius = "25px"; 61 | document.getElementById('button').style.width = "180px"; 62 | document.getElementById('button').style.height = "45px"; 63 | document.getElementById('button').style.marginTop = "1px"; 64 | 65 | } 66 | //Function to mouse out affect 67 | document.getElementById('button').onmouseout = function () { 68 | document.getElementById('button').style.borderRadius = "25px"; 69 | document.getElementById('button').style.width = "150px"; 70 | document.getElementById('button').style.height = "30px"; 71 | document.getElementById('button').style.marginTop = "8px"; 72 | 73 | } 74 | 75 | //This is the file where we handle the switching of the Themes. 76 | /*Author:- Akhil Gullapalli*/ 77 | -------------------------------------------------------------------------------- /samples/java/testng/sample_reports/testng.css: -------------------------------------------------------------------------------- 1 | .invocation-failed, .test-failed { background-color: #DD0000; } 2 | .invocation-percent, .test-percent { background-color: #006600; } 3 | .invocation-passed, .test-passed { background-color: #00AA00; } 4 | .invocation-skipped, .test-skipped { background-color: #CCCC00; } 5 | 6 | .main-page { 7 | font-size: x-large; 8 | } 9 | 10 | -------------------------------------------------------------------------------- /samples/java/testng/src/test/java/com/idera/testrail/tests/MultiplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.idera.testrail.tests; 2 | 3 | import org.testng.Assert; 4 | import org.testng.annotations.Test; 5 | 6 | 7 | class MultiplicationTest { 8 | 9 | @Test 10 | void MultiplyTwoNumbers() { 11 | Assert.assertEquals(4, 2*2, "Should equal 4"); 12 | } 13 | } -------------------------------------------------------------------------------- /samples/java/testng/src/test/java/com/idera/testrail/tests/SubtractionTests.java: -------------------------------------------------------------------------------- 1 | package com.idera.testrail.tests; 2 | 3 | import org.testng.Assert; 4 | import org.testng.annotations.Test; 5 | 6 | 7 | class SubtractionTests { 8 | 9 | @Test 10 | void SubtractTwoNumbers() { 11 | Assert.assertEquals(1, 2 - 1, "Should equal 1"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /samples/java/testng/src/test/java/com/idera/testrail/tests/SumTests.java: -------------------------------------------------------------------------------- 1 | package com.idera.testrail.tests; 2 | 3 | import org.testng.Assert; 4 | import org.testng.annotations.Test; 5 | 6 | class SumTests { 7 | 8 | @Test 9 | void AddTwoNumbers() { 10 | Assert.assertEquals(3, 1 + 2, "1 + 2 should equal 3"); 11 | } 12 | 13 | @Test 14 | void AddTwoNumbersWithDecimals() { 15 | Assert.assertEquals(3, 1.5+1.4, "1.5+1.4 should equal 3"); 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /samples/java/testng/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | project: PROJECT NAME 3 | username: USERNAME 4 | password: PASSWORD 5 | title: TestNG Automated Test Run 6 | -------------------------------------------------------------------------------- /samples/javascript/cypress-saucectl/.sauce/config.yml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: cypress 3 | defaults: 4 | mode: sauce 5 | sauce: 6 | region: us-west-1 7 | concurrency: 10 # Controls how many suites are executed at the same time. 8 | metadata: 9 | tags: 10 | - e2e 11 | - release team 12 | - other tag 13 | build: Automated tests run 1 14 | docker: 15 | # Affects how test files are transferred to the docker container when using the docker mode. 16 | fileTransfer: copy # Choose between mount|copy. 17 | cypress: 18 | version: 10.7.0 # See https://docs.saucelabs.com/dev/cli/saucectl/#supported-frameworks-and-browsers for a list of supported versions. 19 | configFile: "cypress.config.js" 20 | 21 | reporters: 22 | junit: 23 | enabled: true 24 | filename: saucectl-report.xml 25 | 26 | # npm: 27 | # dependencies: 28 | # - "cypress-mochawesome-reporter" 29 | 30 | # Controls what files are available in the context of a test run (unless explicitly excluded by .sauceignore). 31 | rootDir: ./ 32 | suites: 33 | - name: "Chrome" # Since the suite doesn't specify the `mode`, it'll inherit the mode specified via `defaults.mode` (see line number 3 and 4 of this config file). 34 | browser: "chrome" 35 | platformName: "Windows 11" # Only relevant when running a test against the sauce cloud mode. 36 | screenResolution: "1920x1080" # (optional) Only relevant when running a test against the sauce cloud mode. 37 | shard: spec # (optional) Allocate one VM per spec for a high degree of parallelism. 38 | config: 39 | specPattern: [ "cypress/e2e/**/*.*" ] # Cypress native glob support. 40 | - name: "Firefox" # Since the suite doesn't specify the `mode`, it'll inherit the mode specified via `defaults.mode` (see line number 3 and 4 of this config file). 41 | browser: "firefox" 42 | platformName: "Windows 11" # Only relevant when running a test against the sauce cloud mode. 43 | screenResolution: "1920x1080" # (optional) Only relevant when running a test against the sauce cloud mode. 44 | shard: spec # (optional) Allocate one VM per spec for a high degree of parallelism. 45 | config: 46 | specPattern: [ "cypress/e2e/**/*.*" ] # Cypress native glob support. 47 | # Controls what artifacts to fetch when the suite on Sauce Cloud has finished. 48 | artifacts: 49 | download: 50 | when: always 51 | match: 52 | - console.log 53 | directory: ./artifacts/ 54 | -------------------------------------------------------------------------------- /samples/javascript/cypress-saucectl/.sauceignore: -------------------------------------------------------------------------------- 1 | # This file instructs saucectl to not package any files mentioned here. 2 | /examples/ 3 | /artifacts/ 4 | cypress/videos/ 5 | cypress/results/ 6 | cypress/screenshots/ 7 | # Remove this to have node_modules uploaded with code 8 | node_modules/ 9 | .git/ 10 | .github/ 11 | .DS_Store 12 | .hg/ 13 | .vscode/ 14 | .idea/ 15 | .gitignore 16 | .hgignore 17 | .gitlab-ci.yml 18 | .npmrc 19 | *.gif 20 | -------------------------------------------------------------------------------- /samples/javascript/cypress-saucectl/README.md: -------------------------------------------------------------------------------- 1 | # Cypress with saucectl sample project 2 | 3 | ## How to use the project 4 | 5 | ### 1. Set TestRail instance details 6 | Replace the placeholders in `trcli-config.yml` with your TestRail instance details. 7 | 8 | ### 2. Set SauceLabs credentials 9 | You also need to set your SauceLabs credentials by running the command `saucectl configure` 10 | or by setting the `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables. 11 | 12 | For more information on how to use the `saucectl` and how to run a cypress project using it, please see the links below: 13 | - [saucectl - Using saucectl](https://docs.saucelabs.com/dev/cli/saucectl/#installing-saucectl) 14 | - [saucectl - Cypress Quickstart](https://docs.saucelabs.com/web-apps/automated-testing/cypress/quickstart) 15 | 16 | ### 3. Run the execution script 17 | ```sh 18 | # Install CLIs 19 | npm install -g saucectl 20 | pip install trcli 21 | 22 | # Execute automated tests project through saucectl 23 | saucectl run 24 | 25 | # Send test results to TestRail 26 | trcli -y -c "trcli-config.yml" parse_junit --special-parser "saucectl" -f "junit-output-saucectl.xml" 27 | ``` 28 | -------------------------------------------------------------------------------- /samples/javascript/cypress-saucectl/cypress.config.js: -------------------------------------------------------------------------------- 1 | const { defineConfig } = require('cypress') 2 | 3 | module.exports = defineConfig({ 4 | e2e: { 5 | }, 6 | }) 7 | -------------------------------------------------------------------------------- /samples/javascript/cypress-saucectl/cypress/e2e/examples/actions.cy.js: -------------------------------------------------------------------------------- 1 | context('Actions', () => { 2 | beforeEach(() => { 3 | cy.visit('https://example.cypress.io/commands/actions') 4 | }) 5 | it('.type() - type into a DOM element', () => { 6 | // https://on.cypress.io/type 7 | cy.get('.action-email') 8 | .type('fake@email.com').should('have.value', 'fake@email.com') 9 | }) 10 | it('.type() - type into another DOM element', () => { 11 | // https://on.cypress.io/type 12 | cy.get('.action-email') 13 | .type('fake@email.com').should('have.value', 'fake@email.com') 14 | }) 15 | }) 16 | -------------------------------------------------------------------------------- /samples/javascript/cypress-saucectl/cypress/e2e/examples/assertions.cy.js: -------------------------------------------------------------------------------- 1 | context('Assertions', () => { 2 | beforeEach(() => { 3 | cy.visit('https://example.cypress.io/commands/assertions') 4 | }) 5 | it('.and() - chain multiple assertions together', () => { 6 | cy.get('.assertions-link') 7 | .should('have.class', 'active') 8 | .and('have.attr', 'href') 9 | .and('include', 'cypress.io') 10 | }) 11 | }) 12 | -------------------------------------------------------------------------------- /samples/javascript/cypress-saucectl/cypress/e2e/examples/traversal.cy.js: -------------------------------------------------------------------------------- 1 | context('Traversal', () => { 2 | beforeEach(() => { 3 | cy.visit('https://example.cypress.io/commands/traversal') 4 | }) 5 | it('.children() - get children of DOM elements', () => { 6 | cy.get('.traversal-breadcrumb') 7 | .children('.active') 8 | .should('contain', 'Data') 9 | }) 10 | }) 11 | -------------------------------------------------------------------------------- /samples/javascript/cypress-saucectl/cypress/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io", 4 | "body": "Fixtures are a great way to mock data for responses to routes" 5 | } -------------------------------------------------------------------------------- /samples/javascript/cypress-saucectl/cypress/support/commands.js: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // This example commands.js shows you how to 3 | // create various custom commands and overwrite 4 | // existing commands. 5 | // 6 | // For more comprehensive examples of custom 7 | // commands please read more here: 8 | // https://on.cypress.io/custom-commands 9 | // *********************************************** 10 | // 11 | // 12 | // -- This is a parent command -- 13 | // Cypress.Commands.add("login", (email, password) => { ... }) 14 | // 15 | // 16 | // -- This is a child command -- 17 | // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) 18 | // 19 | // 20 | // -- This is a dual command -- 21 | // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) 22 | // 23 | // 24 | // -- This will overwrite an existing command -- 25 | // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) 26 | -------------------------------------------------------------------------------- /samples/javascript/cypress-saucectl/cypress/support/e2e.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands' 18 | 19 | // Alternatively you can use CommonJS syntax: 20 | // require('./commands') 21 | -------------------------------------------------------------------------------- /samples/javascript/cypress-saucectl/report-samples/saucectl-report.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | stacktrace... 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /samples/javascript/cypress-saucectl/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | project: PROJECT NAME 3 | username: USERNAME 4 | password: PASSWORD 5 | title: Cypress-saucectl Automated Test Run -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/README.md: -------------------------------------------------------------------------------- 1 | # Cypress specificiation-first sample project 2 | 3 | This project is using a specification-first workflow. This is the approach you should use in case you want to first create your test cases in TestRail and then map them to your automated tests code. You can see sample tests in the `cypress/e2e/todo_app` folder. 4 | 5 | ## How to use the project 6 | 7 | Notice that the tests in this project have the test case ID (i.e.: `[C1]`) in the `it()` block, such as: 8 | ```javascript 9 | it('[C1] displays two todo items by default', () => { 10 | // (...) 11 | }) 12 | ``` 13 | Before executing the script below, you should first replace the test case IDs with valid IDs from your TestRail project and replace the placeholders in `trcli-config.yml` with your TestRail instance details. 14 | 15 | From a TestRail CLI perspective, in order to use this approach, we are using the `--case-matcher "name"` option. We also recommend using the `-n` option, so that cases that do not have a match in TestRail are not automaticaclly created, potentially creating duplication. 16 | 17 | ```sh 18 | # Install TR CLI 19 | pip install trcli 20 | 21 | # Install test project 22 | npm install 23 | 24 | # Run tests 25 | npx cypress run --reporter junit --reporter-options "mochaFile=reports/junit-[hash].xml" 26 | 27 | 28 | # Upload test results 29 | # With TestRail CLI version 1.6.0, the report path now supports wildcards, allowing you to merge multiple reports seamlessly. 30 | 31 | trcli -n -c "trcli-config.yml" parse_junit -f "reports/junit*.xml" --case-matcher "name" 32 | ``` 33 | -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/cypress.config.js: -------------------------------------------------------------------------------- 1 | const { defineConfig } = require("cypress"); 2 | 3 | module.exports = defineConfig({ 4 | e2e: { 5 | setupNodeEvents(on, config) { 6 | // implement node event listeners here 7 | }, 8 | }, 9 | }); 10 | -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/cypress/e2e/todo_app/todo_interactions.cy.js: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | describe('[interactions] example to-do app', () => { 4 | beforeEach(() => { 5 | cy.visit('https://example.cypress.io/todo') 6 | }) 7 | 8 | it('[C2] can add new todo items', () => { 9 | const newItem = 'Feed the cat' 10 | cy.get('[data-test=new-todo]').type(`${newItem}{enter}`) 11 | cy.get('.todo-list li') 12 | .should('have.length', 3) 13 | .last() 14 | .should('have.text', newItem) 15 | }) 16 | 17 | it('[C3] can check off an item as completed', () => { 18 | cy.contains('Pay electric bill') 19 | .parent() 20 | .find('input[type=checkbox]') 21 | .check() 22 | cy.contains('Pay electric bill') 23 | .parents('li') 24 | .should('have.class', 'completed') 25 | }) 26 | 27 | context('with a checked task', () => { 28 | beforeEach(() => { 29 | cy.contains('Pay electric bill') 30 | .parent() 31 | .find('input[type=checkbox]') 32 | .check() 33 | }) 34 | 35 | it('[C4] can filter for uncompleted tasks', () => { 36 | cy.contains('Active').click() 37 | cy.get('.todo-list li') 38 | .should('have.length', 1) 39 | .first() 40 | .should('have.text', 'Walk the dog') 41 | cy.contains('Pay electric bill').should('not.exist') 42 | }) 43 | 44 | it('[C5] can filter for completed tasks', () => { 45 | cy.contains('Completed').click() 46 | cy.get('.todo-list li') 47 | .should('have.length', 1) 48 | .first() 49 | .should('have.text', 'Pay electric bill') 50 | 51 | cy.contains('Walk the dog').should('not.exist') 52 | }) 53 | 54 | it('[C6] can delete all completed tasks', () => { 55 | cy.contains('Clear completed').click() 56 | cy.get('.todo-list li') 57 | .should('have.length', 2) 58 | .should('not.have.text', 'Pay electric bill') 59 | cy.contains('Clear completed').should('not.exist') 60 | }) 61 | }) 62 | }) 63 | -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/cypress/e2e/todo_app/todo_smoke.cy.js: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | describe('[smoke] example to-do app', () => { 4 | beforeEach(() => { 5 | cy.visit('https://example.cypress.io/todo') 6 | }) 7 | 8 | it('[C1] displays two todo items by default', () => { 9 | cy.get('.todo-list li').should('have.length', 2) 10 | cy.get('.todo-list li').first().should('have.text', 'Pay electric bill') 11 | cy.get('.todo-list li').last().should('have.text', 'Walk the dog') 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/cypress/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io", 4 | "body": "Fixtures are a great way to mock data for responses to routes" 5 | } 6 | -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/cypress/fixtures/profile.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 8739, 3 | "name": "Jane", 4 | "email": "jane@example.com" 5 | } -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/cypress/plugins/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | // *********************************************************** 3 | // This example plugins/index.js can be used to load plugins 4 | // 5 | // You can change the location of this file or turn off loading 6 | // the plugins file with the 'pluginsFile' configuration option. 7 | // 8 | // You can read more here: 9 | // https://on.cypress.io/plugins-guide 10 | // *********************************************************** 11 | 12 | // This function is called when a project is opened or re-opened (e.g. due to 13 | // the project's config changing) 14 | 15 | /** 16 | * @type {Cypress.PluginConfig} 17 | */ 18 | // eslint-disable-next-line no-unused-vars 19 | module.exports = (on, config) => { 20 | // `on` is used to hook into various events Cypress emits 21 | // `config` is the resolved Cypress config 22 | } 23 | -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/cypress/support/commands.js: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // This example commands.js shows you how to 3 | // create various custom commands and overwrite 4 | // existing commands. 5 | // 6 | // For more comprehensive examples of custom 7 | // commands please read more here: 8 | // https://on.cypress.io/custom-commands 9 | // *********************************************** 10 | // 11 | // 12 | // -- This is a parent command -- 13 | // Cypress.Commands.add('login', (email, password) => { ... }) 14 | // 15 | // 16 | // -- This is a child command -- 17 | // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) 18 | // 19 | // 20 | // -- This is a dual command -- 21 | // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) 22 | // 23 | // 24 | // -- This will overwrite an existing command -- 25 | // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) 26 | -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/cypress/support/e2e.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/e2e.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands' 18 | 19 | // Alternatively you can use CommonJS syntax: 20 | // require('./commands') -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/cypress/support/index.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands' 18 | 19 | // Alternatively you can use CommonJS syntax: 20 | // require('./commands') 21 | -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "cypress": "^12.5.1" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/sample_reports/junit-7c43e91b9f0e5cb6d8f8fd0659575f08.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/sample_reports/junit-e5562d1b42dfb626769f480e17833736.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/sample_reports/junit-report.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | AssertionError: Timed out retrying after 4000ms: Not enough elements found. Found '1', expected '2'. 17 | at Context.eval (webpack:///./cypress/e2e/todo_app/todo_interactions.cy.js:57:9) 18 | 19 | + expected - actual 20 | 21 | -1 22 | +2 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /samples/javascript/cypress-specfirst/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | username: USERNAME 3 | password: PASSWORD 4 | project: PROJECT NAME 5 | title: Cypress Automated Test Run (Specification-first) 6 | -------------------------------------------------------------------------------- /samples/javascript/cypress/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules -------------------------------------------------------------------------------- /samples/javascript/cypress/README.md: -------------------------------------------------------------------------------- 1 | # Cypress code-first sample project 2 | 3 | This project is using a code-first workflow. This is the approach you should use if you want your test cases to be automatically created in TestRail and not worry about mapping them manually. Using this approach, you don't need to do any modifications to the way you usually write your automated test cases. You can see sample tests in the `cypress/e2e/todo_app` folder. 4 | 5 | ## How to use the project 6 | 7 | Before executing the script, replace the placeholders in `trcli-config.yml` with your TestRail instance details. 8 | 9 | Notice the `-y` option on the script below. This will allow all test entities to be automatically created. 10 | 11 | ```sh 12 | # Install TR CLI 13 | pip install trcli 14 | 15 | # Install test project 16 | npm install 17 | 18 | # Run tests 19 | npx cypress run --reporter junit --reporter-options "mochaFile=reports/junit-[hash].xml" 20 | 21 | 22 | # Upload test results 23 | # With TestRail CLI version 1.6.0, the report path now supports wildcards, allowing you to merge multiple reports seamlessly. 24 | 25 | trcli -y -c "trcli-config.yml" parse_junit -f "reports/junit*.xml" 26 | ``` 27 | -------------------------------------------------------------------------------- /samples/javascript/cypress/cypress.config.js: -------------------------------------------------------------------------------- 1 | const { defineConfig } = require("cypress"); 2 | 3 | module.exports = defineConfig({ 4 | e2e: { 5 | setupNodeEvents(on, config) { 6 | // implement node event listeners here 7 | }, 8 | }, 9 | }); 10 | -------------------------------------------------------------------------------- /samples/javascript/cypress/cypress/e2e/todo_app/todo_interactions.cy.js: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | describe('[interactions] Todo app list with a checked task', () => { 4 | beforeEach(() => { 5 | cy.visit('https://example.cypress.io/todo') 6 | cy.contains('Pay electric bill') 7 | .parent() 8 | .find('input[type=checkbox]') 9 | .check() 10 | }) 11 | 12 | it('can filter for uncompleted tasks', () => { 13 | cy.contains('Active').click() 14 | cy.get('.todo-list li') 15 | .should('have.length', 1) 16 | .first() 17 | .should('have.text', 'Walk the dog') 18 | cy.contains('Pay electric bill').should('not.exist') 19 | }) 20 | 21 | it('can filter for completed tasks', () => { 22 | cy.contains('Completed').click() 23 | cy.get('.todo-list li') 24 | .should('have.length', 1) 25 | .first() 26 | .should('have.text', 'Pay electric bill') 27 | 28 | cy.contains('Walk the dog').should('not.exist') 29 | }) 30 | 31 | it('can delete all completed tasks', () => { 32 | cy.contains('Clear completed').click() 33 | cy.get('.todo-list li') 34 | .should('have.length', 2) 35 | .should('not.have.text', 'Pay electric bill') 36 | cy.contains('Clear completed').should('not.exist') 37 | }) 38 | }) 39 | -------------------------------------------------------------------------------- /samples/javascript/cypress/cypress/e2e/todo_app/todo_smoke.cy.js: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | describe('[smoke] Todo app list', () => { 4 | beforeEach(() => { 5 | cy.visit('https://example.cypress.io/todo') 6 | }) 7 | 8 | it('displays two todo items by default', () => { 9 | cy.get('.todo-list li').should('have.length', 2) 10 | cy.get('.todo-list li').first().should('have.text', 'Pay electric bill') 11 | cy.get('.todo-list li').last().should('have.text', 'Walk the dog') 12 | }) 13 | }) 14 | -------------------------------------------------------------------------------- /samples/javascript/cypress/cypress/fixtures/example.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Using fixtures to represent data", 3 | "email": "hello@cypress.io", 4 | "body": "Fixtures are a great way to mock data for responses to routes" 5 | } 6 | -------------------------------------------------------------------------------- /samples/javascript/cypress/cypress/fixtures/profile.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": 8739, 3 | "name": "Jane", 4 | "email": "jane@example.com" 5 | } -------------------------------------------------------------------------------- /samples/javascript/cypress/cypress/plugins/index.js: -------------------------------------------------------------------------------- 1 | /// 2 | // *********************************************************** 3 | // This example plugins/index.js can be used to load plugins 4 | // 5 | // You can change the location of this file or turn off loading 6 | // the plugins file with the 'pluginsFile' configuration option. 7 | // 8 | // You can read more here: 9 | // https://on.cypress.io/plugins-guide 10 | // *********************************************************** 11 | 12 | // This function is called when a project is opened or re-opened (e.g. due to 13 | // the project's config changing) 14 | 15 | /** 16 | * @type {Cypress.PluginConfig} 17 | */ 18 | // eslint-disable-next-line no-unused-vars 19 | module.exports = (on, config) => { 20 | // `on` is used to hook into various events Cypress emits 21 | // `config` is the resolved Cypress config 22 | } 23 | -------------------------------------------------------------------------------- /samples/javascript/cypress/cypress/support/commands.js: -------------------------------------------------------------------------------- 1 | // *********************************************** 2 | // This example commands.js shows you how to 3 | // create various custom commands and overwrite 4 | // existing commands. 5 | // 6 | // For more comprehensive examples of custom 7 | // commands please read more here: 8 | // https://on.cypress.io/custom-commands 9 | // *********************************************** 10 | // 11 | // 12 | // -- This is a parent command -- 13 | // Cypress.Commands.add('login', (email, password) => { ... }) 14 | // 15 | // 16 | // -- This is a child command -- 17 | // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) 18 | // 19 | // 20 | // -- This is a dual command -- 21 | // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) 22 | // 23 | // 24 | // -- This will overwrite an existing command -- 25 | // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) 26 | -------------------------------------------------------------------------------- /samples/javascript/cypress/cypress/support/e2e.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/e2e.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands' 18 | 19 | // Alternatively you can use CommonJS syntax: 20 | // require('./commands') -------------------------------------------------------------------------------- /samples/javascript/cypress/cypress/support/index.js: -------------------------------------------------------------------------------- 1 | // *********************************************************** 2 | // This example support/index.js is processed and 3 | // loaded automatically before your test files. 4 | // 5 | // This is a great place to put global configuration and 6 | // behavior that modifies Cypress. 7 | // 8 | // You can change the location of this file or turn off 9 | // automatically serving support files with the 10 | // 'supportFile' configuration option. 11 | // 12 | // You can read more here: 13 | // https://on.cypress.io/configuration 14 | // *********************************************************** 15 | 16 | // Import commands.js using ES2015 syntax: 17 | import './commands' 18 | 19 | // Alternatively you can use CommonJS syntax: 20 | // require('./commands') 21 | -------------------------------------------------------------------------------- /samples/javascript/cypress/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "cypress": "^12.5.1" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /samples/javascript/cypress/sample_reports/junit-aa137e1fa1986273534459f6edd78e16.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/javascript/cypress/sample_reports/junit-bf08629137ecb6cdf75c19ac700c98cd.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /samples/javascript/cypress/sample_reports/junit-report.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | AssertionError: Timed out retrying after 4000ms: Not enough elements found. Found '1', expected '2'. 17 | at Context.eval (webpack:///./cypress/e2e/todo_app/todo_interactions.cy.js:34:7) 18 | 19 | + expected - actual 20 | 21 | -1 22 | +2 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /samples/javascript/cypress/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | username: USERNAME 3 | password: PASSWORD 4 | project: PROJECT NAME 5 | title: Cypress Automated Test Run (Code-first) 6 | -------------------------------------------------------------------------------- /samples/javascript/playwright/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | /test-results/ 3 | /playwright-report/ 4 | /playwright/.cache/ 5 | -------------------------------------------------------------------------------- /samples/javascript/playwright/README.md: -------------------------------------------------------------------------------- 1 | # Playwright sample project 2 | 3 | ## How to use the project 4 | 5 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 6 | - Execute the commands on the script below 7 | 8 | ```sh 9 | # Install TR CLI 10 | pip install trcli 11 | 12 | # Install test project 13 | npm install 14 | 15 | # Run tests 16 | npx playwright test 17 | 18 | # Upload test results 19 | trcli -y -c "trcli-config.yml" parse_junit -f "test-results/junit-report.xml" 20 | ``` 21 | 22 | ## How to use the project with Azure Pipelines 23 | 24 | - Substitute the placeholders within the `azure-pipelines.yml` file with the specific information related to your TestRail instance and credentials. 25 | - Establish a connection between the project and Azure DevOps, and initiate the pipeline. 26 | - Azure DevOps will automatically detect the `azure-pipelines.yml` 27 | - During the pipeline execution, Playwright tests will be conducted, and the results will be uploaded to TestRail. -------------------------------------------------------------------------------- /samples/javascript/playwright/azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | - sampleCode 3 | pool: 4 | vmImage: ubuntu-latest 5 | steps: 6 | - task: NodeTool@0 7 | inputs: 8 | versionSpec: '16.x' 9 | displayName: 'Install Node.js' 10 | - task: UsePythonVersion@0 11 | inputs: 12 | versionSpec: '3.10.13' 13 | displayName: 'Setup Python' 14 | 15 | - script: | 16 | cd samples/javascript/playwright 17 | npm install 18 | npx playwright install-deps 19 | npx playwright install 20 | npx playwright test 21 | displayName: 'Run Playwright tests' 22 | continueOnError: true 23 | 24 | - script: | 25 | cd samples/javascript/playwright 26 | pip install trcli 27 | trcli -y \ 28 | -h "https://INSTANCE-NAME.testrail.io" \ 29 | --project "AzurePipelinesExamples" \ 30 | -u "USERNAME" \ 31 | -p "PASSWORD" \ 32 | parse_junit \ 33 | -f "test-results/junit-report.xml" \ 34 | --title "Playwright automated tests" \ 35 | --run-description "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_build/results?buildId=$(Build.BuildId)" 36 | displayName: 'Upload Playwright Test Results in TestRail with TestRail CLI' -------------------------------------------------------------------------------- /samples/javascript/playwright/playwright.config.js: -------------------------------------------------------------------------------- 1 | // @ts-check 2 | const { devices } = require('@playwright/test'); 3 | 4 | /** 5 | * Read environment variables from file. 6 | * https://github.com/motdotla/dotenv 7 | */ 8 | // require('dotenv').config(); 9 | 10 | const testRailOptions = { 11 | // Whether to add with all annotations; default is false 12 | embedAnnotationsAsProperties: true, 13 | // Where to put the report. 14 | outputFile: './test-results/junit-report.xml' 15 | }; 16 | 17 | /** 18 | * @see https://playwright.dev/docs/test-configuration 19 | * @type {import('@playwright/test').PlaywrightTestConfig} 20 | */ 21 | const config = { 22 | testDir: './tests', 23 | /* Maximum time one test can run for. */ 24 | timeout: 15 * 1000, 25 | expect: { 26 | /** 27 | * Maximum time expect() should wait for the condition to be met. 28 | * For example in `await expect(locator).toHaveText();` 29 | */ 30 | timeout: 5000 31 | }, 32 | /* Run tests in files in parallel */ 33 | fullyParallel: true, 34 | /* Fail the build on CI if you accidentally left test.only in the source code. */ 35 | forbidOnly: !!process.env.CI, 36 | /* Retry on CI only */ 37 | retries: process.env.CI ? 2 : 0, 38 | /* Opt out of parallel tests on CI. */ 39 | workers: process.env.CI ? 1 : undefined, 40 | /* Reporter to use. See https://playwright.dev/docs/test-reporters */ 41 | reporter: [ 42 | ['list'], 43 | ['html', { outputFolder: 'reports', open: 'never' }], 44 | ['junit', testRailOptions] 45 | ], 46 | /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ 47 | use: { 48 | /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */ 49 | actionTimeout: 0, 50 | /* Base URL to use in actions like `await page.goto('/')`. */ 51 | // baseURL: 'http://localhost:3000', 52 | 53 | /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ 54 | trace: 'on-first-retry', 55 | }, 56 | 57 | /* Folder for test artifacts such as screenshots, videos, traces, etc. */ 58 | outputDir: 'test-results/', 59 | 60 | /* Run your local dev server before starting the tests */ 61 | // webServer: { 62 | // command: 'npm run start', 63 | // port: 3000, 64 | // }, 65 | }; 66 | 67 | module.exports = config; 68 | -------------------------------------------------------------------------------- /samples/javascript/playwright/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | project: PROJECT NAME 3 | username: USERNAME 4 | password: PASSWORD 5 | title: Playwright Automated Test Run -------------------------------------------------------------------------------- /samples/javascript/postman_newmanCLI/README.md: -------------------------------------------------------------------------------- 1 | # Postman TestRail integration sample project 2 | 3 | ## Pre-requisites for running the tests in the project 4 | 5 | You need to install the following on your local machine: 6 | - Postman 7 | - Python3 8 | 9 | ## How to upload the test results to TestRail from your local machine 10 | 11 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 12 | - Execute the commands on the script below 13 | 14 | ```sh 15 | 16 | # Install the Newman CLI 17 | npm install -g newman 18 | 19 | # Install the TestRail CLI 20 | pip install trcli 21 | 22 | # Run Tests 23 | newman run API_Test_Demo.postman_collection.json -r cli,junit --reporter-junit-export ./reports/newman_junit.xml 24 | 25 | # Upload Postman Test Results to TestRail 26 | trcli -y -c "trcli-config.yml" parse_junit -f "./reports/newman_junit.xml" --title "Automation Demo - Postman API Tests" 27 | 28 | ``` 29 | -------------------------------------------------------------------------------- /samples/javascript/postman_newmanCLI/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "postman_testrail_integration_temo", 3 | "lockfileVersion": 3, 4 | "requires": true, 5 | "packages": {} 6 | } 7 | -------------------------------------------------------------------------------- /samples/javascript/postman_newmanCLI/reports/newman_junit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /samples/javascript/postman_newmanCLI/run_newman.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clear 3 | bold=$(tput bold) 4 | echo "${bold}-------------------------------------------" 5 | echo "${bold}-- Postman TestRail Sample Run Script --" 6 | echo "${bold}-------------------------------------------" 7 | echo 8 | 9 | echo "${bold}...verify TRCLI is installed" 10 | echo 11 | 12 | trcli 13 | echo 14 | 15 | echo "${bold}...install the Newman Postman project, resolve dependencies" 16 | echo 17 | 18 | npm install -g newman 19 | echo 20 | 21 | echo "${bold}...executing Newman API Postman tests" 22 | echo 23 | newman run API_Test_Demo.postman_collection.json -r cli,junit --reporter-junit-export ./reports/newman_junit.xml 24 | 25 | echo 26 | 27 | echo "${bold}...executing TestRail CLI, uploading results in new test run" 28 | echo 29 | 30 | trcli -y -c "trcli-config.yml" parse_junit -f "./reports/newman_junit.xml" --title "Automation Demo - Postman API Tests" 31 | echo 32 | 33 | echo "${bold}...execution complete" 34 | echo 35 | 36 | -------------------------------------------------------------------------------- /samples/javascript/postman_newmanCLI/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: 2 | project: 3 | username: 4 | password: 5 | run-description: 6 | -------------------------------------------------------------------------------- /samples/javascript/webdriverIO/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | /results -------------------------------------------------------------------------------- /samples/javascript/webdriverIO/README.md: -------------------------------------------------------------------------------- 1 | # Webdriver IO code-first sample project 2 | 3 | This project is using a [code-first workflow](https://support.testrail.com/hc/en-us/articles/12609674354068-Code-first-workflow). This is the approach you should use if you want your test cases to be automatically created in TestRail and not worry about mapping them manually. 4 | Using this approach, you don't need to do any modifications to the way you usually write your automated test cases. 5 | 6 | ## How to use the project 7 | 8 | Before executing the script, replace the placeholders in `trcli-config.yml` with your TestRail instance details. 9 | 10 | Notice the `-y` option on the script below. This will allow all test entities to be automatically created. 11 | 12 | ```sh 13 | # Install TR CLI 14 | pip install trcli 15 | 16 | # Install the project dependencies 17 | npm install 18 | 19 | # Run the tests 20 | npx wdio run wdio.conf.js 21 | 22 | # Upload test results 23 | trcli -y -c "trcli-config.yml" parse_junit -f "results/test-results.xml" --title "Automation Example - WebdriverIO" 24 | ``` 25 | -------------------------------------------------------------------------------- /samples/javascript/webdriverIO/features/login.feature: -------------------------------------------------------------------------------- 1 | Feature: Website Access Sample Tests 2 | 3 | Scenario: As a user, I can log into the secure area 4 | 5 | Given I am on the login page 6 | When I login with and 7 | Then I should see a flash message saying 8 | 9 | Examples: 10 | | username | password | message | 11 | | tomsmith | SuperSecretPassword! | You logged into a secure area! | 12 | 13 | Scenario: As a user, I can't log into the secure area 14 | 15 | Given I am on the login page 16 | When I login with and 17 | Then I should see a flash message saying 18 | 19 | Examples: 20 | | username | password | message | 21 | | tomsmith | barfoo | Your password invalid! | 22 | -------------------------------------------------------------------------------- /samples/javascript/webdriverIO/features/pageobjects/login.page.js: -------------------------------------------------------------------------------- 1 | import { $ } from '@wdio/globals' 2 | import Page from './page.js'; 3 | 4 | class LoginPage extends Page { 5 | 6 | get inputUsername () { 7 | return $('#username'); 8 | } 9 | 10 | get inputPassword () { 11 | return $('#password'); 12 | } 13 | 14 | get btnSubmit () { 15 | return $('button[type="submit"]'); 16 | } 17 | 18 | async login (username, password) { 19 | await this.inputUsername.setValue(username); 20 | await this.inputPassword.setValue(password); 21 | await this.btnSubmit.click(); 22 | } 23 | 24 | open () { 25 | return super.open('login'); 26 | } 27 | } 28 | 29 | export default new LoginPage(); 30 | -------------------------------------------------------------------------------- /samples/javascript/webdriverIO/features/pageobjects/page.js: -------------------------------------------------------------------------------- 1 | import { browser } from '@wdio/globals' 2 | 3 | /** 4 | * main page object containing all methods, selectors and functionality 5 | * that is shared across all page objects 6 | */ 7 | export default class Page { 8 | /** 9 | * Opens a sub page of the page 10 | * @param path path of the sub page (e.g. /path/to/page.html) 11 | */ 12 | open (path) { 13 | return browser.url(`https://the-internet.herokuapp.com/${path}`) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /samples/javascript/webdriverIO/features/pageobjects/secure.page.js: -------------------------------------------------------------------------------- 1 | import { $ } from '@wdio/globals' 2 | import Page from './page.js'; 3 | 4 | /** 5 | * sub page containing specific selectors and methods for a specific page 6 | */ 7 | class SecurePage extends Page { 8 | /** 9 | * define selectors using getter methods 10 | */ 11 | get flashAlert () { 12 | return $('#flash'); 13 | } 14 | } 15 | 16 | export default new SecurePage(); 17 | -------------------------------------------------------------------------------- /samples/javascript/webdriverIO/features/step-definitions/steps.js: -------------------------------------------------------------------------------- 1 | import { Given, When, Then } from '@wdio/cucumber-framework'; 2 | import { expect, $ } from '@wdio/globals' 3 | 4 | import LoginPage from '../pageobjects/login.page.js'; 5 | import SecurePage from '../pageobjects/secure.page.js'; 6 | 7 | const pages = { 8 | login: LoginPage 9 | } 10 | 11 | Given(/^I am on the (\w+) page$/, async (page) => { 12 | await pages[page].open() 13 | }); 14 | 15 | When(/^I login with (\w+) and (.+)$/, async (username, password) => { 16 | await LoginPage.login(username, password) 17 | }); 18 | 19 | Then(/^I should see a flash message saying (.*)$/, async (message) => { 20 | await expect(SecurePage.flashAlert).toBeExisting(); 21 | await expect(SecurePage.flashAlert).toHaveText(expect.stringContaining(message)); 22 | }); 23 | 24 | -------------------------------------------------------------------------------- /samples/javascript/webdriverIO/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "devDependencies": { 4 | "@wdio/cli": "^9.4.5", 5 | "@wdio/cucumber-framework": "^9.4.4", 6 | "@wdio/junit-reporter": "^9.5.0", 7 | "@wdio/local-runner": "^9.4.5", 8 | "@wdio/testrail-reporter": "^0.3.0" 9 | }, 10 | "scripts": { 11 | "wdio": "wdio run ./wdio.conf.js" 12 | }, 13 | "dependencies": { 14 | "webdriverIO": "file:" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /samples/javascript/webdriverIO/run_webdriverio_tests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clear 3 | bold=$(tput bold) 4 | echo "${bold}-----------------------------------------" 5 | echo "${bold}- WebdriverIO TestRail Sample Run Scrip -" 6 | echo "${bold}-----------------------------------------" 7 | echo 8 | 9 | echo "${bold}...verify TRCLI is installed" 10 | echo 11 | trcli 12 | echo 13 | 14 | echo "${bold}...install dependencies" 15 | echo 16 | npm install 17 | echo 18 | 19 | echo "${bold}...Execute webdriverIO test" 20 | echo 21 | npx wdio run wdio.conf.js 22 | echo 23 | 24 | echo "${bold}...executing TestRail CLI, uploading results in new test run" 25 | echo 26 | trcli -y -c "trcli-config.yml" parse_junit -f "results/test-results.xml" --title "Automation Demo - WebdriverIO" 27 | echo 28 | 29 | echo "${bold}...execution complete" 30 | -------------------------------------------------------------------------------- /samples/javascript/webdriverIO/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: 2 | project: 3 | username: 4 | password: 5 | run-description: -------------------------------------------------------------------------------- /samples/javascript/webdriverIO/wdio.conf.js: -------------------------------------------------------------------------------- 1 | export const config = { 2 | 3 | runner: 'local', 4 | 5 | specs: [ 6 | './features/**/*.feature' 7 | ], 8 | 9 | maxInstances: 1, 10 | 11 | capabilities: [{ 12 | browserName: 'chrome', 13 | 'goog:chromeOptions': { 14 | args: ["--headless", "user-agent=...", "--disable-gpu", "--window-size=1440,735"] 15 | } 16 | }], 17 | 18 | logLevel: 'info', 19 | 20 | bail: 0, 21 | 22 | waitforTimeout: 1000, 23 | 24 | connectionRetryTimeout: 120000, 25 | 26 | connectionRetryCount: 2, 27 | 28 | framework: 'cucumber', 29 | 30 | reporters: [ 31 | ['junit', { 32 | outputDir: './results', 33 | outputFileFormat: function () { 34 | return `webdriverIO-test-results.xml` 35 | } 36 | }] 37 | ], 38 | 39 | cucumberOpts: { 40 | require: ['./features/step-definitions/steps.js'], 41 | backtrace: false, 42 | requireModule: [], 43 | dryRun: false, 44 | failFast: false, 45 | name: [], 46 | snippets: true, 47 | source: true, 48 | strict: false, 49 | tagExpression: '', 50 | timeout: 6000, 51 | ignoreUndefinedDefinitions: false 52 | }, 53 | 54 | } 55 | -------------------------------------------------------------------------------- /samples/jmeter/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /samples/jmeter/README.md: -------------------------------------------------------------------------------- 1 | # JMeter TestRail integration sample project 2 | 3 | ## Pre-requisites for running the tests in the project 4 | 5 | You need to install the following on your local machine: 6 | - JMeter 7 | - JUnit Pluggin 8 | - Python3 9 | 10 | ## How to upload the test results to TestRail from your local machine 11 | 12 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 13 | - Execute the commands on the script below 14 | 15 | ```sh 16 | 17 | # Install the TestRail CLI 18 | pip install trcli 19 | 20 | # Run Tests 21 | jmeter -n -t ././././jmeter_performance_test.jmx 22 | 23 | # Upload JMeter Test Results to TestRail 24 | trcli -y -c "trcli-config.yml" parse_junit -f "sample_result.xml" --title "JMeter Demo" 25 | 26 | ``` 27 | -------------------------------------------------------------------------------- /samples/jmeter/jmeter.log: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /samples/jmeter/jmeter_trcli.sh: -------------------------------------------------------------------------------- 1 | clear 2 | 3 | bold=$(tput bold) 4 | TRCLI_CONFIG_PATH="C:\path\to\your\trcli\config\file\trcli-config.yml" 5 | TRCLI_TEST_FILE="C:\path\to\your\trcli\config\file\jmeter_performance_test.jmx" 6 | JMETER_RESULTS="C:\path\to\your\file\sample_results.xml" 7 | 8 | echo "($bold)-------------------------------------" 9 | echo "($bold)--- JMeter TestRail Sample Project --" 10 | echo "($bold)-------------------------------------" 11 | 12 | echo "($bold)... verify if TRCLI is installed:" 13 | echo 14 | trcli 15 | echo 16 | 17 | echo "($bold)... execute JMeter Load Test:" 18 | echo 19 | ./jmeter.bat --nongui --testfile "$TRCLI_TEST_FILE" 20 | echo 21 | 22 | echo "($bold)... executing TestRail TRCLI to upload results in a new Test Run:" 23 | echo 24 | trcli --yes --config "$TRCLI_CONFIG_PATH" parse_junit --file "$JMETER_RESULTS" --title "JMeter Demo" 25 | echo 26 | 27 | echo "($bold)... execution completed. New Test Run created." 28 | -------------------------------------------------------------------------------- /samples/jmeter/sample_result.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /samples/jmeter/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: 2 | project: 3 | username: 4 | password: 5 | run-description: -------------------------------------------------------------------------------- /samples/k6/README.md: -------------------------------------------------------------------------------- 1 | # K6 TestRail Integration 2 | TestRail Integration With [K6](https://k6.io/) 3 | 4 | ## Pre-requisites for running the tests in the project 5 | 6 | You need to install the following on your local machine: 7 | - [Node.js](https://nodejs.org/en/download) 8 | 9 | ## How to upload the test results to TestRail from your local machine 10 | 11 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 12 | - Execute the script command: 13 | 14 | ```sh 15 | ./k6_new_run.sh 16 | ``` 17 | -------------------------------------------------------------------------------- /samples/k6/k6_new_run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | clear 3 | bold=$(tput bold) 4 | echo "${bold}----------------------------------------------" 5 | echo "${bold}--------- K6 TestRail Sample Project ---------" 6 | echo "${bold}----------------------------------------------" 7 | echo 8 | 9 | echo "${bold}...verify TRCLI is installed" 10 | echo 11 | 12 | trcli 13 | echo 14 | 15 | echo "${bold}...install k6 and k6-junit library" 16 | echo 17 | 18 | npm install -g k6 19 | npm install -g k6-to-junit 20 | echo 21 | 22 | echo "${bold}...execute k6 load test" 23 | echo 24 | 25 | k6 run test_k6.js | k6-to-junit ./reports/junit.xml 26 | 27 | echo "${bold}...executing TestRail CLI, uploading results in new test run" 28 | echo 29 | 30 | trcli -y -c "trcli-config.yml" parse_junit -f "./reports/junit.xml" --title "k6 Load Smoke Test - 5 vUser Execution" 31 | echo 32 | 33 | echo "${bold}...execution complete" -------------------------------------------------------------------------------- /samples/k6/test_k6.js: -------------------------------------------------------------------------------- 1 | import http from 'k6/http'; 2 | import { check, group } from 'k6'; 3 | 4 | const baseUrl = 'http://jsonplaceholder.typicode.com'; 5 | 6 | export const options = { 7 | vus: 1, 8 | stages: [ 9 | { duration: '10s', target: 10 } 10 | ], 11 | thresholds: { 12 | http_req_failed: ['rate<0.01'], // http errors should be less than 1% 13 | http_req_duration: ['p(95)<20'], // 95% of requests should be below 20ms 14 | http_reqs: ['count >= 1400', 'count <= 1600'], //total requests generate by k6 should be within 1400 -- 1600 15 | }, 16 | }; 17 | 18 | export default function () { 19 | group('JSON Placeholder Performance Testing', function () { 20 | group('Posts endpoint', function () { 21 | const res = http.get(`${baseUrl}/posts`); 22 | check(res, { 23 | 'is status code 200': (r) => r.status === 200, 24 | }); 25 | }); 26 | }); 27 | } 28 | 29 | -------------------------------------------------------------------------------- /samples/k6/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: 2 | project: 3 | username: 4 | password: 5 | run-description: -------------------------------------------------------------------------------- /samples/python/pytest-selenium/.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /.venv 3 | /.pytest_cache 4 | /reports 5 | *.pyc -------------------------------------------------------------------------------- /samples/python/pytest-selenium/README.md: -------------------------------------------------------------------------------- 1 | # Pytest sample project 2 | 3 | ## How to use the project 4 | 5 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 6 | - Execute the commands on the script below 7 | 8 | ```sh 9 | # Install TR CLI 10 | pip install trcli 11 | 12 | # Install test project 13 | pip install -r requirements.txt 14 | 15 | # Run tests 16 | pytest --junitxml "reports/junit-report.xml" "./tests" 17 | 18 | # Upload test results 19 | trcli -y -c "trcli-config.yml" parse_junit -f "reports/junit-report.xml" 20 | ``` -------------------------------------------------------------------------------- /samples/python/pytest-selenium/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | junit_family=legacy -------------------------------------------------------------------------------- /samples/python/pytest-selenium/requirements.txt: -------------------------------------------------------------------------------- 1 | pytest==7.1.3 2 | selenium==4.5.0 3 | webdriver-manager==3.8.6 -------------------------------------------------------------------------------- /samples/python/pytest-selenium/sample_reports/16a20c01-a2aa-4f30-8724-25a76c11e241_browser_logs.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "level": "WARNING", 4 | "message": "https://cdnjs.cloudflare.com/ajax/libs/gsap/3.11.4/ScrollTrigger.min.js?ver=6.2 9:1174 \"Element not found:\" \".bde-section-424-128\"", 5 | "source": "console-api", 6 | "timestamp": 1683420614149 7 | } 8 | ] -------------------------------------------------------------------------------- /samples/python/pytest-selenium/sample_reports/16a20c01-a2aa-4f30-8724-25a76c11e241_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/python/pytest-selenium/sample_reports/16a20c01-a2aa-4f30-8724-25a76c11e241_screenshot.png -------------------------------------------------------------------------------- /samples/python/pytest-selenium/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/python/pytest-selenium/tests/__init__.py -------------------------------------------------------------------------------- /samples/python/pytest-selenium/tests/conftest.py: -------------------------------------------------------------------------------- 1 | import json 2 | from pathlib import Path 3 | from uuid import uuid4 4 | 5 | import pytest 6 | from selenium import webdriver 7 | from selenium.webdriver.chrome.service import Service as ChromeService 8 | from webdriver_manager.chrome import ChromeDriverManager 9 | 10 | 11 | @pytest.fixture 12 | def browser_driver(request, record_property): 13 | """Initializes webdriver and performs teardown actions""" 14 | driver = setup_driver() 15 | yield driver 16 | save_failure_artifacts(driver, request, record_property) 17 | driver.close() 18 | 19 | 20 | def setup_driver(): 21 | """Creates webdriver for Chrome and opens the TestRail website""" 22 | chrome_options = webdriver.ChromeOptions() 23 | chrome_options.add_argument("--no-sandbox") 24 | chrome_options.add_argument("--headless") 25 | chrome_options.add_argument("--disable-dev-shm-usage") 26 | driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=chrome_options) 27 | driver.implicitly_wait(3) 28 | driver.set_page_load_timeout(10) 29 | driver.set_window_size(1920, 1080) 30 | driver.get("https://www.testrail.com/") 31 | driver.maximize_window() 32 | return driver 33 | 34 | 35 | def save_failure_artifacts(driver, request, record_property): 36 | """Saves screenshot and browser logs for failed tests""" 37 | if request.node.rep_setup.failed or request.node.rep_call.failed: 38 | try: 39 | failure_id = uuid4() 40 | # Create reports folder if not exists 41 | reports_folder = Path("reports") 42 | if not reports_folder.is_dir(): 43 | reports_folder.mkdir() 44 | # Save screenshot 45 | screenshot_path = str(reports_folder / f"{failure_id}_screenshot.png") 46 | driver.save_screenshot(screenshot_path) 47 | record_property("testrail_attachment", screenshot_path) 48 | # Save browser logs 49 | browser_logs_path = reports_folder / f"{failure_id}_browser_logs.json" 50 | with browser_logs_path.open("x") as file: 51 | file.write(json.dumps(driver.get_log("browser"), indent=4)) 52 | record_property("testrail_attachment", browser_logs_path) 53 | except Exception as ex: 54 | print(ex) 55 | 56 | 57 | @pytest.hookimpl(tryfirst=True, hookwrapper=True) 58 | def pytest_runtest_makereport(item, call): 59 | """Hook to allow fetching test execution status in fixtures for selective teardown purposes""" 60 | # execute all other hooks to obtain the report object 61 | outcome = yield 62 | rep = outcome.get_result() 63 | # set a report attribute for each phase of a call, which can be "setup", "call", "teardown" 64 | setattr(item, "rep_" + rep.when, rep) 65 | -------------------------------------------------------------------------------- /samples/python/pytest-selenium/tests/test_footer.py: -------------------------------------------------------------------------------- 1 | from selenium.webdriver.common.by import By 2 | from selenium.webdriver.remote.webdriver import WebDriver 3 | 4 | 5 | class TestsFooter: 6 | 7 | @staticmethod 8 | def test_social_links(browser_driver: WebDriver): 9 | assert browser_driver.find_element(By.XPATH, "//*[@href='https://www.linkedin.com/company/testrail/']").is_displayed() 10 | -------------------------------------------------------------------------------- /samples/python/pytest-selenium/tests/test_homepage.py: -------------------------------------------------------------------------------- 1 | from selenium.webdriver.common.by import By 2 | from selenium.webdriver.remote.webdriver import WebDriver 3 | 4 | 5 | class TestsHomepage: 6 | 7 | @staticmethod 8 | def test_header_links(browser_driver: WebDriver, record_property): 9 | """ 10 | Checks headers links 11 | """ 12 | record_property("testrail_result_comment", "1. Check Platform link") 13 | assert browser_driver.find_element(By.XPATH, "//*[@href='/platform/']").is_displayed() 14 | 15 | record_property("testrail_result_comment", "2. Check Enterprise link") 16 | assert browser_driver.find_element(By.XPATH, "//*[@href='/enterprise/']").is_displayed() 17 | 18 | record_property("testrail_result_comment", "3. Check Pricing link") 19 | assert browser_driver.find_element(By.XPATH, "//*[@href='/pricing/']").is_displayed() 20 | 21 | @staticmethod 22 | def test_action_links(browser_driver: WebDriver, record_property): 23 | """ 24 | Checks actions links for trial and demo 25 | """ 26 | record_property("testrail_result_comment", "1. Check Demo link") 27 | assert browser_driver.find_element(By.XPATH, "(//*[contains(@href,'webinar/register')])[1]").is_displayed() 28 | 29 | record_property("testrail_result_comment", "2. Check Trial link") 30 | assert browser_driver.find_element(By.XPATH, "//*[@href='/get_trial_invalid_link/']").is_displayed() 31 | -------------------------------------------------------------------------------- /samples/python/pytest-selenium/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | project: PROJECT NAME 3 | username: USERNAME 4 | password: PASSWORD 5 | title: Pytest Automated Test Run -------------------------------------------------------------------------------- /samples/python/pytest/.gitignore: -------------------------------------------------------------------------------- 1 | /.idea 2 | /.venv 3 | /.pytest_cache 4 | /reports 5 | *.pyc -------------------------------------------------------------------------------- /samples/python/pytest/README.md: -------------------------------------------------------------------------------- 1 | # Pytest sample project 2 | 3 | ## How to use the project 4 | 5 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 6 | - Execute the commands on the script below 7 | 8 | ```sh 9 | # Install TR CLI 10 | pip install trcli 11 | 12 | # Install test project 13 | pip install -r requirements.txt 14 | 15 | # Run tests 16 | pytest --junitxml "reports/junit-report.xml" "./tests" 17 | 18 | # Upload test results 19 | trcli -y -c "trcli-config.yml" parse_junit -f "reports/junit-report.xml" 20 | ``` -------------------------------------------------------------------------------- /samples/python/pytest/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | junit_family=legacy -------------------------------------------------------------------------------- /samples/python/pytest/requirements.txt: -------------------------------------------------------------------------------- 1 | pytest==7.1.2 -------------------------------------------------------------------------------- /samples/python/pytest/sample_reports/junit-report.xml: -------------------------------------------------------------------------------- 1 | def test_sum_two_decimals(): 2 | > assert 0.8 + 0.3 == 1.2 3 | E assert (0.8 + 0.3) == 1.2 4 | 5 | tests\test_sum.py:9: AssertionError -------------------------------------------------------------------------------- /samples/python/pytest/sample_reports/testrail.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/python/pytest/sample_reports/testrail.jpg -------------------------------------------------------------------------------- /samples/python/pytest/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/python/pytest/tests/__init__.py -------------------------------------------------------------------------------- /samples/python/pytest/tests/test_subtraction.py: -------------------------------------------------------------------------------- 1 | def test_subtract_two_numbers(): 2 | assert 1 - 1 == 0 3 | -------------------------------------------------------------------------------- /samples/python/pytest/tests/test_sum.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | 4 | def test_sum_two_numbers(): 5 | assert 1 + 1 == 2 6 | 7 | 8 | def test_sum_two_decimals(record_property): 9 | record_property("testrail_attachment", "sample_reports/testrail.jpg") 10 | assert 0.8 + 0.3 == 1.2 11 | 12 | 13 | @pytest.mark.parametrize("test_input,expected", [("3+5", 8), ("2+4", 6)]) 14 | def test_sum_multiple_numbers(test_input, expected): 15 | assert eval(test_input) == expected 16 | -------------------------------------------------------------------------------- /samples/python/pytest/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | project: PROJECT NAME 3 | username: USERNAME 4 | password: PASSWORD 5 | title: Pytest Automated Test Run 6 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-browser/.gitignore: -------------------------------------------------------------------------------- 1 | .venv 2 | /reports -------------------------------------------------------------------------------- /samples/robotframework/robotframework-browser/README.md: -------------------------------------------------------------------------------- 1 | # Robot Framework browser library sample project 2 | 3 | ## Pre-requisites for running the tests in the project 4 | 5 | You need to install the following on your local machine: 6 | - Node.js 7 | - Python3 8 | 9 | ## How to use the project 10 | 11 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 12 | - Execute the commands on the script below 13 | 14 | ```sh 15 | # Install Robot Framework Browser Library 16 | pip install robotframework-browser 17 | 18 | # Initialize the Browser library: 19 | rfbrowser init 20 | 21 | # Install TR CLI 22 | pip install trcli 23 | 24 | # Run tests 25 | robot -d reports "./tests" 26 | 27 | # Upload test results 28 | trcli -y -c "trcli-config.yml" parse_robot -f "reports/output.xml" 29 | ``` 30 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-browser/bitbucket-pipelines.yml: -------------------------------------------------------------------------------- 1 | image: python:3.9 2 | pipelines: 3 | default: 4 | - step: 5 | name: Build and run the tests 6 | caches: 7 | - pip 8 | script: 9 | - apt-get update && apt install -y curl 10 | - curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && apt-get install -y nodejs 11 | - pip install robotframework-browser 12 | - rfbrowser init 13 | - npx playwright install-deps 14 | - robot -d reports -x junit-report.xml "./tests" || true 15 | artifacts: 16 | - reports/junit-report.xml 17 | - step: 18 | name: Install TR CLI and upload the test results to TestRail 19 | script: 20 | - pip install trcli 21 | - trcli -y 22 | -h https://INSTANCE.testrail.io/ 23 | --project "PROJECT NAME" 24 | -u USER_EMAIL 25 | -p PASSWORD 26 | parse_junit 27 | --title "Automated Tests from Bitbucket workflow" 28 | --run-description $BITBUCKET_GIT_HTTP_ORIGIN/pipelines/results/$BITBUCKET_BUILD_NUMBER 29 | -f "reports/junit-report.xml" 30 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-browser/requirements.txt: -------------------------------------------------------------------------------- 1 | robotframework==6.0.2 2 | robotframework-browser==16.1.0 3 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-browser/sample_reports/browser/screenshot/fail-screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/robotframework/robotframework-browser/sample_reports/browser/screenshot/fail-screenshot-1.png -------------------------------------------------------------------------------- /samples/robotframework/robotframework-browser/sample_reports/browser/screenshot/homepage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/robotframework/robotframework-browser/sample_reports/browser/screenshot/homepage.png -------------------------------------------------------------------------------- /samples/robotframework/robotframework-browser/sample_reports/junit-report.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-browser/tests/footer-tests.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Resource keywords.robot 3 | Test Teardown Close Test Browser 4 | 5 | *** Test Cases *** 6 | Verify Presence Of Social Links 7 | [Documentation] Verifies footer contains the expected social links 8 | ... - testrail_case_field: refs:TR-2 9 | ... - testrail_case_field: priority_id:3 10 | ... - testrail_result_field: custom_environment:qa 11 | Open TestRail Homepage 12 | Verify Footer Links 13 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-browser/tests/homepage-tests.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Resource keywords.robot 3 | Test Teardown Close Test Browser 4 | 5 | *** Test Cases *** 6 | Verify Presence Of Header Links 7 | [Documentation] Verifies header contains platform and enterprise links 8 | ... - testrail_case_field: refs:TR-1 9 | ... - testrail_case_field: priority_id:2 10 | ... - testrail_result_field: custom_environment:qa 11 | ... - testrail_result_field: custom_dropdown_1:3 12 | Open TestRail Homepage 13 | Verify Header Main Links 14 | 15 | Verify Presence Of Demo Link 16 | [Documentation] Verifies header contains link to request a demo - Intentionally failing 17 | ... - testrail_case_field: refs:TR-1 18 | ... - testrail_case_field: priority_id:2 19 | ... - testrail_result_field: custom_environment:qa 20 | Open TestRail Homepage 21 | Verify Header Demo Link 22 | Click Demo Link 23 | Verify Demo Page URL 24 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-browser/tests/keywords.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library Browser 3 | 4 | *** Keywords *** 5 | Set TestRail Property 6 | [Arguments] ${key} ${value} 7 | Set Test Documentation ${\n}- ${key}: ${value} append=True 8 | 9 | Open TestRail Homepage 10 | New Page https://www.testrail.com/ 11 | Wait Until Network Is Idle timeout=10s 12 | 13 | Verify Header Main Links 14 | Get Element States .breakdance-menu-list [href*='/platform/'] contains visible 15 | Get Element States .breakdance-menu-list [href*='/enterprise/'] contains visible 16 | Set TestRail Property testrail_result_comment All links are visible 17 | 18 | Verify Header Demo Link 19 | Get Element States .breakdance-menu-list [href*='/invalid/'] contains visible 20 | Get Text .breakdance-menu-list [href*='/invalid/'] == Get Demo 21 | 22 | Click Demo Link 23 | Click .breakdance-menu-list [href*='/invalid/'] 24 | 25 | Verify Demo Page URL 26 | Get Url contains /demo 27 | 28 | Verify Footer Links 29 | Get Element States [href*='linkedin.com/company/testrail'] contains visible 30 | Get Element States [href*='facebook.com/testrailofficial'] contains visible 31 | 32 | Take Screenshot And Report 33 | ${path} = Take Screenshot failure-{index} 34 | Set TestRail Property testrail_attachment ${path} 35 | 36 | Close Test Browser 37 | Run Keyword If '${TEST_STATUS}' != 'PASS' Take Screenshot And Report 38 | Close Browser CURRENT 39 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-browser/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | project: PROJECT NAME 3 | username: USERNAME 4 | password: PASSWORD 5 | title: Robot Framework Automated Test Run 6 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-selenium/.gitignore: -------------------------------------------------------------------------------- 1 | /.venv 2 | /reports -------------------------------------------------------------------------------- /samples/robotframework/robotframework-selenium/README.md: -------------------------------------------------------------------------------- 1 | # Robot Framework sample project 2 | 3 | ## How to use the project 4 | 5 | - Replace the placeholders in `trcli-config.yml` with your TestRail instance details 6 | - Execute the commands on the script below 7 | 8 | ```sh 9 | # Install TR CLI 10 | pip install trcli 11 | 12 | # Install test project 13 | pip install -r requirements.txt 14 | 15 | # Run tests 16 | robot -d reports "./tests" 17 | 18 | # Upload test results 19 | trcli -y -c "trcli-config.yml" parse_robot -f "reports/output.xml" 20 | ``` 21 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-selenium/requirements.txt: -------------------------------------------------------------------------------- 1 | robotframework==6.1 2 | robotframework-seleniumlibrary==6.1.0 3 | selenium==4.9.0 4 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-selenium/sample_reports/failure-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/robotframework/robotframework-selenium/sample_reports/failure-1.png -------------------------------------------------------------------------------- /samples/robotframework/robotframework-selenium/sample_reports/selenium-screenshot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gurock/automation-frameworks-integration/36ef0f317a2bbc62a2b2bb3b91592e946f3362f5/samples/robotframework/robotframework-selenium/sample_reports/selenium-screenshot-1.png -------------------------------------------------------------------------------- /samples/robotframework/robotframework-selenium/tests/footer-tests.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Resource keywords.robot 3 | Test Teardown Close Test Browser 4 | 5 | *** Test Cases *** 6 | Verify Presence Of Social Links 7 | [Documentation] Verifies footer contains the expected social links 8 | ... - testrail_case_field: refs:TR-2 9 | ... - testrail_case_field: priority_id:3 10 | ... - testrail_result_field: custom_environment:qa 11 | Open TestRail Homepage 12 | Verify Footer Links 13 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-selenium/tests/homepage-tests.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Resource keywords.robot 3 | Test Teardown Close Test Browser 4 | 5 | *** Test Cases *** 6 | Verify Presence Of Header Links 7 | [Documentation] Verifies header contains platform and enterprise links 8 | ... - testrail_case_field: refs:TR-1 9 | ... - testrail_case_field: priority_id:2 10 | ... - testrail_result_field: custom_environment:qa 11 | Open TestRail Homepage 12 | Verify Header Main Links 13 | 14 | Verify Presence Of Demo Link 15 | [Documentation] Verifies header contains link to request a demo - Intentionally failing 16 | ... - testrail_case_field: refs:TR-1 17 | ... - testrail_case_field: priority_id:2 18 | ... - testrail_result_field: custom_environment:qa 19 | Open TestRail Homepage 20 | Verify Header Demo Link 21 | Click Demo Link 22 | Verify Demo Page URL 23 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-selenium/tests/keywords.robot: -------------------------------------------------------------------------------- 1 | *** Settings *** 2 | Library SeleniumLibrary 3 | 4 | *** Keywords *** 5 | Set TestRail Property 6 | [Arguments] ${key} ${value} 7 | Set Test Documentation ${\n}- ${key}: ${value} append=True 8 | 9 | Open TestRail Homepage 10 | Open Browser 11 | ... url=https://www.testrail.com 12 | ... browser=headlesschrome 13 | Set Window Size 1920 1080 14 | 15 | Verify Header Main Links 16 | Wait Until Element Is Visible css=.breakdance-menu-list [href*='/platform/'] 17 | Wait Until Element Is Visible css=.breakdance-menu-list [href*='/enterprise/'] 18 | Set TestRail Property testrail_result_comment All links are visible 19 | 20 | Verify Header Demo Link 21 | Wait Until Element Is Visible css=.breakdance-menu-list [href*='/invalid/'] 22 | Element Should Contain css=.breakdance-menu-list [href*='/invalid/'] Get Demo 23 | 24 | Click Demo Link 25 | Click Element css=.breakdance-menu-list [href*='/invalid/'] 26 | 27 | Verify Demo Page URL 28 | Location Should Be /demo 29 | 30 | Verify Footer Links 31 | Wait Until Element Is Visible css=[href*='linkedin.com/company/testrail'] 32 | Wait Until Element Is Visible css=[href*='facebook.com/testrailofficial'] 33 | 34 | Take Screenshot And Report 35 | ${path} = Capture Page Screenshot filename=failure-{index}.png 36 | Set TestRail Property testrail_attachment ${path} 37 | 38 | Close Test Browser 39 | Run Keyword If '${TEST_STATUS}' != 'PASS' Take Screenshot And Report 40 | Close Browser 41 | -------------------------------------------------------------------------------- /samples/robotframework/robotframework-selenium/trcli-config.yml: -------------------------------------------------------------------------------- 1 | host: https://INSTANCE-NAME.testrail.io 2 | project: PROJECT NAME 3 | username: USERNAME 4 | password: PASSWORD 5 | title: Robot Framework Automated Test Run 6 | --------------------------------------------------------------------------------