Index Page

Sunday, 12 April 2020

Property Transfer in SOAP UI tool.

From property transfer, we can grab the Property from source and we can pass it on Target.
Property transfer we use to transfer the data between requests.

1. Right-click on TestStep > Add Step > Property Transfer. 



2. Enter the name of the Property Transfer. You can choose any customized name.



3. 
a. Go to TestCase level custom property.
b. Click on the plus icon and give the name of the employee > save the project.
c. Go to custom property > Click on the plus icon > Enter any name > In the source select Response,> write the path of the employee name as per the below image.
d. In the Target > Select the TestCase name > Select CustomProperty which we have created in step a.
e. Execute the property transfer > Go to Test Case level Custom Property > check name should save successfully.


Real-Time Example of Property Transfer Concept -

a. If any value got created in the response and we want to use that value in some another Test Step
request, then we use the Property Transfer concept.
b. From the response, if we want to store the data inside the custom property.


Interview Question from this Page:

a. What the use of Property Transfer in the SOAP UI tool?
b. How many ways you can use Property Transfer in the SOAP UI tool?

Saturday, 11 April 2020

Add Custom Property in Project, TestSuite, TestCase and TestStep Level in SOAPUI tool.

Add Custom Property in Project, TestSuite, TestCase and TestStep Level in SOAPUI tool.


We can add custom properties in Project, TestSuite, TestCase and TestStep Level in SOAPUI tool.

Why we add Custom Property?

In API automation custom property pay the important role, suppose we want to use some data in the entire project like DataBase details, Server URL then we will store information at the Project level.
That means which data we want to use globally we will store in the Project level custom Property.


1. Add Custom Property in Project Level:

