What is White box system? Advantage and disadvantage of white box system
Introduction to White Box Testing: -
White Box Testing is concerned with structure or Internal logic or implementation of program. This test case concentrates on the examination of the code rather than specification. It is also known as Clear Box testing, Open Box testing, Structural testing, Transparent Box testing, CodeBased testing, and Glass Box testing. It is usually performed by developers.
To test the logic of the program various test cases are defined which takes care following: -
1) Every statement in a program must be executed at least once.
2) Every path in a program must be executed at least once which is called path analysis.
3) Every logical decision must be executed on their true or false sides, this is called condition coverage.
4) Execute all their loops on their boundaries and within operational boundaries.
5) Execute internal data structure and formulae to insure their validity. In white box testing code auditing is done to determine whether or not specified programming practices and rules have been followed.
Static analyzer is done of the tool used for White Box Testing which is used to check function calls, uninitialized variables, variables defined but not used.
Working process of white box testing:
1) Input: Requirements, Functional specifications, design documents, source code.
2) Processing: Performing risk analysis for guiding through the entire process.
3) Proper test planning: Designing test cases so as to cover entire code. Execute rinse-repeat until error-free software is reached. Also, the results are communicated.
4) Output: Preparing final report of the entire testing process.
Advantages / Pros / Benefits / Merits of White Box Testing (WBT): -
1) All statements and logic is verified it is possible to give guaranty of error free software.
2) White Box Testing is helpful for improving quality of system in terms of increasing the executing speed by selecting proper logic, minimizing memory space by removing unnecessary statements, etc.
3) Enables programmer to introspect because developers can carefully describe any new implementation.
4) Extra lines of code can be removed which can bring in hidden defects.
Disadvantages / Cons / Drawbacks / Demerits of White Box Testing (WBT): -
1) Requires high level knowledge of internals of the software under test
2) Only expert persons are able to do White Box Testing (WBT) because understanding of code is necessary.
3) Each and every statements are executed at least once so White Box Testing (WBT) is time consuming techniques.
4) Some conditions might be untested as it is not reliable to test every single one.
5) Updated test script required when the implementation is changing too often.
Static Techniques: -
Static Testing is a type of a Software Testing method which is performed to check the defects in software without actually executing the code of the software application. Where as in Dynamic Testing checks the code is executed to detect the defects. Static testing is performed in early stage of development to avoid errors as it is easier to find sources of failures and it can be fixed easily. The errors that can’t not be found using Dynamic Testing can be easily found by Static Testing.
Types of static Techniques: -
The following are the types of static testing are as follow: -
1) Informal review
2) Walkthrough
3) Technical review
4) Inspection
1) Informal:
i) In informal review the creator of the documents put the contents in front of audience and everyone gives their opinion and thus defects are identified in the early stage.
ii) Informal reviews are applied in the early stages of the life cycle of the document.
iii) These reviews are conducted between two person team. In later stages more people are involved.
Goals of Informal Review: -
i) The aim of informal reviews is to improve the quality of the document and help the authors.
ii) These reviews are not based on the procedure and not documented.
2) Walkthrough:
i) It is basically performed by experienced person or expert to check the defects so that there might not be problem further in the development or testing phase.
ii) In walkthrough, author guides the review team via the document to fulfill the common understanding and collecting the feedback.
iii) Walkthrough is not a formal process.
iv) In walkthrough, a review team does not require to do detailed study before meeting while authors are already in the scope of preparation.
v) Walkthrough is useful for higher-level documents i. e requirement specification and architectural documents.
Goals of Walkthrough: -
i) Make the document available for the stakeholders both outside and inside the software discipline for collecting the information about the topic under documentation.
ii) Describe and evaluate the content of the document.
iii) Study and discuss the validity of possible alternatives and proposed solutions.
3) Technical review: -
i) Technical review is a discussion meeting that focuses on technical content of the document.
ii) It is a less formal review.
iii) It is guided by a trained moderator or a technical expert.
Goals of technical review: -
i) The goal is to evaluate the value of technical concept in the project environment.
ii) Build the consistency in the use and representation of the technical concepts.
iii) In early stages it ensures that the technical concepts are used correctly.
4) Inspection: -
i) Inspection is basically the verification of document the higher authority like the verification of software requirement specifications (SRS).
ii) The trained moderator guides the Inspection.
iii) It is most formal type of review.
iv) The reviewers are prepared and check the documents before the meeting.
v) In Inspection, a separate preparation is achieved when the product is examined and defects are found. These defects are documented in issue log.
Goals of Inspection: -
i) Assist the author to improve the quality of the document under inspection.
ii) Efficiently and rapidly remove the defects.
iii) Generating the documents with higher level of quality.
iv) It helps to improve the product quality.
Dynamic Techniques or Structural techniques: -
Dynamic testing is testing, which is done when the code is executed at the run time environment and examining the output. It is a validation process where functional testing [unit, integration, and system testing] and non-functional testing [user acceptance testing] are performed. We will perform the dynamic testing to check whether the application or software is working fine during and after the installation of the application without any error. Dynamic testing is completed in validation process.
The dynamic techniques are: -
1) Statement Coverage Testing
2) Branch / Decision Coverage Testing
3) Path Coverage Testing
4) Conditional Coverage Testing
5) Loop Coverage Testing
1) Statement Coverage Testing: -
i) Statement coverage type of white box software testing technique.
ii) It is called line or segment coverage testing.
iii) This testing is done to the code written to test whether the code written is qualitative or whether it does what it is expected to be done.
iv) It is checked in true conditions it is verified for every line of statements.
v) Example :
Read
A Read B
If A > B
then x = 0
End if
vi) To achieve 100% statement coverage we need to check only one test case here. We ensure that A value is greater than B for input values like A=14 and B=11. Here we check the structural design first as we are choosing input values to make certain the statement of coverage. The main disadvantage of this technique is here we cannot check the false condition of statements.
Advantages of Statement Coverage: -
i) It ensures what the written code is expected to do and not to do.
ii) It measures the quality of written code.
iii) It verifies the flow of various paths in the program and also verifies if those path are tested or not.
Disadvantages of Statement Coverage: -
i) Statement coverage cannot test the false conditions.
ii) It does not report if the loop has reached at its termination or not.
iii) It does not recognize the logical operators.
2) Branch / Decision Coverage Testing: -
i) Branch coverage is called as branch coverage or all edges coverage.
ii) It tests both true and false conditions.
iii) Branch coverage technique is a white box testing technique that ensures that every branch of each decision point must be executed.
iv) A branch is the result of a decision.
v) A Branch is an IF statement, a loop control statement i. e DO-WHILE or REPEAT-UNTIL etc. or CASE statement.
vi) In these statements two or more result are possible.
vii) With an IF statement, the exit can be TRUE or FLASE, depending on the value of the logical condition that comes after IF.
viii) However, branch coverage technique and decision coverage technique are very similar, but there is a key difference between the two. Decision coverage technique covers all branches of each decision point whereas branch testing covers all branches of every decision point of the code.
Let's understand it with an example:
Read X Read Y
IF X+Y > 100
THEN
Print "Large"
ENDIF
If X + Y<100
THEN
Print "Small"
ENDIF
This is the basic code structure where we took two variables X and Y and two conditions. If the first condition is true, then print "Large" and if it is false, then go to the next condition. If the second condition is true, then print "Small."
Control flow graph of code structure: -
In the above diagram, control flow graph of code is depicted. In the first case traversing through "Yes "decision, the path is A1-B2-C4-D6-E8, and the number of covered edges is 1, 2, 4, 5, 6 and 8 but edges 3 and 7 are not covered in this path. To cover these edges, we have to traverse through "No" decision. In the case of "No" decision the path is A1-B3-5-D7, and the number of covered edges is 3 and 7. So by traveling through these two paths, all branches have covered. Path 1 - A1-B2-C4-D6-E8 Path 2 - A1-B3-5-D7 Branch Coverage (BC) = Number of paths =2
Advantages of Decision Coverage:-
i) It ensures that all the branches in the code are reached.
ii) It removes the problems that occur with statement coverage testing.
Disadvantages of Decision Coverage:-
i) This metric ignores branches within Boolean expressions which occur due to short-circuit operators.
3) Path Coverage Testing: -
A path represents the flow of execution from the start of a method to its exit. A method with N decisions has 2^N possible paths, and if the method contains a loop, it may have an infinite number of paths. Path coverage testing is a specific kind of methodical, sequential testing in which each individual line of code is assessed. The way that path coverage testing works is that the testers must look at each individual line of code that plays a role in a module and, for complete coverage, the testers must look at each possible scenario, so that all lines of code are covered. In a very basic example, consider a code function that takes in a variable "x" and returns one of two results: if x is greater than 5, the program will return the result "A" and if x is less than or equal to 5, the program will return the result "B." The code for the program would look something like this: input x if x > 5 then return A else return B The way that path coverage testing works is that the testers must look at each individual line of code that plays a role in a module and, for complete coverage, the testers must look at each possible scenario, so that all lines of code are covered. In order for path coverage testing to effectively "cover all paths," the two test cases must be run, with x greater than 5 and x less than or equal to 5. Obviously, this method becomes much more complicated with more complex modules of code.
Advantages of Path Coverage Testing:-
i) Path testing is mainly focused on the program logic.
ii) Allows the team to analyze the flow of the program during the process of testing.
iii) It is highly dependent on the source code of the program.
iv) Ensures the execution of the each and every path, present in the software program, at least once.
v) A structured type of testing technique that uses control flow graph and is independent of the specifications.
Disadvantages of Path Coverage Testing:-
i) Presence of defects cannot be traced out by the path testing due to an error in the specifications.
ii) Path testing requires expert and skillful testers, with in-depth knowledge of programming and code.
iii) It is difficult to test all paths with this type of testing technique when the product becomes more complex.
4) Conditional / Predicate Coverage Testing:
- With Condition coverage the possible outcomes of (“true” or “false”) for each condition are tested at least once. This means that each individual condition is one time true and false. In other words we cover all conditions, hence condition coverage. The outcome of the decision point is only relevant for checking the conditions. Also the combinations of conditions are not relevant. Since there are only two possible outcomes of a condition (true or false). Example: -
if
(
(A || B) &&
C
)
{ << Few Statements >> }
else
{ << Few Statements >> }
5) Loop Coverage Testing: -
i) Loop Testing is defined as a software testing type, that completely focuses on the validity of the loop constructs.
ii) It is one of the parts of Control Structure Testing (path testing, data validation testing, condition testing).
iii) Loop testing is a White box testing. This technique is used to test loops in the program.
Types of loop Tested
1. Simple loop testing
2. Nested loop testing
3. Concatenated loop testing
4. Unstructured loop testing
1. Simple Loop Testing: - Testing performed in a simple loop is known as Simple loop testing. Simple loop is basically a normal “for”, “while” or “do-while” in which a condition is given and loop runs and terminates according to true and false occurrence of the condition respectively. This type of testing is performed basically to test the condition of the loop whether the condition is sufficient to terminate loop after some point of time.
2. Nested Loop Testing Testing performed in a nested loop in known as Nested loop testing. Nested loop is basically one loop inside the another loop. In nested loop there can be finite number of loops inside a loop and there a nest is made. It may be either of any of three loops i.e., for, while or do-while. Example: while(condition 1) { while(condition 2) { statement(s); } }
3. Concatenated Loop Testing: Testing performed in a concatenated loop is known as Concatenated loop testing. It is performed on the concatenated loops. Concatenated loops are loops after the loop. It is a series of loops. Difference between nested and concatenated is that in nested loop is inside the loop but here loop is after the loop.
Example: while(condition 1) { statement(s); } while(condition 2) { statement(s); }
4. Unstructured Loop Testing: Testing performed in an unstructured loop is known as unstructured loop testing. Unstructured loop is the combination of nested and concatenated loops. It is basically a group of loops that are in no order. Example: while() { for() {} while() {} }
Advantages of Loop Testing:
i) Loop testing limits the number of iterations of loop.
ii) Loop testing ensures that program doesn’t go into infinite loop process.
iii) Loop testing endures initialization of every used variable inside the loop.
iv) Loop testing helps in identification of different problems inside the loop.
v) Loop testing helps in determination of capacity.
Disadvantages of Loop Testing:
i) Loop testing is mostly effective in bug detection in low-level software.
ii) Loop testing is not useful in bug detection.
0 टिप्पणियाँ