Endtest

Endtest

›Integrations

Web Tests

  • How to create Web Tests
  • Finding elements in Web Applications
  • How to execute Web Tests
  • Assertions for Web Tests
  • IF Statements for Web Tests
  • Web Applications with restricted access
  • How to test in iframes
  • How to test in multiple tabs
  • How to test File Uploads
  • How to test File Downloads
  • How to test Emails
  • How to test PDF files
  • How to test Chrome Extensions
  • Dealing with reCAPTCHA
  • Dealing with Dynamic Locators
  • Dealing with Canvas Elements
  • Performing a Drag and Drop
  • Execute JavaScript
  • Testing WebRTC Applications
  • How to scroll in Web Tests
  • How to test Checkboxes
  • How to test Dropdowns
  • Dealing with Sessions
  • Web Crawler
  • Export Web Tests
  • Migrating from Selenium

Mobile Tests

  • How to create Mobile Tests
  • Finding elements in Mobile Applications
  • How to execute Mobile Tests
  • Assertions for Mobile Tests
  • IF Statements for Mobile Tests
  • How to scroll in Mobile Tests
  • Performing Complex Gestures

Advanced

  • Variables
  • Waits
  • Endtest API
  • Scheduler
  • Drive
  • Adding Collaborators
  • Computer Vision
  • Importing Test Cases
  • Using Loops
  • Data-driven Testing
  • Send API Requests
  • Read SMS
  • Execute SQL queries
  • Self-Healing Tests
  • Email Notifications
  • Slack Notifications
  • PagerDuty Notifications
  • Webhook Notifications
  • Automatic Backup
  • Advanced Settings
  • Multiple environments
  • How to stop a test
  • Utilities
  • Utilities API
  • Team
  • On-Premises

Integrations

  • Atlassian Jira
  • Slack
  • PagerDuty
  • Microsoft Teams
  • Mattermost
  • Jenkins
  • GitHub
  • Azure DevOps
  • GitLab
  • TeamCity
  • CircleCI
  • TravisCI
  • Bitbucket
  • Heroku
  • Bamboo Server
  • Test Case Management
  • SSO
  • BrowserStack
  • Sauce Labs

GitLab

Instructions

You can use the Endtest API in your GitLab CI/CD workflow.

This can be done by creating a test.sh file and executing it from your GitLab CI/CD workflow.

YAML snippet

test:
  stage: test
  script:
    - sudo chmod +x /root/scripts/test.sh     
    - /root/scripts/test.sh

test.sh

#!/bin/bash
hash=$(curl -X GET --header "Accept: */*" "${3}")
for run in {1.."${4}"}
do
  sleep 30
  result=$(curl -X GET --header "Accept: */*" "https://app.endtest.io/api.php?action=getResults&appId=${1}&appCode=${2}&hash=${hash}&format=json")
  if [ "$result" == "Test is still running." ]
  then
    status=$result
    # Don't print anything
  elif [ "$result" == "Processing video recording." ]
  then
    status=$result
    # Don't print anything
  elif [ "$result" == "Stopping." ]
  then
    status=$result
  elif [ "$result" == "Erred." ]
  then
    status=$result
    echo $status
  elif [ "$result" == "" ]
  then
    status=$result
    # Don't print anything
  else
     echo "$result" | jq
     exit 0
  fi
done
exit

This sample script would require the following arguments:

  1. The App ID for your account.
  2. The App Code for your account.
  3. The API Request for starting the test execution.
  4. The number of times the API request for fetching the results will be sent once every 30 seconds.

For example, if you know that your test execution usually takes 3 minutes, you should use the value 7.

7 x 30 seconds = 210 seconds > 3 minutes

Don't forget to make your Shell script executable by running the following command:

sudo chmod +x test.sh

And you would also need to install the jq package:

sudo apt-get install jq

The command for running the sample Shell script would have the following format:

./test.sh app-id app-code api-request-to-start-test-execution number-of-loops

Let's pretend we have the following values:

App ID = 44233559

App Code = 22381137

Endtest API Request to start test execution = "https://app.endtest.io/api.php?action=runWeb&appId=44233559&appCode=22381137&suite=380667&platform=windows&os=windows10&browser=chrome&browserVersion=latest&resolution=1280x1024&geolocation=sanfrancisco&cases=all&notes="

Number of loops = 10

The command for running the sample Shell script would look like this:

./test.sh 44233559 22381137 "https://app.endtest.io/api.php?action=runWeb&appId=44233559&appCode=22381137&suite=380667&platform=windows&os=windows10&browser=chrome&browserVersion=latest&resolution=1280x1024&geolocation=sanfrancisco&cases=all&notes=" 10

The JSON with the results contains the following keys:

  • test_suite_name {string} - The name of the test suite.
  • configuration {string} - The configuration of the machine or mobile device on which the test was executed.
  • test_cases {int32} - The number of test cases.
  • passed {int32} - The number of assertions that have passed.
  • failed {int32} - The number of assertions that have failed.
  • errors {int32} - The number of errors that have been encountered.
  • start_time {timestamp} - The timestamp for the start of the test execution.
  • end_time {timestamp} - The timestamp for the end of the test execution.
  • detailed_logs {string} - The detailed logs for the test execution.
  • screenshots_and_video {string} - The URLs for the screenshots and the video recording of the test execution.
  • test_case_management {string} - The name, status and external IDs for each test case.

You can also use the value of the hash variable to generate the link to the Results page for that test execution:

results=https://app.endtest.io/results?hash="$hash"

You can find more details about our API in the Endtest API chapter.

← Azure DevOpsTeamCity →
  • Instructions
© Endtest Inc.