a. Click on Project > Go to Custom Property > Click on plus icon > enter Department name.
b. In the add employee request body replace IT with ${#Project#department} as per the below image.
note - 
If we want to use Custom Property in our body then we write the following syntax:
${#PropertLevel i.e. ProjectORTestSuiteORTestCase#CustomPropertName}



2. Add Custom Property in TestSuite Level:

a. Click on TestSuite > Go to Custom Property > Click on plus icon > enter id.
b. In the add employee request body replace id with ${#TestSuite#id} as per the below image.




3. Add Custom Property in TestCase Level:

a. Click on TestCase > Go to Custom Property > Click on plus icon > enter age.
b. In the add employee request body replace age with ${#TestSuite#id} as per the below image.


4. Add Custom Property in TestStep Level:


a. Right-click on TestStep > Select Properties > Enter Properties name.

b. Open new added Properties > Enter employeeName name inside the new create Properties as per the below image.

c. In the add employee request body replace employeeName with ${Properties#employeeName} as per the below image.









Interview Questions from this Page:

a. How to add Custom Property in Project, TestSuite, TestCase and TestStep Level in SOAPUI tool?
b.
Q. We don’t have # keyword at start why in properties?

A. Because, Properties is not a generic keyword. Test Suite, Test Cases are the generic keywords that’s why we use #.


Wednesday, 8 April 2020

What are the SOAP UI XPath Assertions?

What are the SOAP UI XPath Assertions?

With the help of Xpath, we can traverse to the particular node in the XML.

Ex. – 

XPATH is like a delivery address. Assuming age, department, id, and name are 4 homes in the city called XML. If you want to go to each and every home you need correct unique address Xpath [Unique address of that node].

The same way we have to write unique Xpath to reach that node and then we can extract value from it.

In the below screen age is one node, id is another node.


Let see how we can add the XPath assertions:

Step1: 
Go to Add Assertion > Property Content > Xpath Match.
Click on the Declare button.
Start writing XPath from the root nodes.
At last click on the Select From current > Test link to validate the response.






Some pre defines functions to find the XPath:

exists –
By using exists function, we can check whether the tag is present in the response or not.
We write true/false value in it to check the existence.

Steps1:
Go to Add Assertion > Property Content > Xpath Match.
Click on the Declare button.
Start writing XPath from the root nodes and use the exists method.
At last click on the Select From current > Test link to validate the response.


Count:
By using Count function we will check the number of counts present in the response.



Suppose if we want to get all the notes present in the XPath Match then:
Write Parent node > Select From current > Test


In some cases, suppose id value is getting change continuously, in that case, we will write * in place of id and we will click on checkbox ‘Allow Wildcards’.



Interview Questions from this Page:


a. Suppose id is kept on changing then how you will handle.
b. How we can use Xpath functions.

How to do Assertions in the SOAPUI tool?

How to do Assertions in the SOAPUI tool?


In test automation, the assertion is the validation step that determines whether the automated test case succeeded or not. If the assertion step fails, then in the Test Report we will get all the assertion failures.


Note - 
a. Below mentioned assertions we can user in both restful APIs or in Web Services APIs.
b. Following assertion can be performed in POST, GET, EDIT and DELETE methods as per assertion needs.

1. Verify HTTP Status Codes: 

To verify API is giving the expected response code or not.

Open Test  Step > Click on assertion plus icon as per below image > Compliance, Status, and Standards > Valid HTTP Status Codes.




 Enter the expected Response Code.



2. Invalid HTTP Status Codes:

Suppose we want to test a negative API scenario then we can use this exception by entering invalid status code.


  Enter the invalid Response Code.




3. Contains:

Verify Response is returning True. Any value which we want to verify in the response we can enter inside the Contains.

Use Path same as above mentioned steps, just click on the highlighted value i.e. Contains.





4. Not Contains:

Verify Response not having null or False Value.
If we want to check response not contains false then we can use Not Contains assertion. Any other value which we do not want in our response can we enter in this assertion.






5. SOAP Response:

If we want to verify, Response is a valid SOAP response or not then we will use 'SOAP Response' assertion. It will scan and say whether it is a valid SOAP response or not.






6. Response SLA:

This assertion is very useful, we use this assertion to check how much time API is taking to execute. 
If we are running our API and it is taking 30 secs to 45 seconds to give the response then there is some problem with API. The results should be instant within 1 to 2 secs.




In below screen API is taking too much time to execute and we have set expected time of API response 1000 ms [i.e. 1 sec] that's why the assertion is getting failed.
1000 ms = 1 second



7. Sensitive Information Exposure:

This assertion we use to check our sensitive information is not getting disclosed. 

If we have used this assertion and sensitive data is used in assertion we will get assertion failure.




As per the below screen, 'employeeAccountNumber' is not fetched in the response that's why an assertion is getting Passed.



All the above 7 steps we have executed in the POST API method, in the following screen we have executed all assertions in GET method as I already mentioned at the starting in the note POSTGETEDIT and DELETE methods can use assertions as per testing needs.





In the next blogs, we will learn, how to do the XPath assertion.

Interview Question from this Page:

a. What is the use of the following assertions, please explain?

1. Verify HTTP Status Codes
2. Invalid HTTP Status Codes
3. Contains
4. Not Contains
5. SOAP Response
6. Response SLA
7. Sensitive Information Exposure


How many ways we can run API in SOAPUI tool?

How many ways we can run API in the SOAPUI tool?


In SOAPUI tool we can run API in three ways:
1. From Project Level.
2. From Test Suite Level.
3. From Test Case Level.


1. From Project Level:


If there are multiple TestSuite and we want to run all TestSuites in a single click then we run the project from Project Level.

Double click on Project > TestSuites > Run.


2. From TestSuites Level:


If there are multiple TestCases and we want to run all TestCases in a single click then we run the TestSuite from TestSuite Level.

Double click on TestSuites > Run.



3. From TestCase Level:


If there are multiple TestSteps and we want to run all TestSteps in a single click then we run the TestCases from TestCases Level.

Double click on TestCases > Run.





Monday, 6 April 2020

How to create a RESTfull API Project?

In this section, we will learn how to create a RESTfull API Project and about RESTfull API Parameters:

We have already talked about RESTfull APIs definitions now in this blog we will see how we can create a RESTfull API project:

Step1:  Go to SOAPUI tool and File > New REST Project or In Icon Toolbar click on 'REST'.







Step2: In google search "sample rest API employee API" as per below images and copy highlighted URLs:





Step3: Enter the copied URL in the URI path and click on the OK button.



Step4: After performing Step 3 one new project will create. Right-click on newly created project > click on 'New REST Service from URI'.



Step 5:  Enter the second copied URL.



Step 6: As per below images create new 'TestSuite', 'TestCase', 'TestStep'.









Step 7: Run both TestSteps which we have imported.





The key principles of REST APIs:

a. In Step7 we have added Query Parameter 'countryName'. In the rest API, we pass BaseURL, Resource, and Parameters with RESTfull API URL.

Example -

Base URL – www.google.com
Resource – search
Parameter - q=soap , rlz=1C1GCEU_enIN821IN821

Resources are separated by ?
Parameters are separated by &


Interview Question from this Page:

Interview Question from this Page:

a. What is Endpoint?
Answer - It is the Ip address of the Server where Webservice is running.

b. What  methods does REST Support?
Answer - GET, POST, DELETE, and PUT

c. What is Swagger?

Answer - Swagger we use for API documentation. Lot of good product companies use Swagger. We can say it is technical documentation.

In swagger we can Hit the API by TryOut this is the good advantage of Swagger tool.


Saturday, 4 April 2020

About CRUD operation and how we can perform CRUD operation by API?

CRUD meaning:


C - Create - POST

R - Retrieve - GET

U - Update - PUT
D - Delete - Delete

In the last article, we have seen, how to create new TestSuite, TestCase, and TestStep. We have added one new employee by executing the POST API request.

Now we will execute a GET API call to fetch employee and employee details by following steps.

GET API Steps:

Step1:  To create GET TestStep within the TestCase right-click on the Test Steps > Add Step > SOAP Request.


Step2: Enter Valid TestStep name.


Step3: Select the GET request. Click on the Ok button.


Step4: Enter valid employee name and run the request.



DELETE API Steps:

For DELETE API, we will execute Step 1 to Step 3 but this time we will select DELETE request.

Step 5: Add the DELETE employee test step.




Step 6: Execute DELTE API.



Interview Questions from this Page:

1. What is the CRUD APIs?
2. What is the full form of CRUD APIs?