Spm Notes III Unit
Spm Notes III Unit
Software testing techniques are methods used to design and execute tests to
evaluate software applications. The following are common testing techniques:
1. Manual testing – Involves manual inspection and testing of the software by a
human tester.
2. Automated testing – Involves using software tools to automate the testing
process.
3. Functional testing – Tests the functional requirements of the software to
ensure they are met.
4. Non-functional testing – Tests non-functional requirements such as
performance, security, and usability.
5. Unit testing – Tests individual units or components of the software to ensure
they are functioning as intended.
6. Integration testing – Tests the integration of different components of the
software to ensure they work together as a system.
7. System testing – Tests the complete software system to ensure it meets the
specified requirements.
8. Acceptance testing – Tests the software to ensure it meets the customer’s or
end-user’s expectations.
9. Regression testing – Tests the software after changes or modifications have
been made to ensure the changes have not introduced new defects.
10. Performance testing – Tests the software to determine its performance
characteristics such as speed, scalability, and stability.
11. Security testing – Tests the software to identify vulnerabilities and ensure it
meets security requirements.
12. Exploratory testing – A type of testing where the tester actively explores
the software to find defects, without following a specific test plan.
13. Boundary value testing – Tests the software at the boundaries of input
values to identify any defects.
14. Usability testing – Tests the software to evaluate its user-friendliness and
ease of use.
15. User acceptance testing (UAT) – Tests the software to determine if it meets
the end-user’s needs and expectations.
Software testing techniques are the ways employed to test the application under
test against the functional or non-functional requirements gathered from business.
Each testing technique helps to find a specific type of defect .
Decision Table
State Transition
White box testing is a software testing technique that involves testing the
internal structure and workings of a software application . The tester has
access to the source code and uses this knowledge to design test cases
that can verify the correctness of the software at the code level.
Unit Testing
Checks if each part or function of the application works correctly.
Ensures the application meets design requirements during
development.
Integration Testing
Examines how different parts of the application work together.
Done after unit testing to make sure components work well both alone
and together.
Regression Testing
Verifies that changes or updates don’t break existing functionality.
Ensures the application still passes all existing tests after updates.
White Box Testing Techniques
One of the main benefits of white box testing is that it allows for testing
every part of an application. To achieve complete code coverage, white
box testing uses the following techniques:
1. Statement Coverage
In this technique, the aim is to traverse all statements at least once.
Hence, each line of code is tested. In the case of a flowchart, every node
must be traversed at least once. Since all lines of code are covered, it
helps in pointing out faulty code.
2. Branch Coverage
In this technique, test cases are designed so that each branch from all
decision points is traversed at least once. In a flowchart, all edges must
be traversed at least once.
4 test cases are required such that all branches of all decisions are covered, i.e, all edges of the flowchart
are covered
Prerequisite – Path Testing Basis Path Testing is a white-box testing technique
based on the control structure of a program or a module. Using this structure, a
control flow graph is prepared and the various possible paths present in the graph
are executed as a part of testing. Therefore, by definition, Basis path testing is a
technique of selecting the paths in the control flow graph, that provide a basis set
of execution paths through the program or module. Since this testing is based on
the control structure of the program, it requires complete knowledge of the
program’s structure. To design test cases using this technique, four steps are
followed :
1. Construct the Control Flow Graph
2. Compute the Cyclomatic Complexity of the Graph
3. Identify the Independent Paths
4. Design Test cases from Independent Paths
Let’s understand each step one by one. 1. Control Flow Graph – A control flow
graph (or simply, flow graph) is a directed graph which represents the control
structure of a program or module. A control flow graph (V, E) has V number of
nodes/vertices and E number of edges in it. A control graph can also have :
J.KALPANA., MCA., ASSISTANT PROFESSOR, DEPARTMENT OF CA., Page 17
Junction Node – a node with more than one arrow entering it.
Decision Node – a node with more than one arrow leaving it.
Region – area bounded by edges and nodes (area outside the graph is also
counted as a region.)
If – Then – Else
Do – While
While – Do –
So,
Cyclomatic complexity V(G)
= 4 - 4 + 2 * 1
= 2
So,
Cyclomatic Complexity V(G)
= 1 + 1
= 2
Hence, using all the three above formulae, the cyclomatic complexity obtained
remains same. All these three formulae can be used to compute and verify the
cyclomatic complexity of the flow graph. Note –
1. For one function [e.g. Main( ) or Factorial( ) ], only one flow graph is
constructed. If in a program, there are multiple functions, then a separate flow
graph is constructed for each one of them. Also, in the cyclomatic complexity
formula, the value of ‘p’ is set depending of the number of graphs present in
total.
2. If a decision node has exactly two arrows leaving it, then it is counted as one
decision node. However, if there are more than 2 arrows leaving a decision
node, it is computed using this formula :
d = k - 1
Path 2:
C -> D
Note – Independent paths are not unique. In other words, if for a graph the
cyclomatic complexity comes out be N, then there is a possibility of obtaining two
different sets of paths which are independent in nature. Design Test Cases
: Finally, after obtaining the independent paths, test cases can be designed where
each test case represents one or more independent paths. Advantages : Basis Path
Testing can be applicable in the following cases:
3. Nested Loops – Loops within loops are called as nested loops. when
testing nested loops, the number of tested increases as level nesting
increases. The following steps for testing nested loops are as follows-
Validation testing
Validation testing is testing where tester performed functional and non-functional testing.
Here functional testing includes Unit Testing (UT), Integration Testing (IT) and System
Testing (ST), and non-functional testing includes User acceptance testing (UAT).
Validation testing is also known as dynamic testing, where we are ensuring that "we have
developed the product right." And it also checks that the software meets the business
needs of the client.
Validation testing answers the question, "Are we building the right product?" It ensures that
the software product is up to the mark and meets the high-level requirements of the client12. This
type of testing is performed after verification testing and focuses on the final product rather than
the intermediate work-products.
Activities Involved
Logging
Logging is a developer's best friend when it comes to debugging. Insert log statements in your
code to track the flow of execution and the values of variables. Tools like console.log in
JavaScript, print in Python, or more advanced logging libraries can help you trace the code's
behavior2.
Divide and Conquer
Break down the problem into smaller parts. If you're dealing with a complex issue, isolate specific
sections of code to identify the root cause. Test each part independently and gradually narrow
down the problem's location2.
Code Review
Another set of eyes can often spot issues you've missed. Collaborate with your team or seek help
from forums and online communities. Explaining the problem and your thought process can lead
you to the solution2.
Version Control
If the bug appeared after making changes to your code, version control systems like Git can be
your savior. Use git diff to see what you've changed and check your commit history to
understand what might have introduced the bug2.
Debugging Tools
There are a plethora of debugging tools available for different programming languages and
environments. Some popular ones include:
IDEs: Visual Studio Code, PyCharm, and Xcode come with built-in debugging tools.
Browser Developer Tools: For web developers, browser developer tools are indispensable.
Language-Specific Debuggers: For Python, there's pdb and ipdb ; for JavaScript,
there's debugger .
Profiling Tools: Tools like cProfile for Python or built-in browser profilers can help identify
performance bottlenecks2.
Rubber Duck Debugging
Explaining the problem to an inanimate object, like a rubber duck, can help you uncover the issue.
This process forces you to articulate the problem and often leads to a solution 2.
Google and Stack Overflow
Debugging is an indispensable skill for developers. While it can be challenging, it's also highly
rewarding when you successfully pinpoint and resolve an issue. By following these strategies and
utilizing the right tools, you can become a proficient debugger and enhance your problem-solving
skills as a developer12. Remember, debugging is not just about fixing code; it's about sharpening
your analytical thinking and troubleshooting abilities. Happy debugging!