Chapter1 Final
Chapter1 Final
Testing &
Testing Methods( 14 Marks)
By:Vijaya Chavan
Basics of Software Testing :
Software testing is the process of identifying the correctness and quality of
software program.
Software testing is a process with intending to find defects.
Software testing is done by software tester.
Developer can also make error.
using a selected set of test cases, with the intent of revealing defects
and evaluating quality.
Software testing is a technical investigation of a product, i.e.
Error
Fault
Bug
Failure
Defect
Software Tester is the one who performs testing and find bugs, if they
exist in the tested application.
Test Case
A test case is a specific procedure of testing a particular requirement.
It will include:
• Identification of specific requirement tested
• Test case success/failure criteria
• Specific steps to execute test
• Test Data
1 Navigate to - - - -
login page
2 Provide valid Username=exampl Shall accept the Accepts the Pass
user name [email protected] username username
3 Provide valid Password=1234 Shall accept the Accepts the Pass
user password password
password
reveal their inefficacy. Teams will have to spend time and effort fixing
them, but it will prevent a bad product from hitting the market.
Validation tests ensure that the product matches and adheres to customer
In the V-Model software development life cycle different steps are followed however
here we will taking a most common type of V-model example. The V-model typically
consist of the following phases:
Quality of s/w is reasonably bug free, delivered on time and within budget,
meets requirements and exceptions and is maintainable.
(iv) Deployment Plan Review (v) Test Plan Review (vi) Test Cases Review
2. Testing: (i) Unit Testing (ii) Integration Testing (iii) System Testing (iv)
Acceptance Testing
Executable
Program
Thorough Testing: White box testing is thorough as the entire code and structures are tested.
Code Optimization: It results in the optimization of code removing errors and helps in
removing extra lines of code.
Early Detection of Defects: It can start at an earlier stage as it doesn’t require any interface as
in the case of black box testing.
Integration with SDLC: White box testing can be easily started in Software Development
Life Cycle.
Detection of Complex Defects: Testers can identify defects that cannot be detected through
other testing techniques.
Comprehensive Test Cases: Testers can create more comprehensive and effective test cases
that cover all code paths.
Testers can ensure that the code meets coding standards and is optimized for performance.
Programming Knowledge and Source Code Access: Testers need to have programming
knowledge and access to the source code to perform tests.
Overemphasis on Internal Workings: Testers may focus too much on the internal workings
of the software and may miss external issues.
Bias in Testing: Testers may have a biased view of the software since they are familiar with
its internal workings.
Test Case Overhead: Redesigning code and rewriting code needs test cases to be written
again.
Dependency on Tester Expertise: Testers are required to have in-depth knowledge of the
code and programming language as opposed to black-box testing.
Inability to Detect Missing Functionalities: Missing functionalities cannot be detected as the
code that exists is tested.
Increased Production Errors: High chances of errors in production.
and in other teams the software testers are the ones who performs this task
and asking the programmer who wrote the code
Static Testing
Formal Reviews
1. Reviews
Informal Reviews
2. Inspection
3. Walkthroughs
4. Technical
Reviews
participant.
Inspections are different from peer reviews and
items)*100 %
E.g. Compilers Debugger(Code coverage Analyzer)
Example: If a function has ten lines of code, statement coverage ensures each line is executed
during testing.
Statement Coverage=(Number of coverage Statements exercised/Total no of
Statements)*100 %
Ensures that all branches of control structures (like if-else statements) are tested.
Example: If a program has an if-else statement, both the if and the else branches should be tested.
Branch Coverage=(Number of decision outcomes exercised/Total no of decision
outcomes )*100 %
Example: In a class with multiple methods, function coverage ensures each method is
called at least once.
Function Coverage=(Number of Functions exercised/Total no of Functions )*100 %
Example: In a compound condition like if (A && B), both A and B should be tested for
true and false values.
Condition Coverage=(Number of decisions exercised/Total no of decisions )*100 %
Example: For a function with multiple nested loops and conditionals, path
coverage would ensure all possible execution routes are tested.
Path Coverage=(Number of paths exercised/Total no of paths )*100 %
6. Line Coverage
Measures the number of executed lines divided by the total number of lines.
Provides a straightforward metric of how much of the codebase is executed.
Example: If a file has 100 lines and 80 lines are executed during testing, line
coverage would be 80%.
Example: For a loop that processes items in a list, loop coverage ensures the
loop is tested with an empty list, a single-item list, and a multiple-item list.
Loop Coverage=(Number of Loops exercised/Total no of Loops )*100 %
Both Compound Logic and Comparison operators test for the truth of their operands. They return a
true or false rather than a quantity. Compound Logic operators, such as AND, NOT, OR, are used to
link expressions together when creating a constraint. For example: (Condition A AND Condition B)
requires Item C.
From Fig separate node is created for each condition (IF a or b)
A and b are predicate nodes
If a or b then procedure X,else procedure Y and ENDIF
An independent program path is any path through the program that introduces at least new one set of
processing statements
An independent path in the control flow graph is the one which introduces at least one new edge that
has not been traversed before the path is defined.
Path 1: 1-11
Path 2: 1-2-3-4-5-10-1-11
Path 3: 1-2-3-6-8-9-10-1-11
Path 4: 1-2-3-6-7-9-10-1-11
Cyclomatic complexity is used to measure amount of decision logic in the program module
Cyclomatic complexity indicates the difficulty of understanding and maintaining a program and
identifies areas of code that may be particularly prone to bugs and errors.
A higher cyclomatic complexity value indicates a more complex program and, therefore, a higher risk
of bugs and errors
Cyclomatic Complexity V(G)= E – N + 2P, where E corresponds to edges, N to nodes, and P to
connected components.
Counting decision points: Cyclomatic Complexity V(G)= Number of decision points + 1.
Summing up predicate nodes: Cyclomatic Complexity = Sum of all predicate nodes + 1.
specifications.
Defining Test Completion Criteria - Testing is completed only when all the
functional and non-functional testing is complete.
Design Test Cases - A Test case has five parameters namely the initial state or
precondition, data setup, the inputs, expected outcomes and actual outcomes.
Execute Tests - Execute the test cases against the system under test and
document the results.
Verify Test Results - Verify if the expected and actual results match each other.
Verify Test Coverage - Verify if the tests cover both functional and non-
functional aspects of the requirement.
Track and Manage Defects - Any defects detected during the testing process
goes through the defect life cycle and are tracked to resolution. Defect
Statistics are maintained which will give us the overall status of the project.
to be effective.
Testing the system exhaustively is impossible hence the testing process
manageable.
It is less important as compared to Negative testing. It is more important as compared to Positive testing.
It can be performed by people having less knowledge. It can only be performed by professionals.
◦ Minimum value.
◦ Just above the minimum.
◦ Nominal Value.
◦ Just below Max value.
◦ Max value.
Valid Test cases: Valid test cases for the above can be any value entered greater than 17 and less than 57.
Enter the value- 18.
Enter the value- 19.
Enter the value- 37.
Enter the value- 55.
Enter the value- 56.
Invalid Test cases: When any value less than 18 and greater than 56 is entered.
Enter the value- 17.
Enter the value- 57.
Boundary Value.
Consider a field that accepts a minimum of 6 characters and a maximum of