Run Tests

Applies to TestEngine 1.31, last modified on June 07, 2024

To run a test in TestEngine, you need to send a request to TestEngine with a ReadyAPI project attached. This topic shows how to do it.

1. Prepare a ReadyAPI project

The request to TestEngine must contain a ReadyAPI project. The way you send it depends on the project:

  • If your project is a single .xml file (your project is not composite, and you do not use external files), you can send only the project file.

    How to find project file

  • If you use external files (external data sources, certificates, or attachments), or
    if your project is a composite one, you need to pack the project and all the required files into a zip package.

    How to get zip package

2. Send a request

To send a project to TestEngine and run a test, use the following operation:

POST  http://<testengine-host>:8080/api/v1/testjobs[?parameters]

Body

The ReadyAPI project file, or attached zip package.

Authentication

The request must be authenticated by a TestEngine user.

See details on SwaggerHub.

Override custom properties

When you run a test from TestEngine, you can override custom property values for the test run. To do this, you need to send a JSON file containing the needed values and send it to TestEngine along with the project file.

1. Create JSON file

The file must contain a JSON array. Each element of the array specifies a project item and its custom properties to override. For example:

JSON

[
  {
    "properties" : {
      "projectProperty" : "Value"
    }
  },
  {
    "targetName" : "Sample test suite",
    "properties" : {
      "testSuiteProperty" : "Value",
      "anotherTestSuiteProperty" : "Value"
    }
  },
  {
    "targetName" : "Sample test case",
    "properties" : {
      "testCaseProperty" : "Value"
    }
  }
]

Each array element consists of the following elements:

Element Description
targetName [Optional] The name of a test suite or a test case containing the needed custom properties. Skip this element to specify project-level properties.
properties An object containg custom properties to override. Each custom property is a "key": "value" pair, where key is the custom property name, and value - its value to be used in a test run.

2. Send tproperties file

Send a request of the multipart/form-data content-type, and attach both project file and a property file with the following content-ID values:

File Content-ID
Project file project
Properties file properties

Example

Examples

Use the following command line:

curl -u "user:password" --data-binary "@C:\Work\Test\sample-readyapi-project.xml" -H "Content-Type: application/xml" -X POST "http://localhost:8080/api/v1/testjobs"

In this example:

-u user:password

The user credentials used in the request.

--data-binary "@C:\Work\Test\sample-readyapi-project.xml"

The ReadyAPI project attached to the request.

-H "Content-Type: application/xml"

The Content-Type header, which tells TestEngine the type of the attachment.

-X POST

The request method (POST).

"http://localhost:8080/api/v1/testjobs"

The endpoint of the request.
  1. Create a project by using the TestEngine API definition. See Creating Project From OpenAPI/Swagger Definition to learn how to do it.

    Tip: You can also create the needed request from scratch.
  2. Open Projects and select the POST request to the /testjobs resource:

    Run ReadyAPI project in TestEngine: Select a request

    Click the image to enlarge it.

  3. Open the Attachment panel and click Add Attachment.

    Run ReadyAPI project in TestEngine: Adding attachment

    Click the image to enlarge it.

  4. Specify the project you want to send to TestEngine.

  5. Set the Content type of the attachment and Media Type of the payload to application/xml.

    Run ReadyAPI project in TestEngine: Set the Content-Type to application/xml

    Click the image to enlarge it.

  6. Open the Auth panel.

  7. Select the Basic (Built-in) authorization type.

    Tip: If you use the same credentials in several requests, use authorization profiles.
  8. Specify user credentials and select the Authenticate pre-emptively option:

    Run ReadyAPI project in TestEngine: Add authorization

    Click the image to enlarge it.

  9. Send the request:

    Run ReadyAPI project in TestEngine: Send request

    Click the image to enlarge it.

In TestEngine, you can give a job a high priority. TestEngine will run high-priority jobs before regular jobs.

Use the following command line:

curl -u "user:password" --data-binary "@C:\Work\Test\sample-readyapi-project.xml" -H "Content-Type: application/xml" -X POST "http://localhost:8080/api/v1/testjobs?priorityJob=true"

