Creating a project
Before you begin
- You must have closed HCL Quality Server sessions that are running if any.
- If HCL OneTest™ API is running and you have just completed the tasks in Creating and running a test, you probably have that project open. To create and run a stub with an HTTP/TCP Proxy, you must create a new project. Therefore, you must close the existing project by clicking . This action closes the project and restarts HCL OneTest™ API.
About this task
After you restart HCL OneTest™ API, you must create a new project, provide a name for your project and save it on your local drive. The following instructions are applicable for the Windows OS.
Procedure
Results
What to do next
You must start the Add Numbers server and client. See Starting Add Numbers server and client.
Starting Add Numbers server and client
Before you begin
You must have created a project as described in Creating a project. Your project must be open in HCL OneTest™ API.
About this task
HCL OneTest™ API contains some example APIs. In this example, you use AddNumbers, which has a WSDL document describing the API.
If you want to model a system that does not have a WSDL definition, you can use a Swagger file instead. See Creating and running a test.
Procedure
Results
You have successfully tested a web service hosted on your local system by using the sample WSDL.
What to do next
You must configure the client to use the created stub. See Configuring the Add Numbers client to use the stub (virtual service).
Configuring the Add Numbers client to use the stub (virtual service)
Before you begin
You must have completed creating the stub and run it.
About this task
To support HCL OneTest™ API Service Virtualization, you must configure HTTP clients to use the HCL OneTest™ API HTTP/TCP Proxy. You must configure the Add Numbers client application to use the HCL OneTest™ API proxy by using the standard Java proxy settings.
Procedure
Results
You have successfully configured the Add Numbers client to use the stub.
What to do next
You must verify if the Add Numbers client application is using the HTTP proxy. See Verifying that the Add Numbers client is sending traffic through the proxy.
Verifying that the Add Numbers client is sending traffic through the proxy
Before you begin
The Add Numbers client must be running. If it is not, go to install_location/HCLProducts/API/examples/addnumbersclient and run the startup script.
Procedure
Results
You have verified that the Add Numbers client application is using the HTTP proxy.
What to do next
You must discover the endpoints that are in use by the Add Numbers client application. See Using topology discovery to discover the endpoints in use.
Using topology discovery to discover the endpoints in use
Topology discovery is the process of observing and modeling the components of a system under test by using only real traffic that flows through the system. You can view the resources that the system calls and choose the ones to include in the system model within your project. You then use this model to make detailed recordings of interactions and create tests and virtual services from those recordings. Topology discovery, recording, and service virtualization all require the HTTP proxy. Therefore, if you configure the HTTP proxy for the client for any one of these tasks, you need not do anything separately for the other tasks.
Procedure
Results
You have discovered the endpoints used by the HTTP proxy when running the Add Numbers client application.
What to do next
You must record an operation for a message-based stub for the Add Numbers client application. See Recording an operation.
Recording an operation
Before you begin
You must have completed discovering of the HTTP proxy endpoints.
About this task
You can record the traffic that is going through the proxy to and from the Add Numbers server and use the recorded messages to create a stub, which provides a virtual Add Numbers service.
At this stage, the Logical View of the Architecture School perspective shows the component named AddNumbers containing an operation named Add, along with an HTTP transport.
Procedure
Results
You have recorded requests and responses from the Add Numbers server and used them to create a stub that can listen to the request for one of the operations you recorded and returns the result that you recorded from the server for that request.
What to do next
You can verify if the client receives responses from the stub when the server application is disabled. See Disabling the server application and verifying that the client receives response from the stub.
Disabling the server application and verifying that the client receives response from the stub
About this task
Procedure
Results
You have successfully created, run, and verified a virtual service (message-based stub) that uses an HTTP proxy as a transport for messages.
What to do next
- To control what requests the stub must respond to, you can use the stub editor’s Input tab and The Field Editor. For instructions, see Input tab.
- To control how the stub constructs responses, you can use the stub editors Activity tab and The Field Editor. For instructions, see Activity tab.