Software Testing Flashcards

1
Q

red-green-refactor testing

A
  1. fail - write a test and make sure it fails, before implementing
  2. pass - write an implementation, to make the test pass
  3. refactor + extend - refactor system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Unit Tests

A
  • FAST and ISOLATED
  • test a small facet of the code
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Acceptance/End-to-end Tests

A
  • SLOW and !ISOLATED
  • done at the end with the user/person who will use the product
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

System Tests

A
  • SLOW and !ISOLATED
  • simulates user
  • ties together integration tests and acceptance tests
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

s

Integration Tests

A
  • SLOWER than unit tests
  • MORE ISOLATED than acceptance tests
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Smoke Tests

A

try to expose a fault as quickly as possible, making it possible to defer running large swaths of unnecessary tests for a system that is known to be broken

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

3w21wq;p

A|B Testing

A
  • for production environments
  • comparing 2 versions
  • usually used for business decisions rather than functionality
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

4 phase tests

A

1) set up
2) execute CUT/SUT
3) evaluate the output
4) tear down

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

Given-When-Then

A

1) start from some given state, where the system’s configuration is understood
2) The key action of the test is the when; this is often described in the test name using plain language (e.g., it(‘should be able to parse a document that has UTF-16 characters’)).
3) The then step involves observing the output to ensure its correctness.

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

TDD biggest strength

A

you are able to ensure that your system is structured in a testable way

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

4 properties of testability

A

controllability
observability
isolateablilty
and automatability

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

controllability

A
  • refactoring code in a way that makes test cases more succinct
  • red flag:
  • when a constructor has new statements
  • bc when a constructor is creating its own objects you as the test writer dont have the opportunity to change those objects
  • example: using id directly, should pass in jquery object instead
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Observability

A
  • ability to check the value to make sure a test
  • (refactor) often these can be resolved by returning data to the caller that might otherwise just been passed further down a call chain
  • (can refactor to return what you want to check instead)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Isolatability

A
  • split up code to test subparts
  • also test as a whoole but this is the main idea
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

automatability

A
  • easier to autoate if you pass in objects instead of requiring manual use of software to test
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Glass Box Testing Faults

A
  • confirmation bias
17
Q

pros of using coverage

A
  • cheap to compute in contrast to reasoning
  • it is actionable
19
Q

types of coverage

A
  • line
  • statement: diff than line bc measures all statements on a line executed
  • branch: both conditions of all branch points
  • path: all program paths (ie all possible combinations)
20
Q

Boundary Value Analysis

21
Q

BVA: 4 values for boolean testing

A

true, false, null, undefined

22
Q

BVA: numbers

A
  • number.negative_infinity
  • -number.max_value
  • number.positive_infinity
  • number.max_value
  • undefined
  • null
  • you can have null checks enabled for null and undefined
23
Q

Equivalence Class Partitioning (ECP)

A
  • inputs decomposed into classes and make sure test atleast one from each class
24
Q

state transition testing

A
  • identify states or modes that he program will assume at runtime
  • determine how the program flows between states and test the behaviour during these transitions
25
Q

User Acceptance Testing

A
  • also use case testing/user story testing
  • tries to simulate interaction with the system
  • can also simulate both untrained and adversarial users
26
Q

Input Partition: pros/cons

A

-pros:
- - avoid confirmation bias
- - even tho black box -> systematic
- - simplifies large domains
- cons:
- - dependent on specification
- - inputs can be less interesting than outputs (output partitioning needed)
- - defects can arrive at boundaries (combo input paritioning with BVA)

27
Q

Output Partitioning

A
  • identify the values that test the desired outputs
29
Q

Output Partitioning: pros/cons

A
        • pros
  • focuses on observable outputs
  • can encourage diff approach
        • cons
  • usually fewer outputs than inputs (might drive easier tests)
  • effort required to derive inputs to acheive given goal can be challenging
30
Q

fuzz testing

A

Fuzz testing automates parts of the test writing process by generating inputs programmatically, often with some randomness

1) generates an input
2) executes the SUT with generated input
3) observes if crash
4) if no crash repeat from step 1

31
Q

common use for fuzz testing

A
  • test that hte system does not crash
  • used to find segmentation faults or other types of runtime errors
32
Q

types of fuzzing

A

1) random fuzzing: tests completely at random (usually specifies type, can at times be TOO random)
2) generator-based fuzzing: developer writes code that generates random input BUT they are guaranteed to be valid
3) mutational fuzzing: defining mutations—operations that transform one input into another, slightly different input

33
Q

Mutation Testing

A

Mutation operators are used to create mutant versions of the code under test. Mutants tend to be simple: for example changing bounds checks (e.g., a >= arr.length to a > arr.length), or boolean values (e.g., if (isReady) {} to if (!isReady) {}).