Skip to main content

Troubleshooting CI/CD Integration

Increase HTTP Request Timeout past 1 minute

For long running Botium test sessions, the CI/CD Integration API endpoints will run into a timeout – HTTP is not made for long running requests. Instead, for those cases Botium provides additional API endpoints:

  • Polling Botium for the test session result
  • Botium can send test session results to a callback endpoint hosted on your side

Polling Botium for the test session result requires to make several HTTP requests to the status endpoint until it reaches the READY state. Most CI/CD Integration pipelines can run a shell script, so here is an example how to

  1. Start a test session in Botium
  2. Poll Botium in a loop until the test session has reached READY state
  3. Output the Botium test result as JSON
    #!/bin/bash
    
    BUILDID=BLD-003
    APIKEY=yyyy
    
    # Trigger the build
    curl -s "https://smoketest.live01.botiumbox.com/api/triggerbuild/Echo-Bot-Test-Suite?APIKEY=$APIKEY&BUILDID=$BUILDID&REPORTER=json" > /dev/null
    
    # Check build status until it's ready
    STATUS=$(curl -s "https://smoketest.live01.botiumbox.com/api/build/$BUILDID?APIKEY=$APIKEY&REPORTER=json" | jq -r '.status')
    until [ $STATUS == "READY" ]; do
        sleep 5
        STATUS=$(curl -s "https://smoketest.live01.botiumbox.com/api/build/$BUILDID?APIKEY=$APIKEY&REPORTER=json" | jq -r '.status')
    done
    
    # Fetch build results
    curl -s "https://smoketest.live01.botiumbox.com/api/build/$BUILDID?APIKEY=$APIKEY&REPORTER=json"
Note:
  • The BUILDID usually comes from the CI/CD integration pipeline (for example, in Jenkins it is handed over with the BUILD_NUMBER environment variable)
  • The APIKEY is from your Botium installation
  • You can find the HTTP endpoints for a Botium Test Project in the Configuration / Build Server Integration section

Increase HTTP Request Timeout (Alternative)

There are some CI/CD Integration Pipelines out there where it is easier to configure in just a one-line shell script. You can do the same as in the above script in a one-line shell script as well (the first few lines can be removed then):
#!/bin/bash

BUILDID=BLD-003
APIKEY=yyyy

# Trigger the build
(curl -s "https://smoketest.live01.botiumbox.com/api/triggerbuild/Echo-Bot-Test-Suite?APIKEY=$APIKEY&BUILDID=$BUILDID&REPORTER=json" > /dev/null) && (

    # Wait until build is ready
    until [[ $(curl -s "https://smoketest.live01.botiumbox.com/api/build/$BUILDID?APIKEY=$APIKEY&REPORTER=json" | jq -r '.status') == "READY" ]]; do
        sleep 5
    done
    
) && (

    # Fetch build results
    curl -s "https://smoketest.live01.botiumbox.com/api/build/$BUILDID?APIKEY=$APIKEY&REPORTER=json"
)

Was this article helpful?

0 out of 0 found this helpful