Category Archives: Uncategorized

Understanding JSON web service with example

In my previous post, I was talking about web service. Now I will take you to details of RESTful service (JSON). Before getting into details of web service, you need to understand about http request types like GET, POST etc. If you don’t understand these request don’t proceed further until you are clear with the concept as these are the building blocks.

GET method: This http request is used to get the data using http protocol.  The basic example would be when you try to open www.google.com than a GET request is sent to google server. Google server in response will be sending html document of Home page to the browser.

POST method: This http request is used to submitting data over Internet. When a user submits user registration details than web browser sends POST method to the server with all the details.

You might want to see how it looks like GET method being fired in your browser. I am using firebug to display the request in below Image.

GET HTTP method

GET HTTP method

Now let us understand JSON. JSON stands for Javascript Object Notification. This is used for  data interchange over the web. It is very easy to implement, easy to read & Interpret as human readable and also it’s machine friendly. Whenever any GET request is sent than server sends data in response in JSON format. JSON format consist of key-value pair. A typical JSON response looks like:

{“Student”:[
{“firstName”:“John”, “lastName”:“Doe”},
{“firstName”:“Jane”, “lastName”:“Doe”},
{“firstName”:“Sam”, “lastName”:“Doe”}
]}

Here firstName, lastName are key  & John, Doe are it’s values. So, Developers will be writing JSON parser within the application which can Interpret JSON response and display the content as and where required.

Difference between Test Case and Test Scenario

Every tester has to write test cases or Test cases as well as Test Scenarios depending upon the depth of documentation being followed in there respective organization. Some times, it becomes difficult for some one new to understand the difference between them so lets understand what exactly is Test Case & Test Scenario.

Test Scenario basically means a flow which a user can follow. A single Test Scenario can have multiple Test Cases but vice versa is not True. Lets understand with an example. User logging into website is scenario because this is a flow.

Test Case is a subset of Test Scenario. All test cases are derived from Test Scenarios. Taking the reference from example above, we can have following test cases:

  1.  Login using Correct credentials on website
  2.  Login using Incorrect username.
  3.  Login using Incorrect password.

Similarly, we can have more Test cases to check for Validation of input fields

  1.  Test for validation of username field to accept only valid email address (assuming username used on website is a email address).
  2.  Test for size limit of password
  3.  Test whether special characters are accepted as password
  4.  Verify blank spaces are not accepted as password
  5.  Verify blank password field is not accepted.

These are not the only test cases we can have. As a tester, we need to always strive to break the system in order to become better tester & increase our understanding about Application under Test. 🙂