To run a test, you need to send a REST request containing your ReadyAPI project to TestEngine. You can do that by using any tool that allows sending REST requests, for example, ReadyAPI, Swagger Inspector or curl. In this tutorial, we will show you how to send a request via curl.
1. Get a ReadyAPI project
You can send a ReadyAPI project as an .xml file or as a .zip archive. A .zip archive can contain external files required for the project: data sources, attachments, certificates and so on. This tutorial shows how to use an .xml file. To learn how to send a .zip archive, see Run Tests.
Suppose, you already have a ReadyAPI project that you want to run. If you don't, go through the functional test tutorial to create a simple functional test and then save the project.
2. Send a request
To send a request, use the following curl command:
In this example:
-u user:password
--data-binary "@C:\Work\Test\sample-readyapi-project.xml"
If you don't add an "@" before the ReadyAPI project path, you will get the following error:
code":400,"message":"The supplied file is not a valid ReadyAPI project".
|
-H "Content-Type: application/xml"
-X POST
"http://localhost:8080/api/v1/testjobs"
When TestEngine receives the request, it will create a new test job. A test job represents a particular test run in TestEngine. The TestEngine response contains the report of the created test job. The status of the newly created test job is, most probably, RUNNING or QUEUED. Later, you'll be able to get the updated test job report. To do that, you will need the testjobid element that contains the ID of the created testjob.
In the next step, we will get the updated test job report and analyze it.
Automatic test runs
This tutorial explains how to run tests in TestEngine manually.
In real life, you will most probably run tests automatically from your CI/CD systems. To do that, you can run a curl command like you use for manual test runs.
If you use Jenkins, you can also use the TestEngine plugin. To learn more about it, see Run Tests in TestEngine Using Jenkins.