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.
-
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.
2. Send a request
To send a project to TestEngine and run a test, use the following operation:
Body
Authentication
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 |
Examples
Run a sample project
Use the following command line:
In this example:
-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"
-
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. -
Open Projects and select the POST request to the /testjobs resource:
-
Open the Attachment panel and click Add Attachment.
-
Specify the project you want to send to TestEngine.
-
Set the Content type of the attachment and Media Type of the payload to application/xml.
-
Open the Auth panel.
-
Select the Basic (Built-in) authorization type.
Tip: If you use the same credentials in several requests, use authorization profiles. -
Specify user credentials and select the Authenticate pre-emptively option:
-
Send the request:
Run a project with a high priority
In TestEngine, you can give a job a high priority. TestEngine will run high-priority jobs before regular jobs.
Use the following command line:
In this example:
-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"
The priorityJob parameter gives the job a high priority.
-
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. -
Open Projects and select the POST request to the /testjobs resource:
-
Open the Attachment panel and click Add Attachment.
-
Specify the project you want to send to TestEngine.
-
Set the Content type of the attachment and Media Type of the payload to application/xml.
-
Open the Auth panel.
-
Select the Basic (Built-in) authorization type.
Tip: If you use the same credentials in several requests, use authorization profiles. -
Specify the user credentials and select the Authenticate pre-emptively option:
-
Set the priorityJob parameter to
true
: -
Send the request:
Run a project with external dependencies
Use the following command line:
In this example:
-u user:password
--data-binary "@C:\Work\Test\exported-project.zip"
-H "Content-Type: application/zip"
-X POST
"http://localhost:8080/api/v1/testjobs"
-
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. -
Open Projects and select the POST request to the /testjobs resource:
-
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.
-
Set the Content type of the attachment and Media Type of the payload to application/zip.
-
Open the Auth panel.
-
Select the Basic (Built-in) authorization type.
Tip: If you use the same credentials in several requests, use authorization profiles. -
Specify user credentials and select the Authenticate pre-emptively option:
-
Send the request:
Run a test case or test suite
Use the following command line:
In this example:
-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"
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:
-
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. -
Open Projects and select the POST request to the /testjobs resource:
-
Open the Attachment panel and click Add Attachment.
-
Specify the project you want to send to TestEngine.
-
Set the Content type of the attachment and Media Type of the payload to application/xml.
-
Open the Auth panel.
-
Select the Basic (Built-in) authorization type.
Tip: If you use the same credentials in several requests, use authorization profiles. -
Specify the user credentials and select the Authenticate pre-emptively option:
-
Specify the name of the test case you want to run in the testCaseName parameter:
-
Send the request:
Run a security test
Use the following command line:
In this example:
-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%20Name"
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. |
-
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. -
Open Projects and select the POST request to the /testjobs resource:
-
Open the Attachment panel and click Add Attachment.
-
Specify the project you want to send to TestEngine.
-
Set the Content type of the attachment and Media Type of the payload to application/xml.
-
Open the Auth panel.
-
Select the Basic (Built-in) authorization type.
Tip: If you use the same credentials in several requests, use authorization profiles. -
Specify the user credentials and select the Authenticate pre-emptively option:
-
Specify the name of the security test you want to run in the testCaseName parameter:
-
Send the request:
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/
The address and port of your TestEngine installation.