18/12/2023
Agenda:
- What is Web Service?
- Basic Concept behind web service
- Why we use it?
- Why to test it?
Project Application:
- Front End(UI)
- Backend(Database)
- Service(API’s)
Web Service:
- Service available over the web(Internet)
- Waiter: Who is doing communication between you and kitchen
- Waiter: Waiter is performing the role of web service through an API
- We can say he(Waiter) is communicating between two applications and making sure that
the communication between two applications is proper.
Waiter (API)
You (Service Kitchen (Chef)(Service
Consumer) Provider)
Web Service:
- Service available over the web
- Enables communication between applications over the web
- Platform independent communication
- Provides a standard protocol/format for communication
- Using web services two different applications can talk to each other and exchange
data/information
- An API Stands for Application Programming Interface, which is a software intermediary
that allows two applications to talk to each other.
- Each time you use an APP like Facebook, Send instant message to check weather on your
phone, each time you are using an API.
- Web Service/API is an Application or business Logic
- Web Service/API allows you to expose the functionality of your existing code over the
network. Once it is exposed on the network, other applications can use the functionality
of your program.
What is API?
User Layer or Business Layer (API) Database Layer
Presentation Layer
Request
Client (Service Server (Service
Consumer) Provider)
Response
19/12/2023:
Medium: HTTP
Format/language: XML/JSON
UI: JS,Angular,ReactJS
API: Java,C#
Backend: MySQL,Oracle,SQL
Agenda: Types of Web Services
Types of Web Services:
- SOAP Service(Simple Object Access Protocol): XML Language
- REST Service(Representational State Transfer): JSON Language
API Testing-
2 Types Service
1. SOAP service(SOAP UI tool)
2. REST service(SOAP UI,POSTMAN)
Manual Testing: Postman,JMeter,Load Runner,SOAP UI
API Automation: Rest Assured=>Tool=>Java Library
Request
Paytm – UI/ GUI Service Travels- Travels agency/ IRCTC/Travels/
Parameter Provide-Service/ Flights main Server
Values
IRCTC - Service
Response
21/12/2023:
Agenda: Testing REST Service using POSTMAN Tool: GET Method/Service
Testing REST Service using POSTMAN Tool: https://www.postman.com/downloads/
What is Collection?
Ans: Group of requests grouped into folder
GET List of Users:
Returns list of users based on the query parameters
The Endpoint is secured by authentication Policy and requires authentication token
Endpoint: Base URL/Domain/Endpoint – https://reqres.in
URI- https://reqres.in/api/users?page=2
Request Headers:
Header Name Required/Optional Description
Accept Required Application/json: it will accept
request and response in JSON
Content-Type Required Application/json: content of
request and response in JSON
Authorization Required Required basic auth/API
Key/Bearer token
Query Parameters:
Parameter Name Data Type Required/Optional Description
Page Int Required It will fetch the
specific page records
Invoking the Operations:
Operation URLs and Environments:
Environment Method URL
DEV GET https://reqresdev.in/api/users?page=2
INT(Integration or SIT) GET https://reqresint.in/api/users?page=2
UAT GET https://reqresuat.in/api/users?page=2
PRE-PROD GET https://reqrespreprod.in/api/users?page=2
PROD GET https://reqres.in/api/users?page=2
Request Body:
Not required for this operation
Response Attributes/tagnames:
Attribute Name Data Types Comment
page int
per_page int
total int
total_pages int
Data String
Id Int
email String
first_name String
last_name String
avatar String
Response Examle:
{
"page": 2,
"per_page": 6,
"total": 12,
"total_pages": 2,
"data": [
"id": 7,
"email": "michael.lawson@reqres.in",
"first_name": "Michael",
"last_name": "Lawson",
" ": "https://reqres.in/img/faces/7-image.jpg"
},
"id": 8,
"email": "lindsay.ferguson@reqres.in",
"first_name": "Lindsay",
"last_name": "Ferguson",
"avatar": "https://reqres.in/img/faces/8-image.jpg"
},
{
"id": 9,
"email": "tobias.funke@reqres.in",
"first_name": "Tobias",
"last_name": "Funke",
"avatar": "https://reqres.in/img/faces/9-image.jpg"
},
"id": 10,
"email": "byron.fields@reqres.in",
"first_name": "Byron",
"last_name": "Fields",
"avatar": "https://reqres.in/img/faces/10-image.jpg"
},
"id": 11,
"email": "george.edwards@reqres.in",
"first_name": "George",
"last_name": "Edwards",
"avatar": "https://reqres.in/img/faces/11-image.jpg"
},
"id": 12,
"email": "rachel.howell@reqres.in",
"first_name": "Rachel",
"last_name": "Howell",
"avatar": "https://reqres.in/img/faces/12-image.jpg"
],
"support": {
"url": "https://reqres.in/#support-heading",
"text": "To keep ReqRes free, contributions towards server costs are
appreciated!"
}
}
GET Method Service:
- GET Method Service URL/URI= https://reqres.in/api/users?page=2
- Username & Password(Basic Auth)/API Key/Bearer Token—sjfefdsfjdbfkjbfajls
- Time taken for the response=2Secs
- Unit Testing document
Sample Response Status Code: 200
Sample Response:
"page": 2,
"per_page": 6,
"total": 12,
"total_pages": 2,
"data": [
"id": 7,
"email": "michael.lawson@reqres.in",
"first_name": "Michael",
"last_name": "Lawson",
" ": "https://reqres.in/img/faces/7-image.jpg"
},
"id": 8,
"email": "lindsay.ferguson@reqres.in",
"first_name": "Lindsay",
"last_name": "Ferguson",
"avatar": "https://reqres.in/img/faces/8-image.jpg"
},
"id": 9,
"email": "tobias.funke@reqres.in",
"first_name": "Tobias",
"last_name": "Funke",
"avatar": "https://reqres.in/img/faces/9-image.jpg"
},
"id": 10,
"email": "byron.fields@reqres.in",
"first_name": "Byron",
"last_name": "Fields",
"avatar": "https://reqres.in/img/faces/10-image.jpg"
},
"id": 11,
"email": "george.edwards@reqres.in",
"first_name": "George",
"last_name": "Edwards",
"avatar": "https://reqres.in/img/faces/11-image.jpg"
},
"id": 12,
"email": "rachel.howell@reqres.in",
"first_name": "Rachel",
"last_name": "Howell",
"avatar": "https://reqres.in/img/faces/12-image.jpg"
],
"support": {
"url": "https://reqres.in/#support-heading",
"text": "To keep ReqRes free, contributions towards server costs are
appreciated!"
}
}
22/12/2023:
Test Cases:
1. Validating REST Response=Pass
2. Validating data and count of data in the response=Pass
3. Validating Tagnames/Attributes present in the response=>EC=Tagnames should contain
id,email,first_name,last_name,avtar=Pass
4. Validating different status code present in the response=>EC=200-OK=Pass
5. Validating time taken for the response=>5Secs=Pass
6. Applying Assertion for Verification (Validations Points)
Tests in POSTMAN:
- Test is putting Validations in your request to make sure API is working as Expected
- Request can have many validations
- Tests are written in JavaScript in Postman
- Tests can be added at Request, Collection etc.
When you go to Tests section you see some snippets
12/12/2023:
Snippets:
Status code: Code is 200:
pm.test("Expected Status code is 200", function ()
{
pm.response.to.have.status(200);
});
Response time is less than 200ms:
pm.test("Response time is less than 5000ms", functi
on () {
pm.expect(pm.response.responseTime).to.be.below
(5000);
});
Response Body: Contains String
pm.test("Body matches string", function () {
pm.expect(pm.response.text()).to.include("linds
ay.ferguson@reqres.in");
});
Response Body: Is equal to String
pm.test("Body is correct", function () {
pm.response.to.have.body({
"page": 2,
"per_page": 6,
"total": 12,
"total_pages": 2,
"data": [
"id": 7,
"email": "michael.lawson@reqres.in",
"first_name": "Michael",
"last_name": "Lawson",
"avatar": "https://reqres.in/img/
faces/7-image.jpg"
},
"id": 8,
"email": "lindsay.ferguson@reqres.in",
"first_name": "Lindsay",
"last_name": "Ferguson",
"avatar": "https://reqres.in/img/
faces/8-image.jpg"
},
"id": 9,
"email": "tobias.funke@reqres.in",
"first_name": "Tobias",
"last_name": "Funke",
"avatar": "https://reqres.in/img/
faces/9-image.jpg"
},
{
"id": 10,
"email": "byron.fields@reqres.in",
"first_name": "Byron",
"last_name": "Fields",
"avatar": "https://reqres.in/img/
faces/10-image.jpg"
},
"id": 11,
"email": "george.edwards@reqres.in",
"first_name": "George",
"last_name": "Edwards",
"avatar": "https://reqres.in/img/
faces/11-image.jpg"
},
"id": 12,
"email": "rachel.howell@reqres.in",
"first_name": "Rachel",
"last_name": "Howell",
"avatar": "https://reqres.in/img/
faces/12-image.jpg"
],
"support": {
"url": "https://reqres.in/#support-
heading",
"text": "To keep ReqRes free, contributions
towards server costs are appreciated!"
});
});
Response Body: JSON value check:
pm.test("Your test name", function () {
var jsonData = pm.response.json();
pm.expect(jsonData.data[0].first_name).to.eql("
Michael");
});
Writing tests | Postman Learning Center
Expect / Should - Chai (chaijs.com)
7. Validating functionality by passing Test data (Re-Testing)
7.1 Verify by Passing parameter as 1 in GET Method=>EC=Status Code-200-OK & GET Method will show
the response=Pass
7.2 Verify by Passing parameter as 2 in GET Method=>EC=Status Code-200-OK & GET Method will show
the response=Pass
7.3 Verify by Passing parameter as 3 in GET Method=>EC=Status Code-200-OK & GET Method will show
the response=Pass
7.4 Verify by Passing parameter as 10/100/1000 in GET Method=>EC=Status Code-200-OK & GET
Method will show the response=Pass
8. Validating Negative Test Cases!
8.1 Verify by Passing parameter as a decimal values in GET Method=>EC=Status Code-400-Bad Request
& GET Method will not show the response=Fail-Defect
8.2 Verify by Passing parameter as Null/Blank Values in GET Method=>EC=Status Code-400-Bad Request
& GET Method will not show the response=Fail-Defect
8.3 Verify by Passing parameter as a Character/String Values in GET Method=>EC=Status Code-400-Bad
Request & GET Method will not show the response= Fail-Defect
8.4 Verify by passing WRONG URL/URI in GET Method=> EC=Status Code-404-Not Found & GET Method
will not show the response=Pass
8.5 Verify by Passing wrong Authorization/Bearer Token/API Key in GET Method=>EC=Status Code-401-
Un-Authorization & GET Method will not show the response.
8.6 Verify by changing GET Method into another Method=>EC=Status Code-405-Method Not Allowed &
GET Method will not show the response=Fail-Defect
How to import and export collections?
23/12/2023:
POST Register Users:
This method will register existing users and set password for them
Endpoint is secured by authentication Policy and requires authentication token
Endpoint: Base URL/Domain/Endpoint – https://reqres.in
URI- https://reqres.in/api/register
Request Headers:
Header Name Required/Optional Description
Accept Required Application/json: it will accept
request and response in JSON
Content-Type Required Application/json: content of
request and response in JSON
Authorization Required Required basic auth/API
Key/Bearer token
Query Parameters:
This operation do not require query parameters.
Invoking the Operations:
Operation URLs and Environments:
Environment Method URL
DEV POST https://reqresdev.in/api/register
INT(Integration or SIT) POST https://reqressit.in/api/register
UAT POST https://reqresuat.in/api/register
PRE-PROD POST https://reqrespreprod.in/api/register
PROD POST https://reqres.in/api/register
Request Body:
{
"email": "eve.holt@reqres.in",
"password": "pistol"
}
Response Attributes/tagnames:
Attribute Name Data Types Comment
id int
token String
Response Examle:
{
"id": 4,
"token": "QpwL5tke4Pnpja7X4"
POST Method/Request:
POST Method Service-URL/URI= https://reqres.in/api/register
Body/Payload-
{
"email": "eve.holt@reqres.in",
"password": "pistol"
}
Username& Password(Basic Auth)/API Key/Bearer token-tcaabfj bjf lekf lklfl
Time taken for the response=5sec
Unit Testing Documents
Sample Response:
"id": 4,
"token": "QpwL5tke4Pnpja7X4"
}
Response Status Code: 200-K
Test Cases:
Precondition: Only existing Users
1. Validating the REST Response=Pass
2. Validating data and count of data in the response=Pass
3. Validating Tag names/Attributes present in response=Id, Token=Pass
4. Validating different Status Code in the responses=>EC=200=Pass
5. Validating time taken for the response=>EC<5secs=Pass
6. Applying Assertions for Verification (Validation)
7. Verifying the Functionality by passing Test Data(Re-Testing)
7.1 Verify POST method/ request by passing “george.bluth@reqres.in” with password EC= for
these email id password will be inserted in serve=Pass
7.2 Verify POST method/ request by passing “janet.weaver@reqres.in” with password EC=
For these email id password will be inserted in server=Pass
7.3 Verify POST method/ request by passing “emma.wong@reqres.in” with password EC=
For these email id password will be inserted in serve=Pass
7.4 Verify POST method/ request by passing “charles.morris@reqres.in” with password EC=
For these email id password will be inserted in serve=Pass
7.5 Verify POST method/ request by passing “lindsay.ferguson@reqres.in” with password
EC= For these email id password will be inserted in serve=Pass
7.6 Verify POST method/ request by passing “rachel.howell@reqres.in” with password
EC= For these email id password will be inserted in serve=Pass
8. Validating Negative Test Cases
8.1 Verify POST method/ request by passing invalid email id “vctc@reqres.in” EC= 400-Bad
request=Pass
8.2 Verify POST method/ request by passing null/blank email id EC= 400-Bad request=Pass
8.3 Verify POST method/ request by passing only email id “rachel.howell@reqres.in” without
password EC= 400-Bad request=Pass
8.4 Verify POST method/ request by passing invalid email id “rachel.howell@gmail.com”
EC= 400-Bad request=Pass
8.5 Verify POST method/ request by passing valid id (id= 1) with password EC= 400-Bad
request=Pass
8.6 Verify POST method/ request by passing wrong URL/URI EC= 404-Not found=Pass
8.7 Verify POST method/ request by passing wrong authorization/ API Key/ barrier token
EC= 401-Un- authorization
8.8 Verify by changing POST method/ request into another method/ request EC= 405-Not
method=Fail-Defect
Practice API: Assignment 1
Google Maps Add API (POST):
This API Will add new place into Server
Complete URL: https://rahulshettyacademy.com/maps/api/place/add/json?key=
qaclick123
Base URL/End Point: https://rahulshettyacademy.com
Resource: /maps/api/place/add/json
Query Parameters: key =qaclick123
Http Method: POST
Sample Body :
{
"location": {
"lat": -38.383494,
"lng": 33.427362
},
"accuracy": 50,
"name": "Frontline house",
"phone_number": "(+91) 983 893 3937",
"address": "29, side layout, cohen 09",
"types": [
"shoe park",
"shop"
],
"website": "http://google.com",
"language": "French-IN"
}
Sample Response:
{
"status": "OK",
"place_id": "928b51f64aed18713b0d164d9be8d67f",
"scope": "APP",
"reference": "736f3c9bec384af62a184a1936d42bb0736f3c9bec384af62a184a1936d42bb0",
"id": "736f3c9bec384af62a184a1936d42bb0"}
Google Maps get Place API (GET):
This API Will get existing place details from Server
Complete URL : http://rahulshettyacademy.com/maps/api/place/get/json?
place_id=xxxx&key=qaclick123
Base URL: https://rahulshettyacademy.com
Resource: /maps/api/place/get/json
Query Parameters: key, place_id //( place_id value comes from Add place(POST) response)
Http request: GET
Note: Key value is hardcoded and it is always qaclick123
Sample Response for the Provided Place_Id
{
"location":{
"lat" : -38.383494,
"lng" : 33.427362
},
"accuracy":50,
"name":"Frontline house",
"phone_number":"(+91) 983 893 3937",
"address" : "29, side layout, cohen 09",
"types": ["shoe park","shop"],
"website" : "http://google.com",
"language" : "French-IN"
}
Google Maps Put Place API (PUT):
This API Will update existing place in Server with new values
Complete URL : http://rahulshettyacademy.com/maps/api/place/get/json?
place_id=xxxx&key=qaclick123
Base URL : https://rahulshettyacademy.com
Resource: /maps/api/place/update/json
Query Parameters: key
Http Method: PUT -
Note: Key value is hardcoded and it is always qaclick123
Sample Request:
{
"place_id":"8d2573bdf6ceec0e474c5f388fa917fb",
"address":"70 Summer walk, USA",
"key":"qaclick123"
}
Sample Response for the Provided Place_Id
{
"location":{
"lat" : -38.383494,
"lng" : 33.427362
},
"accuracy":50,
"name":"Frontline house",
"phone_number":"(+91) 983 893 3937",
"address" : "29, side layout, cohen 09",
"types": ["shoe park","shop"],
"website" : "http://google.com",
"language" : "French-IN"
Google Maps Delete API (DELETE):
This API Will delete existing place from Server
Complete URL: https://rahulshettyacademy.com/maps/api/place/delete/json?key=qaclick123
Base URL: https://rahulshettyacademy.com
Resource: /maps/api/place/delete/json
Query Parameters: key
Http request : DELETE
Sample Body :
{
"place_id":"928b51f64aed18713b0d164d9be8d67f"
}
Sample Response
{
"status": "OK"
}
25/12/2023:
Miscelleneous:
Variables :(POSTMAN)
2 Types: Global Variables & Environment Variable (Local Variable)
Variables enable you to store and reuse values in your requests and scripts. By
storing a value in a variable, you can reference it throughout your collections,
environments, and requests. If you need to update the value, you only have to
change it in one place.
Global variables enable you to access data between collections, requests, test
scripts, and environments. Global variables are available throughout a workspace.
Environment variables enable you to tailor your processing to different
environments, for example local development versus testing or production. Only one
environment can be active at a time.
How to Add Environments?
How to perform data driven testing in Postman?
26/12/2023:
How to Access response from one method into another Method?
Answer: With the help of chaining API Concept (Environment Variables)
How to chain API Requests?
Get data from response of one API and refer it in Another API
Step1: Add requests in POSTMAN
Create new Collection and Add one GET Method: List Users-Gives list of users in the response
URL/URI: https://reqres.in/api/users?page=2
Save and Send
Next Add another Request-PUT Request->>Update USER
URL/URI: https://reqres.in/api/users/2
Body/Payload: Give the below details in body-> raw-Select JSON from dropdown
"name": "morpheus",
"job": "zion resident"
}
Save and Send
Step 2: Use environment variables to Parameterize values to be referred
Fetch users from request 1 and provide it in request 2
Go to new-Add Environment---APIChaining
Variable Initial Value Current Value
Username xyz Xyz
Go to 2nd Method (Put) body & Give Parameter name as Username
"name": "{{Username}}",
"job": "zion resident"
}
Send request and Make Sure you are using Mentioned Environment above
Step 3: Add Script to fetch value from response from 1st API
Go to JSON Path Finder and get the JSON Path:
Go to Tests=>>>
bodyData=JSON.parse(responseBody)
value=bodyData.data[0].first_name
console.log(value)
pm.environment.set("Username", value);
Note: The value is nothing but the value which we are getting and we will be using in
2nd request.
pm.environment.set("Username", value);This statement is setting Environment Variable
and the value of this environment variable is used in second method(PUT)
Step 4: Value coming from response of 1st method will be fetched in 2nd method.
Step 5: Run the second request and Validate now go to Environment and check if the value is correct
Setting Global Variable in API Chaining:
E-Commerce Site Practice: https://rahulshettyacademy.com/client/
Swagger for Practice: https://petstore.swagger.io/#/user/getUserByName
REST Terminologies:
End Point/Base URL/Domain: Address where API is hosted on the server.
HTTP Methods which are commonly used to communicate with REST API’s are: GET, POST,
PUT, PATCH, DELETE
GET: The GET is used to extract information from the given server using a given URI.While
using GET request, it should only extract data and should have no other effect on data.No
Payload/Body required.
How to send input data in GET Method?
Ans: Using Query Parameters
POST: A post request is used to send data to the server, for example,Customer information,File
Upload,etc using HTML forms.
How to send input data in POST/PUT/PATCH Method?
Ans: Using Body Payload
“Name”: “Pramod”,
“Job”: “QA”
PUT: Replaces all current representations of the target resource with uploaded content
DELETE: Remove the contents from the target resource
Resources:
Resources represents API/Collection which can be accessed from the servers
Google.com/maps
Google.com/images
Google.com/search
www.amazon.in/orders
Parameters: Path & Query
Path Parameters: are variable parts of the URL Path.They are typically used to point to a
specific resource within a collection,such as user identified by ID
https://www.google.com/images/1123343
https://www.google.com/docs/1123343
https://www.amazon.com/orders/112
Query Parameters:
Query Parameter is used to sort/filter the resources
Query Parameter is identified with “?”
https://www.amazon.com/orders?sort_by=2/20/2022
End Point Request URL can be constructed as below:
URI=Base URL/Resource/(Query/Path)Parameters
URI= Base URL+Resource+Parameter Value
URL & URI:
URL – Uniform resource locator
URI- Uniform resource identifier
EX.
https://reqres.in/api/users?page=2
where
Base URL/Domain/Endpoint – https://reqres.in
URI- https://reqres.in/api/users?page=2
URI contains: URL & other part
contains
1. Resource/api/users
2. Parameter values/ Query Stringafter ? mark ex. page=2
URI= URL +Resource +Parameter value
27/12/2023
Types of Web Services:
- SOAP Service(Simple Object Access Protocol): XML Language
- REST Service(Representational State Transfer): JSON Language
SOAP Webservice:
Components/Specifications/Standards of SOAP Web Service: WSDL, UDDI, SOAP
WSDL: Web Service Description Language: http://www.dneonline.com/calculator.asmx?
WSDL
- WSDL stands for Web service description Language
- WSDL is the standard format for describing a web service
- WSDL is pronounced as ‘wiz-dull’ and spelled out as ‘W-S-D-L’
- WSDL definition describes how to access a web service and what operations it will
perform
- A client program connecting to a web service can read WSDL to determine what
functions are available on the server.
- WSDL is an XML document with a <definitions> element at the root and the child
elements like
<types>,
<message>,
<portType>,
<binding>
- Web service description language is an XML based interface that is used to describe the
functionalities of the web service
<definitions>:
- Element must be the root element of all WSDL documents
- It defines the name of the web service
- The definition element is container for all the other elements
<types>:
- WSDL <types> element takes care of defining the data types that are used by the web
service
- WSDL allows types to be defined in separate elements so that the types are reusable.
<message>:
- The <message> element describes the data being exchanged between the web service
provider and the consumer
- Each Web Service has two message: Input and Output
<portType>:
- <portType> can combine one request and one response message into single request
response operation
- A port Type can define multiple operations
<binding>:
- To combine all operations together
- The <binding> element provides specific details on how a port Type operation will
actually be transmitted over the web
WSDL File: <definitions>,<types>,<message>,<portType>,<binding>
28/12/2023:
UDDI: Universal Description Discovery Integration
- Universal description discovery Integration is an XML based standard for publishing and finding
web services
- A web service provider publishes his web service (through WSDL) on an online directory from
where consumers can query and search the web service.
- This is online registry/directory called UDDI.
- Its online directory used to store WSDL links
http://www.dneonline.com/calculator.asmx?WSDL
https://ws.footballpool.dataaccess.eu/info.wso?WSDL
WSDL WSDL
UDDI
WSDL WSDL
SOAP: Simple Object Access Protocol
- SOAP is an XML based protocol for exchanging information between web services
- SOAP is Communication Protocol
- SOAP provides data transport for web services
- All information exchange happens over a common format: XML
- XML message has defined structure: SOAP Message
- SOAP Message Consists of: Envelope, Header, Body, Fault
Envelope :( Mandatory)
- The SOAP envelope indicates the start and end of the message so that the receiver knows
when an entire message has transmitted
- The SOAP Envelope solves the problem of knowing when you are done receiving a
message and are ready to process it.
- Every SOAP Message has a root Envelope Element
- Envelope element is mandatory part of SOAP Message.
Header :( Optional)
- Contains any optional attributes of the message used in processing the message, either at
an intermediary point or at the ultimate end point
Body: (Mandatory)
- Contains XML data comprising the message being sent
- The SOAP Body is a mandatory element which contains the application defined XML
data being exchanged in a SOAP Message
- The body must be contained within the envelope and must follow any headers that might
be defined for the message
Fault: (Optional)
- An optional fault element that provides information about errors that occurred while
processing the message
- When an error occurs during processing, the response to a SOAP message is a SOAP
fault element in the body of the message and the fault is returned to the sender of the
SOAP Message.
SOAP Message:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:tem="http://tempuri.org/">
<soapenv:Header/>
<soapenv:Body>
<tem:Add>
<tem:intA>A</tem:intA>
<tem:intB>15</tem:intB>
</tem:Add>
</soapenv:Body>
</soapenv:Envelope>
SOAP Fault:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: Server was unable to read
request. ---> System.InvalidOperationException: There is an error in XML document (5, 32). ---
> System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer&
number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Xml.XmlConvert.ToInt32(String s)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read1_Add()
at
Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer.Deserialize(XmlSerial
izationReader reader)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String
encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String
encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String
encodingStyle)
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
--- End of inner exception stack trace ---
at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()</faultstring>
<detail/>
</soap:Fault>
</soap:Body>
</soap:Envelope>
SOAP Web Service:
- A web service that follows soap web service specifications is a SOAP service.
What are these Specifications/Standards/Components?
Basic Standards: WSDL,UDDI,SOAP
SOAP service testing using SOAP UI tool:
- Developer will provide WSDL file: http://www.dneonline.com/calculator.asmx?WSDL
- Unit testing document: Screenshots, Tables, Sample Request, Sample Response,
Response Code etc.
- Time taken for the response<5Sec
- Authorization Details: Basic Auth(UserName & Password)
https://www.soapui.org/downloads/soapui/
Test Cases:
1. Validating response
2. Validating Data and count of data in response
3. Validating Tagname/Attributes presents in responses
4. Validating Status code in responses
5. Validating Time taken for responses
6. Applying Assertion for verification
7. Functionality(Re-Testing)
8. NEGATIVE test cases !
Execution:
1. Validating SOAP Response=Pass
2.Validating data and count of data present in SOAP Response=Pass
3. Validating Tagnames/Attributes present in the SOAP responseEC(Expected)=Tagname should
contain AddResult=Pass
4. Validating different status codes present in the responseEC=200-OK=Pass
5.Validating time taken for the responseEC<5Secs=Pass
6.Applying Assertion for Verification(Validation Point)To Compare Actual Vs Expected ResultTo
apply assertion we need to Create Test SuiteTo Create Test Suite Right Click on the folder and select
Generate Test Suite option.
QA/Dev Env(Individually)=>It will be merged to the env where you all code resides==>Regression(To
make sure existing functionality is working as expected)
7. Validating the functionality by passing Test data (Re-Testing)
7.1 Verify the SOAP Service by passing one digit numbersEC (Expected) =One digit numbers
should be added=Pass
7.2 Verify the SOAP Service by passing two digit numbersEC=two digit numbers should be
added=Pass
7.3 Verify the SOAP Service by passing Three digit numbersEC=Three digit numbers should
be added=Pass
7.4 Verify the SOAP Service by passing Four/Five digit numbersEC=Four/Five digit numbers
should be added=Pass
7.5 Verify the SOAP Service by passing one digit number at 1st place and two digit numbers at
2nd placeEC= one digit number at 1st place and two digit numbers at 2nd place should be
added=Pass
7.6 Verify the SOAP Service by passing zero numbersEC=should be added=Pass
7.7 Verify by passing both digits as negative numbersEC=should be added=Pass
7.8 Verify by passing one positive number and one negative numberEC=Should be
added=Pass
8.Validating Negative Test cases!
8.1 Verify the SOAP Service by passing decimal digit numbersEC=Should not be added=Pass
8.2 Verify the SOAP Service by passing Character/String digit numbersEC=Should not be added=Pass
8.3 Verify by passing the values beyond integer rangeEC=Should not be added=Pass
8.4 Verify the SOAP Service by passing Null/Blank valuesEC=Should not be added=Pass
8.5 Verify the SOAP Service by passing Wrong WSDLEC=Pass
Few Important Questions:
1. How to create new SOAP Project in SOAP UI tool?
2. How to Create Test Suite in SOAP UI tool?
3. How to Run Test Case or send request?
4. How to add assertions (Validation Points)?
Contains
Not Contains
Valid HTTP Status Code
Invalid HTTP Status Code
Response SLA
Xpath Assertion
Xquery Match
SOAP Fault
SOAP Request
SOAP Response
NOT SOAP Fault
Schema Compliance
Script Assertion
JSON Path Count
JSON Path Existence Match
JSON Path Match
How to run Test Suite in Parallel and Sequential?
Sequential: