Sunday, April 17, 2011

HTTP - Getting Started

HTTP - HyperText Transfer Protocol
It is a request response oriented protocol which defines the way how a client and server talk to each other. By protocol we mean some set of rules. The client is typically a web browser.

So how it works?
Well, the client sends a request for some resource to a server and the server sends it back a response corresponding to the resource requested for. This is the basic idea.

 The request is also called as 'query'. The server generally makes use of a database to find the resource that the client has requested for.





Clients and Servers both know HTTP and communicate over it. For this the client (web browser) must know  
html. If the response of a server to client's request is an html document then it needs to send it using HTTP protocol.

Bottom line is: A web server uses HTTP to talk to client.

HTTP runs on top of TCP/IP protocol to ensure that the files that are being sent as a response are received at destination as a complete file although it is broken up into chunks when sent. Anyways thats all going into networking and transport layer protocol so we wont talk more on it. :) Just remember that HTTP is an application layer protocol.

Basic structure of HTTP conversation is an easy guess now !!! - request/response sequence : client requests and server responds...



Coffee Break
HTTP is the protocol clients and servers use on the web to communicate.
The server uses HTTP to send html to client. So html is a part of HTTP response. :)
html tells the client (browser) how to display contents to the user.
HTTP is an application layer protocol.

Friday, April 15, 2011

Whitebox Testing


Hope you have already read about blackbox testing. Whitebox testing, as the name suggests :) is a test design where focus is primarily on internal details of the software. Internal structure of the application is checked to see HOW the implementation is done. The tester therefore can know if you have used the correct logic (so you dont get to hardcode or use redundancy). This is essential because it guarantees that the output is the expected result over a larger set of valid inputs as compared to in blackbox testing where it is practically impossible to test over so many inputs (imagine running the software thousand times if the input is supposed to be name of employees in the company having 1000 employees !!!).


Now you are already getting the idea, so lets move further.


Since internal details are focussed upon, the tester needs to know the programming language used. The tester chooses inputs and then checks paths through the source code to know if it is implemented correctly rather than just checking the output.


You must be wondering why blackbox testing is required if whitebox testing can cover its purpose. Does it? Really??? If your answer is yes then i suggest you to continue reading.


In whitebox testing, the internal structure of code, implementation part is focussed upon to see HOW the software works but it doesn't focus on the specification and requirement details. Whitebox testing can uncover many errors but then again unimplemented part cannot be detected. Whether any specification or requirement is missing or not is found by blackbox testing only.


While white-box testing can be applied at the unit, integration and system levels of the software testing process, it is usually done at the unit level. Synonyms for whitebox testing: Glassbox testing, openbox testing.


For a complete software testing process, both blackbox and whitebox testing is required.
Advantages of whitebox testing are: helps in optimizing code, extra lines of code can be removed (hidden defects)
Disadvantages of whitebox testing are: Tester needs to know the programming language used, he needs to know the internal structure too, hidden implementation cannot be detected.


Coffee Break
Characteristics of whitebox testing:
Internal Structure
Tester should know programming language
Paths in code are checked
Implementation logic is checked
Statements, Paths and Decisions in the code is checked











Blackbox Testing

Here the testing is done from the viewpoint of user and not the software developer. Therefore only the functionalities of the software is checked to see if the software is doing what it was initially intended to do. In this way one can know if the aim of the software is achieved or not.
Blackbox test design treats the system as a black box... :) how obvious!!! well treating as black box implies that it doesn't explicitly use knowledge about system's internal structure. Black-box test design is usually described as focusing on testing functional requirements. Synonyms for blackbox include:  behavioral, functional, opaque-box, and closed-box.

The Primary focus of the tester is to find out WHAT the software is doing, whether it complies to its intended aim and whether it gives the expected results... and all this without caring HOW the software is doing it. Therefore, he never looks at the programming code. He only makes use of the software specifications and requirements. 
The tester determines valid and invalid input and checks if corresponding results are the expected results or not.

Sometimes blackbox testing is used for 'behavioral testing' but there is a slight difference between them. While blackbox testing strictly forbids use of internal details of the system, behavioral testing only discourages it.

Now you are clear with the basic concept of blackbox testing .

Also blackbox testing occurs throughout the software development and Testing life cycle i.e in Unit, Integration, System, Acceptance and regression testing stages. Lets look at some benefits of blackbox testing. The software designer and tester are independent of each other. Therefore the test is unbiased.Tester need not have knowledge of any programming language. Testing is done from the viewpoint of the user.Testing can be done as soon as specifications are complete.
Some disadvantages could be: Test cases are difficult to design.Test can be redundant if the designer has already run a test case Testing for all inputs is unrealistic. It consumes a lot of time and there is a possibility of missing some inputs. Also it is difficult to identify all inputs for the software.

Coffee Break 
Characteristics of blackbox testing:
Functionality
No Internal Detail
Requirement
Specifications
Does system meet business requirements
Tester and Designer independent
User point of view
Blackbox testing focuses on application externals. We can call it requirement based or specification based.