In this example:

-u user:password

The user credentials used in the request.

--data-binary "@C:\Work\Test\sample-readyapi-project.xml"

The ReadyAPI project attached to the request.

-H "Content-Type: application/xml"

The Content-Type header, which tells TestEngine the type of the attachment.

-X POST

The request method (POST).

"http://localhost:8080/api/v1/testjobs?priorityJob=true"

The endpoint of the request with query parameters.
The priorityJob parameter gives the job a high priority.
  1. Create a project by using the TestEngine API definition. See Creating Project From OpenAPI/Swagger Definition to learn how to do it.

    Tip: You can also create the needed request from scratch.
  2. Open Projects and select the POST request to the /testjobs resource:

    Run ReadyAPI project in TestEngine: Select a request

    Click the image to enlarge it.

  3. Open the Attachment panel and click Add Attachment.

    Run ReadyAPI project in TestEngine: Adding attachment

    Click the image to enlarge it.

  4. Specify the project you want to send to TestEngine.

  5. Set the Content type of the attachment and Media Type of the payload to application/xml.

    Run ReadyAPI project in TestEngine: Set the Content-Type to application/xml

    Click the image to enlarge it.

  6. Open the Auth panel.

  7. Select the Basic (Built-in) authorization type.

    Tip: If you use the same credentials in several requests, use authorization profiles.
  8. Specify the user credentials and select the Authenticate pre-emptively option:

    Run ReadyAPI project in TestEngine: Add authorization

    Click the image to enlarge it.

  9. Set the priorityJob parameter to true:

    Run ReadyAPI project in TestEngine: Set the priorityJob parameter

    Click the image to enlarge it.

  10. Send the request:

    Run ReadyAPI project in TestEngine: Send request

    Click the image to enlarge it.

Use the following command line:

curl -u "user:password" --data-binary "@C:\Work\Test\exported-project.zip" -H "Content-Type: application/zip" -X POST "http://localhost:8080/api/v1/testjobs"

In this example:

-u user:password

User credentials used in the request.

--data-binary "@C:\Work\Test\exported-project.zip"

A .zip package attached to the request. The package contains a ReadyAPI project and all the required files.

-H "Content-Type: application/zip"

The Content-Type header, which tells TestEngine the type of the attachment.

-X POST

The request method (POST).

"http://localhost:8080/api/v1/testjobs"

The endpoint of the request.
  1. Create a project by using the TestEngine API definition. See Creating Project From OpenAPI/Swagger Definition to learn how to do it.

    Tip: You can also create the needed request from scratch.
  2. Open Projects and select the POST request to the /testjobs resource:

    Run ReadyAPI project in TestEngine: Select a request

    Click the image to enlarge it.

  3. Specify a zip package that contains a project you want to send to TestEngine (an xml file or a folder with a composite project) and all the required files.

  4. Set the Content type of the attachment and Media Type of the payload to application/zip.

    Run ReadyAPI project in TestEngine: Set the Content-Type to application/zip

    Click the image to enlarge it.

  5. Open the Auth panel.

  6. Select the Basic (Built-in) authorization type.

    Tip: If you use the same credentials in several requests, use authorization profiles.
  7. Specify user credentials and select the Authenticate pre-emptively option:

    Run ReadyAPI project in TestEngine: Add authorization

    Click the image to enlarge it.

  8. Send the request:

    Run ReadyAPI project in TestEngine: Send request

    Click the image to enlarge it.

Use the following command line:

curl -u "user:password" --data-binary "@C:\Work\Test\sample-readyapi-project.xml" -H "Content-Type: application/xml" -X POST "http://localhost:8080/api/v1/testjobs?testCaseName=findByStatus"

In this example:

-u user:password

The user credentials used in the request.

--data-binary "@C:\Work\Test\sample-readyapi-project.xml"

The ReadyAPI project attached to the request.

-H "Content-Type: application/xml"

The Content-Type header, which tells TestEngine the type of the attachment.

-X POST

The request method (POST).

"http://localhost:8080/api/v1/testjobs?testCaseName=findByStatus"

