3. Testing Flashcards

(37 cards)

1
Q

What is software testing?

A

Software testing is the process of evaluating a software solution to ensure that it behaves as expected and meets the specified requirements. It involves executing the software under controlled conditions and assessing its behavior to identify any defects or bugs.

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

What is a “bug” or “fault” in software?

A

A fault, also called a bug or a defect, is an erroneous software or hardware element of a system that can cause the system to fail.

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

List three primary reasons why we test software.

A

Finding defects: To identify errors in functionality, performance issues, or UI inconsistencies.

Ensuring quality: To ensure the software meets quality standards and fulfills specified requirements, aiming for a reliable and robust product.

Validating requirements: To verify the software behaves according to specified requirements.

(Additionally) Improving user experience: To make the software more user-friendly and satisfying by fixing defects.

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

What important limitation of testing did Edsger W. Dijkstra highlight?

A

“Testing shows the presence, not the absence, of bugs”. This means we can never be 100% sure software is bug-free, but proper testing methodology helps get close.

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

What is Test-Driven Development (TDD)?

A

TDD is a software development approach where tests are written before the actual implementation code.

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

What are the core principles of TDD?

A
  • Every development step must start with a plan to verify that the result meets a goal.
  • A developer should not create a software artifact (requirement, diagram, code) unless they know how it will be tested.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Describe the “Red-Green-Refactor” cycle in TDD.

A

Red: Write a failing test case for desired behavior before implementation. The test fails because no code exists yet.

Green: Write the minimal amount of code necessary to make the failing test pass.
Refactor: After the test passes, improve the code’s design, readability, and maintainability while ensuring all tests continue to pass.

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

List two benefits of Test-Driven Development (TDD).

A

Improved code quality: Encourages modular, well-designed code.

Reduced bugs: Catching bugs early by writing tests upfront.

Faster feedback loop: Provides rapid feedback on code behavior.

Better documentation: Tests serve as executable documentation.

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

Define “White-box testing.”

A

White-box testing exploits the internal structure, design, and code of a system; the internal workings are transparent to the tester.

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

Define “Black-box testing.”

A

Black-box testing explores the input space of functionality defined by an interface specification, testing from an end-user perspective where internal workings are hidden.

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

Why is it generally impossible to completely test any non-trivial system?

A

Because the number of possible inputs, states, and paths can be astronomically large, making exhaustive testing impractical. For example, testing all 4-digit keycodes, plus incomplete codes, and sequences of codes

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

What is the primary goal of testing, considering its difficulty and cost?

A

To find faults as cheaply and quickly as possible. The underlying idea is that correct behavior on “critical” test cases represents correct behavior on untested parts.

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

What is “coverage” in software testing?

A

Coverage measures the degree to which the specification or code of a software program has been exercised by tests.

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

Differentiate between “Test Coverage” (Specification testing) and “Code Coverage.”

A

Test Coverage (Big picture/Specification testing): Focuses on the coverage of the input space, often without testing every part of the software (e.g., acceptance tests).

Code Coverage (Implementation details): Measures the degree to which elements of the program source code have been tested (e.g., unit tests).

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

What is Equivalence Testing?

A

A black-box testing method that divides the input space into equivalence groups/classes where the program is expected to behave the same for each input from the same group.

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

What are the two main steps in Equivalence Testing?

A

Partition the input values into equivalence classes.
Test one or more inputs from each equivalence class.

17
Q

What is Boundary Testing (or Boundary Value Analysis)?

A

A special case of equivalence testing that focuses on the boundary values (edges, outliers like min/max, zero, empty strings) of input parameters, based on the assumption that developers often overlook these special cases.

18
Q

What is Control-Flow Testing?

A

A white-box testing technique that organizes testing based on the control flow of the software, often using a control flow graph where statements are nodes and transitions are edges.

19
Q

List three types of code coverage measures in Control-Flow Testing.

A
  1. Statement coverage
  2. Edge coverage
  3. Condition coverage
  4. Path coverage.
20
Q

Does 100% statement coverage imply 100% edge coverage? Explain briefly.

A

No. For example, in if condition: do_something(), if condition is always true, do_something() is always executed (100% statement coverage), but the path where condition is false (and do_something() is skipped) is never tested, leading to incomplete edge coverage.

21
Q

What is State-Based Testing?

A

It defines a set of abstract states a software unit can take and tests its behavior by comparing actual states to expected states. It’s popular with object-oriented systems.

22
Q

Name three components involved in State-Based Testing.

A
  1. State (constraint on attribute values),
  2. Event (input), Action (result/output)
  3. Transition (change of state),
  4. Guard (condition for transition).
23
Q

List two common control faults in State-Based Testing.

A

Missing transition, incorrect transition, inconsistent state transition, looping/infinite state transition, missing/incorrect action, incorrect state handling, sneak path, trap door, deadlocks, or livelocks.

24
Q

What is Unit Testing?

A

Testing the smallest possible part of a system, called a unit (or fixture), individually and independently.

25
How are external components handled during unit testing to ensure isolation?
Mock objects are created to represent external components: test drivers simulate parts invoking the unit, and test stubs simulate parts called by the unit.
26
What are the three common steps in structuring a unit test case method?
1. Setup, 2. Act, 3. Verify.
27
What is Integration Testing?
Testing how components of a system interact with each other.
28
Name three types of Integration Testing strategies.
1. Big bang integration 2. Top-down integration 3.Bottom-up integration 4. Sandwich integration
29
Why should "Big Bang" integration testing be avoided?
Faults are identified late, bugs are hard to isolate and often missed, and it's difficult to ensure all cases are tested.
30
Differentiate between Horizontal and Vertical Integration Testing.
Horizontal Integration Testing: Assumes hierarchical design, focuses on testing layers incrementally (e.g., top-down, bottom-up, sandwich). Vertical Integration Testing: Focuses on testing scenarios or user stories by testing all components needed to realize that particular story.
31
What does front-end component testing primarily involve?
Testing individual components of a user interface (e.g., buttons, forms) in isolation to ensure they function correctly and meet requirements, focusing on behavior, appearance, and interactions.
32
What is Continuous Integration (CI)?
A software development practice where code changes are frequently integrated into a shared repository, triggering automated build and testing processes to detect integration errors early.
33
What types of tests are typically run during a CI process after a new build?
Unit tests on changed components, Regression tests on unchanged components, and Integration tests on the system.
34
Name one tool for each: Test Runner, Assertion Library, and CI Tool.
Test Runner: Mocha, Jasmine, NUnit, PHPUnit, Pytest, Karma, Sonar Assertion Library: Chai, AssertJ, NUnit.Framework.Assert, JUnit.Assert, unittest.TestCase, unittest.mock, Jest. CI Tool: GitHub Actions, Azure DevOps Pipelines, Jenkins, Travis CI.
35
What are System Tests?
Tests that evaluate the system as a whole.
36
List three types of Quality Tests.
1. Stress testing, 2. Volume testing 3. Compatibility testing 4. Timing testing 5. Security testing 6. Recovery testing.
37
Differentiate between Alpha and Beta Acceptance Testing.
Alpha Tests: The client uses the software in the development environment with developers on hand to fix issues. Beta Tests: Conducted in the production environment with a small subset of users, giving the software a realistic workout in the target environment.