Structural testing Flashcards

(30 cards)

1
Q

Whats a chain

A

chain:
sequence of nocdes where each node:
has exctly one indegree and one out degree
every two consecutive nodes in that sequence has an edge between them

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is structural testing

A

testing that uses program structure (e.g., flow graphs) to measure test adequacy and identify gaps in test sets.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

finite feasible

A
  • A coverage criterion is finitely feasible if a finite test suite can satisfy it by covering all reachable required elements (nodes, edges, etc.).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

is all nodes always finitely feasible read

A

No, it is not always guaranteed to be finitely feasible. The all-nodes coverage criterion is only finitely feasible when restricted to reachable nodes. Programs may contain dead code, making some nodes unreachable. Determining whether a node is reachable in general reduces to the halting problem, which is undecidable, so reachability itself is undecidable. Therefore, all-nodes coverage is only finitely feasible when limited to reachable nodes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Advantages of structural

A
  • Pros:
    • Directly examines program structure.
    • Detects gaps in test coverage (e.g., untested statements or paths).
    • Can improve reliability by covering critical structural components.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Disadvantages of structural

A
  • Cons:
    • Relies on program implementation (not specifications).
    • May miss functional requirements or logical errors
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is regression testing

A

Testing that ensures new changes do not break existing working functionality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Purpose of regression testing

A
  1. New code changes have not introduced defects into previously working functionalities.
    1. The system continues to behave as expected after updates.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

When regression testing

A

When is Regression Testing Performed?

  1. After Bug Fixes:
    • To ensure the fix doesn’t affect unrelated parts of the application.
  2. After Feature Additions or Enhancements:
    • To confirm that new functionality integrates seamlessly with existing code.
  3. After Refactoring:
    • To validate that code improvements (e.g., performance optimizations) haven’t introduced errors.
  4. Before Major Releases or Updates:
    • To verify that the application as a whole is stable.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How regression testing works

A
  1. Create a Regression Test Suite:
    • A collection of test cases covering the application’s core functionalities, edge cases, and previously reported bugs.
  2. Execute Tests:
    • Run the suite after every significant change.
    • Automated tools are commonly used to speed up this process.
  3. Analyze Results:
    • Compare current results with expected outputs.
    • Investigate and fix any discrepancies.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Name 3 techniques in regression testing as well as pros and cons

A
  1. Retest All:
    • Run all existing test cases, including functional and non-functional tests.
    • Pros: Comprehensive coverage.
    • Cons: Time-consuming and resource-intensive.
  2. Selective Testing:
    • Identify and execute only the test cases related to the changed areas.
    • Pros: Efficient and faster than retesting all.
    • Cons: May miss indirect effects of changes.
  3. Prioritized Testing:
    • Prioritize tests based on the criticality of features and modules.
    • Example: Core banking transactions in a banking application.
  4. Automated Regression Testing:
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Why regression testing important

A

Why is Regression Testing Important?

  1. Prevents Bugs in Production:
    • Ensures that new code changes do not cause unexpected issues.
  2. Maintains Stability:
    • Helps preserve the quality and reliability of software as it evolves.
  3. Increases Confidence:
    • Provides assurance that changes are safe and the application is ready for deployment.
  4. Supports Continuous Development:
    • Essential in Agile and DevOps practices where frequent updates are common.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

challenges with regression

A

Challenges in Regression Testing

  1. Time-Consuming:
    • Running a full test suite can take a significant amount of time.
  2. Costly for Large Systems:
    • Large codebases require extensive test case management and execution.
  3. False Positives/Negatives:
    • Improperly maintained test cases may yield inaccurate results.
  4. Automation Maintenance:
    • Automated regression tests must be updated to align with application changes.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Whats a maximal chain

A

maximal chain: a chain such that adding any other adjacent node would make it lose its property of being a chain

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a dd path

A

a dd path is a set of that is either :
. a single node ( start or terminal)
. special node ( branching node - outdegree is >=2 or merging node - indegree is >=2 )
. a maximal chain

EACH NODE BELONGS TO EXACTLY ONE DD PATH

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a dd path graph

A

A DD-path graph is obtained from the original control-flow graph (CFG) by:

Collapsing each maximal chain into a single node, and

Keeping all start, terminal, branch, and merge nodes as single nodes, and

Preserving the control-flow edges between these new nodes.

17
Q

When is dd path graph adequate

A

for each node or edge in dd path graph theres a test case covering it

18
Q

READ VERY IMPORTANT

A

dd path coverage is equivalent to edge coverage BUT REQUIRES LESS CHECKS

This is because we group maximal chains into one unit

19
Q

Read very important

A

dd path coverage subsumes node coverage because:
each node belongs to exactly one dd path so if you have full dd path coverage you have full node coverage

20
Q

is dd path coverage complete ?

A

dd path coverage:
Not complete ( no gurantee all bugs found)

solution:

use stronger adeqiacy criterial ( prime paths…) -> However problem with this is that it leads to more test cases and no guarantee that more bugs will be found -> tradeoff between potential reward of stronger adequacy and expensiveness to implement this stronger critera

another solution you can do is you switches ( or if elses) instead of sequential condtions to reduce risk of bugs

21
Q

What is a simple path

A

simple path - path that visits A node at most once ( except potentially start and end)

tip : no repetition except potentially start and end

22
Q

what is a prime path

A

prime path -
simple path that cannot be extended without losing its property of being simple path

23
Q

what is adequacy in prime paths

A

for each prime path there is a test case that covers it

Informally -
test case covers every simple path and up to two iterations of a loop

24
Q

cyclomatic number

A

the no of linearly independent paths in a programs control flow graph

25
very important just read
cyclomatic number - take one path from start to exit , counting number of alternatives by flipping condition one at a time does a shoter or longer program have higher cyclomatic: longer has higher as it is more likely to have more independent decision points ( if , while , for , case ...) Longer program more likely to have more of these ( branches , loops...) and so has higher cyclomatic
26
tip for cyclometric BEST
No of regions in plane ONLY IF : connected graph one start and one terminal
27
tip for cyclometric
E - N + 2 ONLY IF : connected graph one start and one terminal
28
what does a high cyclometric tell you
impossible to test program
29
Advantage of cyclometric
.Tells you how testable your program is . gives the number of linearly independent paths in control-flow graph and therefore tells us the minimum number of test cases required to achieve basis path coverage.
30