Applies to ReadyAPI 2.2, last modified on November 17, 2017

Now that your project contains a configured virt, you can start and test it.

Starting a Virt

You can run virts on your computer or on other machines in your network. To run on other machines, you install VirtServer on them (see Running Virts).

In this tutorial, let’s run the virt on your computer. To do this, click Run in the virt editor:

Service virtualization and API testing: Running a virt

Click the image to enlarge it.

Note: It is prohibited to run several web servers or services on the same port. If you already have some other web service or web server working on the port, on which your virt is working, the run will fail. Change the virt port and try starting the virt again.

Also, if you run a virtual service that uses request routing, you can run only one service at a time in ReadyAPI. You can run multiple virtual services that use request routing on a remote computer that has VirtServer installed.

Creating Test Request

After your virt started, we can send requests to it.

  1. Select the virt in the Navigator panel to view the virt properties, and copy the value of the Virt URL field:

    Service virtualization and API testing: Copying the virt URL

    Click the image to enlarge it.

  2. Switch to Projects. When you added an operation to your virt, ReadyAPI automatically generated an API specification for your virt and added the operation to that specification:

    Service virtualization and API testing: Operations in the Navigator panel

    Click the image to enlarge it.

  3. Open the request editor and specify the endpoint your virt uses (http://localhost:8088/ in our case):

    Service virtualization and API testing: Setting the endpoint

    Click the image to enlarge it.

  4. Now, we need to specify request parameters. To do this, click and enter data in the table. Add the following two parameters:

    Name Value Style Level
    response_type code QUERY RESOURCE
    client_id 12345 QUERY RESOURCE

    Here is what the editor looks like now –

    Service virtualization and API testing: Request parameters

    Click the image to enlarge it.

Running Test Request

  1. To simulate a request, click Run in the request editor.

    The virt will process the request. You will see the LoginSuccess response contents in the editor:

    Service virtualization and API testing: Running test request

    Click the image to enlarge it.

  2. Change the client_id parameter to some other value and run the request again. The virt dispatcher will choose the LoginFailed response:

    Service virtualization and API testing: Test results

    Click the image to enlarge it.

In the request editor, you can check if your virt works as expected, check the request parameters and the response contents. You can also see the request and editors on the Transaction Log page in ServiceV:

  • Jump to ServiceV, select your virt in the Navigator panel and switch to the Transaction Log page of the virt editor.

    Service virtualization and API testing: Transaction Log page

    Click the image to enlarge it.

  • Each row on the page corresponds to a transaction, that is, to the request-response pair.

    To view contents of a request or response, simply select this request or response on the page. You will see the contents on the right (see the image above).

After you send requests and see results, stop the virt. To do this, simply click Stop in the virt editor.

Prev          Next

See Also

Creating Your First Virtual Service