SQE Assignment 1
SQE Assignment 1
INSTRUCTOR:
Mubeen (2021-2025)
521216
BS (IT) 7th Morning
Table of Content
s
Test-Driven Development (TDD):.................................................................................................................1
Core principle:.........................................................................................................................................1
Pros of TDD:.............................................................................................................................................1
Cons of TDD:............................................................................................................................................1
Influence on software quality:.................................................................................................................1
Behavior-Driven Development (BDD):.........................................................................................................1
Core principle:.........................................................................................................................................1
Pros of BDD:.............................................................................................................................................1
Cons of BDD:............................................................................................................................................1
Influence on software quality:.................................................................................................................1
Acceptance Test-Driven Development (ATDD):............................................................................................2
Core principle:.........................................................................................................................................2
Pros of ATDD:...........................................................................................................................................2
Cons of ATDD:..........................................................................................................................................2
Influence on software quality:.................................................................................................................2
Comparison and Contrast:...........................................................................................................................2
Conclusion:..................................................................................................................................................2
Model-Based Testing and FSMs...............................................................................................................3
Example:..................................................................................................................................................3
Consider a login system with the following states:..................................................................................3
The transitions between these states might be:......................................................................................3
To test this system using model-based testing with FSMs:..........................................................................3
1. Create an FSM..................................................................................................................................3
2. Generate test cases:........................................................................................................................4
3. Execute test cases:...........................................................................................................................4
Benefits of using FSMs in model-based testing:..........................................................................................4
Control-Flow vs. Dataflow-Based Testing.................................................................................................4
Primary Objectives:.....................................................................................................................................4
Control-Flow-Based Testing:...................................................................................................................4
Dataflow-Based Testing:.........................................................................................................................5
Example:......................................................................................................................................................5
Python code.............................................................................................................................................5
Identifying Defects:.................................................................................................................................6
Question # 1:
Compare and contrast the following software testing philosophies: Test-Driven Development
(TDD), Behavior-Driven Development (BDD), and Acceptance Test-Driven Development
(ATDD). Discuss the pros and cons of each approach and how they influence software quality
Answer: Here is a comprehensive comparison and contrast of the three testing philosophies:
1
o It also promotes a more collaborative and customer-centric development process.
Conclusion:
All three testing philosophies have their own strengths and weaknesses, and the best approach
will depend on the specific needs of the project. TDD is well suited for ensuring code quality,
BDD is good for aligning development with business requirements, and ATDD is effective for
2
ensuring customer satisfaction. In many cases, a combination of these approaches can be used to
achieve the highest possible level of software quality.
Question # 2:
Describe model-based testing and explain how finite state machines (FSMs) are used in this
approach. Provide an example where FSM can be applied to test a login system with multiple
states such as "Logged In," "Logged Out," and "Locked Account."
Answer:
3
To test this system using model-based testing with
FSMs:
1. Create an FSM: Construct an FSM that accurately represents the login system's states and
transitions.
2. Generate test cases: Use a tool to automatically generate test cases based on the
FSM. These test cases would cover different paths through the system, ensuring that all possible
states and transitions are tested.
3. Execute test cases: Run the generated test cases against the login system to identify
defects.
Question # 3:
Compare control-flow based testing with dataflow-based testing. What are the primary objectives
of each method? Use a simple code example to illustrate how these two testing techniques differ
in identifying defects.
Answer:
4
Dataflow-Based Testing focuses on the values that flow through the program. It aims to ensure
that all possible data values are handled correctly. This technique is effective for identifying
errors related to data manipulation, such as incorrect calculations or data type mismatches.
Primary Objectives:
Control-Flow-Based Testing:
o Ensure that all possible paths through the code are executed.
Example:
Consider the following simple function:
Python code
def calculate_average(numbers):
sum = 0
count = 0
if count == 0:
return None
else:
return sum / count
Control-Flow-Based Testing:
Would focus on testing different paths through the function, such as:
5
o A list of integers.