This article is a follow-up to a previous blog post, where I deep-dived into the topic of API testing and explained its importance in software development. If you haven’t read the article yet, I highly recommend checking it out before proceeding with this one.
Another key feature of SAP Enterprise Continuous Testing by Tricentis (ECT) is Orchestrated Service Virtualization (OSV), which allows developers and test engineers to create virtual services that simulate real-world APIs for testing purposes.
Orchestrated Service Virtualization (OSV) enables the recording and simulation of services that are critical to your system. By simulating the behavior and interactions of services instead of relying on actual services, you can avoid potential issues that may arise due to services being offline, broken, under development, providing inaccurate test data, or incurring third-party fees.
Orchestrated Service Virtualization (OSV) is included with the licensing of SAP Enterprise Continuous Testing by Tricentis (ECT).
PROCEDURE
Step 1: Install Orchestrated Service Virtualization (OSV)
Orchestrated Service Virtualization (OSV) is not part of the standard installation package of SAP Enterprise Continuous Testing by Tricentis (ECT). It needs to be installed separately before following the steps below.
To install OSV, follow these steps:
1. Download the latest version of the OSV installation file from the Tricentis Support Portal.
2. Run the installation file and follow the installation wizard to complete the installation process.
3. Once the installation is complete, open Tricentis Tosca, open the “Options” panel, and enable the “OSV plugin”.
Step 2: Configure OSV
Now that you have installed OSV, you need to set up an environment and the service ports. Here are the steps to do so:
1. Open “OSV Monitor” application.
2. Click the “Add Environment” button to create a new OSV environment.
3. Enter a name for the environment and select the protocol you want to use (e.g., HTTP, SOAP, etc.).
4. Click the ‘Add Port’ button to add a service port to the environment.
5. Enter a name for the service port and select the service type you want to virtualize. Then configure the service port by specifying the request and response behaviors for the virtual service. Finally, click ‘Apply’ to save the environment and service port configurations.
6. Activate the environment by sliding the toggle.
Once you have set up your OSV environment and service ports, you can start creating OSV test cases and using them to simulate services during API testing.
Step 3: Create your OSV Scenarios
You can either:
Create an OSV Scenario from an existing API Test Case (step 3a)Create an OSV Scenario directly in API Scan (step 3b).
Step 3a: Create your OSV Scenarios from an existing API Test Case
Here are the steps to use OSV with an existing API Test Case:
1. Open the API Test Case you want to use for OSV.
2. Select your Test Case and select “Convert to Scenario”.
3. OSV scripts are created.
Step 3b: Create your OSV Scenarios from API Scan
Alternatively, to create a new Test Case directly from the API Scan, follow these steps:
1. Open Tricentis Tosca and select “API Scan”.
2. Prepare and execute your transactional messages with the API. Create one message for each variant you want to test.
Step 4: Deploy your OSV Scenarios
You can either:
Deploy your OSV Scenarios created from an existing API Test Case (step 4a)Deploy your OSV Scenarios created directly in API Scan (step 4b).
Step 4a: Deploy your OSV Scenarios created from an existing API Test Case
1. On Tosca Commander, Go to the “OSV” tab and click on “Connect to host”.
2. In the popup that appears, enter “localhost” for the host.
3. On the next popup, enter the name of your OSV environment, “OSV_api_stock” in this case, and click on OK.
4. Click on “Deploy”
Step 4b: Deploy your OSV Scenarios created directly from API Scan
1. Select your scenario or Folder, and click on “Scenario” button of the “OSV Export” tab
2. Add the host “localhost” and environment ( OSV_api_stock in this example) and click on OK.
3. Your message(s) have been forwarded to your OSV environment.
Step 5: Check messages activated in your environments
To check that your OSV environment is working properly, open OSV Monitor and click on “Available”. You should see your messages in the list.
Step 6: Testing the simulated service by OSV
In order to test the service simulated by OSV, you can use a tool like Postman or directly the Tosca API Scan:
Change the endpoint of your service to “http://localhost:port“. In our example, this comes to replace “https://api_stock.cfapps.eu10.hana.ondemand.com/” by “http://localhost:1234/“.
Launch the request by clicking on “Run”.
The OSV service will respond just like the actual API.
SUMMARY
In conclusion, Tosca Orchestrated Service Virtualization (OSV) is a powerful tool that enables users to create virtual services for testing purposes, allowing them to simulate real-world APIs and avoid potential issues that may arise due to services being offline or under development. In this article, we have outlined the steps to install and configure OSV, create OSV scenarios from existing API test cases or directly in OSV, deploy them, and test the simulated service.
In the upcoming article, we will discuss how to test multiple API responses using TestCaseDesign and how to manage generic responses.
Follow my profile to be notified of the next blog post. If you have any questions, please feel free to ask them in the comments section below.
This article is a follow-up to a previous blog post, where I deep-dived into the topic of API testing and explained its importance in software development. If you haven’t read the article yet, I highly recommend checking it out before proceeding with this one.Another key feature of SAP Enterprise Continuous Testing by Tricentis (ECT) is Orchestrated Service Virtualization (OSV), which allows developers and test engineers to create virtual services that simulate real-world APIs for testing purposes.Orchestrated Service Virtualization (OSV) enables the recording and simulation of services that are critical to your system. By simulating the behavior and interactions of services instead of relying on actual services, you can avoid potential issues that may arise due to services being offline, broken, under development, providing inaccurate test data, or incurring third-party fees.Orchestrated Service Virtualization (OSV) is included with the licensing of SAP Enterprise Continuous Testing by Tricentis (ECT).PROCEDUREStep 1: Install Orchestrated Service Virtualization (OSV)Orchestrated Service Virtualization (OSV) is not part of the standard installation package of SAP Enterprise Continuous Testing by Tricentis (ECT). It needs to be installed separately before following the steps below.To install OSV, follow these steps:1. Download the latest version of the OSV installation file from the Tricentis Support Portal.2. Run the installation file and follow the installation wizard to complete the installation process.3. Once the installation is complete, open Tricentis Tosca, open the “Options” panel, and enable the “OSV plugin”.Step 2: Configure OSVNow that you have installed OSV, you need to set up an environment and the service ports. Here are the steps to do so:1. Open “OSV Monitor” application.2. Click the “Add Environment” button to create a new OSV environment.3. Enter a name for the environment and select the protocol you want to use (e.g., HTTP, SOAP, etc.).4. Click the ‘Add Port’ button to add a service port to the environment.5. Enter a name for the service port and select the service type you want to virtualize. Then configure the service port by specifying the request and response behaviors for the virtual service. Finally, click ‘Apply’ to save the environment and service port configurations.6. Activate the environment by sliding the toggle.Once you have set up your OSV environment and service ports, you can start creating OSV test cases and using them to simulate services during API testing.Step 3: Create your OSV Scenarios You can either:Create an OSV Scenario from an existing API Test Case (step 3a)Create an OSV Scenario directly in API Scan (step 3b).Step 3a: Create your OSV Scenarios from an existing API Test CaseHere are the steps to use OSV with an existing API Test Case:1. Open the API Test Case you want to use for OSV.2. Select your Test Case and select “Convert to Scenario”. 3. OSV scripts are created.Step 3b: Create your OSV Scenarios from API ScanAlternatively, to create a new Test Case directly from the API Scan, follow these steps:1. Open Tricentis Tosca and select “API Scan”.2. Prepare and execute your transactional messages with the API. Create one message for each variant you want to test.Step 4: Deploy your OSV Scenarios You can either:Deploy your OSV Scenarios created from an existing API Test Case (step 4a)Deploy your OSV Scenarios created directly in API Scan (step 4b).Step 4a: Deploy your OSV Scenarios created from an existing API Test Case1. On Tosca Commander, Go to the “OSV” tab and click on “Connect to host”. 2. In the popup that appears, enter “localhost” for the host.3. On the next popup, enter the name of your OSV environment, “OSV_api_stock” in this case, and click on OK.4. Click on “Deploy”Step 4b: Deploy your OSV Scenarios created directly from API Scan1. Select your scenario or Folder, and click on “Scenario” button of the “OSV Export” tab2. Add the host “localhost” and environment ( OSV_api_stock in this example) and click on OK.3. Your message(s) have been forwarded to your OSV environment.Step 5: Check messages activated in your environmentsTo check that your OSV environment is working properly, open OSV Monitor and click on “Available”. You should see your messages in the list.Step 6: Testing the simulated service by OSVIn order to test the service simulated by OSV, you can use a tool like Postman or directly the Tosca API Scan:Change the endpoint of your service to “http://localhost:port”. In our example, this comes to replace “https://api_stock.cfapps.eu10.hana.ondemand.com/” by “http://localhost:1234/”.Launch the request by clicking on “Run”.The OSV service will respond just like the actual API.SUMMARY In conclusion, Tosca Orchestrated Service Virtualization (OSV) is a powerful tool that enables users to create virtual services for testing purposes, allowing them to simulate real-world APIs and avoid potential issues that may arise due to services being offline or under development. In this article, we have outlined the steps to install and configure OSV, create OSV scenarios from existing API test cases or directly in OSV, deploy them, and test the simulated service.In the upcoming article, we will discuss how to test multiple API responses using TestCaseDesign and how to manage generic responses.Follow my profile to be notified of the next blog post. If you have any questions, please feel free to ask them in the comments section below. Read More Technology Blogs by SAP articles
#SAP
#SAPTechnologyblog
+ There are no comments
Add yours