Onur Demir

08/07/2019

SAP TM Test Automation using SOAP UI

Testing is a crucial and time-consuming process for every SAP project. Automatedtesting saves time and cost for the project and significantly improves the quality of the testing. It enables users to do more exploratory testing. Web service automation tests will also help when interface design is under development and therefore downstream processes can be tested using SOAP UI. SOAP UI web service automation is easy to configure and execute web services. This article will cover how to setup and execute automated tests for SAP TM web services using SOAP UI. Forwarding order creation web service (TransportationRequestReqest_In) will be used as an example.

Prerequisites:

SOA Manager should be configured already. For more information, see SAP Documentation.

There will be three parts to test SAP TM with SOAP UI:

  1. Setting up SAP TM web service and create WSDL file
  2. Setting up SOAP and running first web service in SAP TM
  3. Mass Creation of Forwarding Orders (FWOs)

Part I - Setting up SAP TM Web Service and create WSDL file

Step 1)
Firstly, a binding should be created from SAP TM. From SAP TM GUI, the transaction SOAMANAGER should be called. After the web screen pops up, Web Service Configuration under Service Administration should be selected.

Step 2)
Since we will use TransportationRequestReqest_In to create the order, we need to search and find the relevant service.

Step 3)
After clicking the service, Create Service Button should be clicked. Name the service and its binding and click next and follow the easy steps and finish setting up the web service.

Step 4)
As we can see new binding, we need to create WSDL to integrate with SOAP:

Part II – Setting up SOAP and running first web service in SAP TM

Step 1)
After downloading SOAP UI (current version is 5.5.0) it needs to be integrated with SAP TM using WSDL file that we have created in Part I.

Step 2)
After creating New SOAP Project (Ctrl+N) following screen should appear. We need to paste the WSDL URL to the Initial WSDL textbox.

Step 3)
Now we can create a new SOAP Request by right clicking on the request.

Step 4)
Since new request will contain all possible fields in TransportationRequestRequest_In service, accurate XML files can be found in SXMB_MONI transaction.

Step 5)
Username and password should be entered to properties pane in SOAP.

Below please find an example:

Step 6)
Now you are ready to test. You can use SRT_UTIL transaction to track the reasons of errors of the XML in SAP TM.

For more information for TransportationRequestRequest_In, you can see SAP note 2474566.

Step 7)
After solving all the problems, the web service should produce an FWO in SAP TM. You cannot see any response from SOAP for this service. Another thing to mention is that every BaseBusinessTransactionDocumentReference should be different for each FWO.

Part III – Mass Creation of FWOs:

SOAP UI has a powerful testing tool for web service testing and automation. However, in order to create mass FWOs using web services, we need to use SOAP UI PRO to retrieve external data and integrate them into web service. If you want to use SOAP UI free version, you need to use Groovy scripting.

Step 1)
Firstly, we need to create a Test Suite on SOAP PRO by right clicking on the project:

Step 2)
We need to create new test case by right clicking on the test suite.

Basically, when we right click on TestCase, three steps are required to create a system for mass FWO:

  1. Data Source
  2. SOAP Service
  3. Data Source Loop

Step 3)
Firstly, we need to configure the data source:

Data source can be addressed as excel file, but it can be different. Properties’ names should be same as excel file columns. After locating the file and adding properties, data can be imported by pressing green arrow button on top left. Starting cell should be A2 if your spreadsheet has a header.

You can see the Excel file screenshot below:

Step 4)
After we import the excel data to SOAP, we can configure the working web service. The easiest way to configure web service is using form tabs inside the SOAP Request. When we right click on the relevant field, we can address the data with the excel fields. Here ID data will be addressed.

Step 5)
We can see the field is replaced by a code ${DataSource#ID}

Step 6)
After applying all fields, test case and mass FWO creation is ready to use. Please find actual FWO screenshot below.

As you can see, SAP TM web services can be triggered and tested using SOAP UI in a very convenient way.

We have shown TransportationRequestReqest_In service as an example; however, any custom SAP TM web service or different services such as TransportationOrderGenericRequest, TransportationRequestQuotationCreateRequest etc. can be used in SAP TM. You need to check your S/4 Hana version to make sure you can use the web service. It is also possible to create a SOAP Test Suite that covers all web service tests within SAP TM project. By implementing SOAP TestSuites, you can increase your test coverage in your automated tests and improve your overall quality of the web service tests in SAP TM implementations.