This SOATest Tutorial Explains How to Create a Project or .tst File in Parasoft SOATest, Major Components of a SOATest Project, and I/O Techniques:
In this tutorial, we will get into the details of SOAtest Tool which is an API Automation Tool, how we can create a sample project using this tool, what are the major components of this tool, the significance of each component along with their usage, i/o techniques and terminologies related to SOAtest.
This tutorial will provide you ample idea of how a .tst file/project is built for API automation.
List Of Tutorials In This SOAtest Series.
What You Will Learn:
- What Is SOAtest Tool?
- I/O Techniques
- Important Terminologies
What Is SOAtest Tool?
Parasoft SOAtest is a Web API Automation tool that makes use of two services i.e. SOAP and REST to perform Functional, Regression, Unit Testing, Runtime error detection, static code analysis, service virtualization and so on.
Creating a Project in SOAtest
Pre-requisite: Don’t forget to import the necessary .jar files.
Right-click on your project –> Properties –> System Properties –> Add Jars.
Steps to Create a New Project Using SOAtest
#1) Click on File menu -> New -> Project from Existing SOAtest -> Select a Wizard -> SOAtest -> Empty project. (A new project will be created with a default .tst file (this file will have the same name as your project))
#2) Right-click on your project -> Add New -> Test Suite (This is the test suite which will contain your actual test. Each test can be either SOAP or REST client). By default, one Test Suite is already created at the scenario level.
This is the scenario level Test Suite where you can write about the requirements as an important note. You can also, provide the executable options like Test runs as a group or concurrently.
#3) Right Click on your Test Suite -> Add New-> Test->SOAP client or REST client.
#4) Right-click on your scenario -> Add new -> Data Source -> Excel/Writable Data Source.
#5) Right-click on your Environment -> New Environment -> Declare your global variables.
Your entire Test Suite will look like the image below:
Major Components of SOAtest Project
Below are the major hierarchical components that every SOAtest project must have to carry out a simple operation.
#1) Project (Example)
It contains the name that is given when you create your project which contains the .tst file that has all the project components. It can be viewed as the topmost test suite which has your executable file.
When you click on the empty SOAtest project, a (.tst) file will appear.
Refer the below screenshot where an empty project “Example” was created inside which a file called “Example.tst” was automatically created.
#2) tst File (Example.tst)
It is the executable file that contains all the test suites, tests, an environment variable, methods, data source, traffic object, etc. This file is the nucleus of your project. It is created automatically after you create your project and it has the same name as the project.
#3) Test Suite (Scenario: Test Suite)
It is the folder that is inside your .tst file and contains the executable tests, data source, environment variable. To create a Test Suite just right click on your .tst file and click on Add and then Test Suite (.tst –> Add –> Test Suite).
It is responsible for the execution mode (sequential execution or concurrent), test flow logic (method execution in a chronological manner), declaring any test variable which will be used in parameterization. Moreover, in this section, you can define your requirements for testing.
It is a folder that contains your environment variable inside which you can declare the global variables to be used in your test execution.
Right-Click on Environment –> New Environment –> Start Declaring Variables.
#5) Data Source
In case you are going to read or write data from an external data source like Excel or Writable Data, then you can create a Data Source for it. Right-click on your test suite followed by a new data source. It will ask you for the path of your excel (.xls or .xlsx) and all the sheets will appear with the columns of the excel.
In case you want to write your output then go for writable data. It will provide you with several options like writing the output after each iteration or after complete execution. You can append (add to the previous execution) or overwrite/replace the data after each run.
#6) Test (Test1: Messaging Client)
It is the operational component that contains the major component of your request. You can either use SOAP or REST client depending on what services you are going to use in your suite. Let’s say if you are going to use REST then URL, method, request body, HTTP headers will be declared in this section.
#7) Traffic Viewer
It is the component that facilitates you to see the request which you have passed in your test execution and the respective response for each test case. It has a request body, response body, tokens, HTTP response code, HTTP version, etc.
#8) Other Components
SOAtest supports other components like Quality Tasks and Console for debugging purposes so that you can easily analyze where your test is failing. Click on the Window button at the top of the Parasoft menu bar and then click on show preferences and add console or quality tasks.
In the below diagram, only one test is executed (1/1 Tests Succeeded) thus, the quality task is empty and the console will have only one test with the status as a success.
The traffic viewer plays a very significant role while dealing with Input and Output Techniques. Whatever you pass as a request in your SOAP or REST client, will be shown in the traffic viewer object under the request part of the traffic and the response sent from the service will be shown under the response section.
Five major components are necessary for any type of request.
Let’s take an example of REST:
#1) Resource: This contains the URL, context or document key that are being passed in the request.
#2) Method/Verbs: Verbs that are being used in the request, such as GET, PUT or POST.
#3) Payload: This forms the body of the document. It is usually in JSON format and is used to see what has been passed in the request body. The response will be shown based on that.
#4) HTTP Headers: This has three components i.e. Content-Type, Authorization, and Authentication. Authentication decides the format in which your response will be provided. Authorization allows you to pass any token value.
There are three types of tokens used i.e. oAuth (Prefixed by Bearer tokenValue), SAML (Prefixed by SAML tokenValue) and CSK3 (Prefixed by CSK tokenValue).
#5) Response Code: This is the HTTP response code (status code) such as 200 for success, 400 and 500 for failure.
Authentication: It is a component that will let us know that a particular user is authenticated or valid to access the resources.
Authorization: It is a component that indicates that a particular authenticated user is authorized to use a particular resource or not.
Verification: It is a process of verifying the data sources, payload format, resources and all other things except code which constitute the request body. A simple phrase that is commonly used to denote the verify process is “are we building it right”.
Validation: It is the process of validating the actual vs expected response. A simple phrase which is commonly used to denote the verify process is “are we building the right thing”. Assertions and coding are involved in this process.
In this tutorial, we saw how to create a project or .tst file in Parasoft, major components with their roles and usage, i/o techniques along with some of the important terminologies. This, in turn, will help you in building your own SOAtest suite and you can execute on your own from scratch.
The upcoming tutorial will focus on assertions, their types, assert vs verify, along with few other components of SOAtest like JSON and XML databank, their usage, SQL vs Mongo DB, API vs UI vs Unit Testing. After exploring these topics, you can go ahead and design your suite and automate the API.