The endpoint of the request with query parameters.
The testCaseName parameter specifies the name of a test case to run.
To run a test suite, use the testSuiteName parameter. For example: to run the Example suite, use the following query parameter:
"http://localhost:8080/api/v1/testjobs?testSuiteName=Example"
  1. Create a project by using the TestEngine API definition. See Creating Project From OpenAPI/Swagger Definition to learn how to do it.

    Tip: You can also create the needed request from scratch.
  2. Open Projects and select the POST request to the /testjobs resource:

    Run ReadyAPI project in TestEngine: Select a request

    Click the image to enlarge it.

  3. Open the Attachment panel and click Add Attachment.

    Run ReadyAPI project in TestEngine: Adding attachment

    Click the image to enlarge it.

  4. Specify the project you want to send to TestEngine.

  5. Set the Content type of the attachment and Media Type of the payload to application/xml.

    Run ReadyAPI project in TestEngine: Set the Content-Type to application/xml

    Click the image to enlarge it.

  6. Open the Auth panel.

  7. Select the Basic (Built-in) authorization type.

    Tip: If you use the same credentials in several requests, use authorization profiles.
  8. Specify the user credentials and select the Authenticate pre-emptively option:

    Run ReadyAPI project in TestEngine: Add authorization

    Click the image to enlarge it.

  9. Specify the name of the test case you want to run in the testCaseName parameter:

    Run ReadyAPI project in TestEngine: Set the testCaseName parameter

    Click the image to enlarge it.

  10. Send the request:

    Run ReadyAPI project in TestEngine: Send request

    Click the image to enlarge it.

Use the following command line:

curl -u "user:password" --data-binary "@C:\Work\Test\sample-readyapi-project.xml" -H "Content-Type: application/xml" -X POST "http://localhost:8080/api/v1/testjobs?securityTestName=Security%20Test%20Case"

In this example:

-u user:password

The user credentials used in the request.

--data-binary "@C:\Work\Test\sample-readyapi-project.xml"

The ReadyAPI project attached to the request.

-H "Content-Type: application/xml"

The Content-Type header, which tells TestEngine the type of the attachment.

-X POST

The request method (POST).

"http://localhost:8080/api/v1/testjobs?securityTestName=Security%20Test%20Name"

The endpoint of the request with query parameters.
The securityTestName parameter specifies the name of a security test to run.
You cannot use the testCaseName and testSuiteName parameters when you specify a security test to run.
  1. Create a project by using the TestEngine API definition. See Creating Project From OpenAPI/Swagger Definition to learn how to do it.

    Tip: You can also create the needed request from scratch.
  2. Open Projects and select the POST request to the /testjobs resource:

    Run ReadyAPI project in TestEngine: Select a request

    Click the image to enlarge it.

  3. Open the Attachment panel and click Add Attachment.

    Run ReadyAPI project in TestEngine: Adding attachment

    Click the image to enlarge it.

  4. Specify the project you want to send to TestEngine.

  5. Set the Content type of the attachment and Media Type of the payload to application/xml.

    Run ReadyAPI project in TestEngine: Set the Content-Type to application/xml

    Click the image to enlarge it.

  6. Open the Auth panel.

  7. Select the Basic (Built-in) authorization type.

    Tip: If you use the same credentials in several requests, use authorization profiles.
  8. Specify the user credentials and select the Authenticate pre-emptively option:

    Run ReadyAPI project in TestEngine: Add authorization

    Click the image to enlarge it.

  9. Specify the name of the security test you want to run in the testCaseName parameter:

    Run ReadyAPI project in TestEngine: Set the testCaseName parameter

    Click the image to enlarge it.

  10. Send the request:

    Run ReadyAPI project in TestEngine: Send request

    Click the image to enlarge it.

Parameters

The POST request to the /testjobs resource has a number of parameters that allow you to run a particular test case, test suite, run security tests, run tests with the needed tag, or use a specific environment, and so on.

See the full list of operation parameters in the TestEngine specification on SwaggerHub:

https://app.swaggerhub.com/apis/smartbear/readyapi-testengine/

See Also

Functional Testing

Highlight search results