Lecture 7 Flashcards

1
Q

Unit Testing (UT)

A

Tests that verify the functionality of individual/specific units of code, usually written by devs as they work on code, to ensure that specific functions are working as expected.

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

[UT] Benefits

A
  • Find problems early on
  • Simplifies Integration and integration testing later
  • Provides living documentation of a new system
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

[UT] Case Structure (and the acronym!)

A

S.E.V.C

  • Setup (put UUT in state needed to run the test)
  • Execute (trigger UUT target behavior, capture all output)
  • Validation (ensure test results are correct)
  • Cleanup (restore UUT to pre-test state to allow for immediate test execution)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

[UT] Characteristics

A

F.R.O.M SLC. FC. C.A.M

  • FAST
  • READABLE
  • ORDER doesn’t matter
  • MEMORY-ran
  • SINGLE LOGICAL CONCEPT tested
  • FULL CONTROL over all running processes
  • CONSISTENTLY returns same result
  • ABLE to be fully automated
  • MAINTAINABLE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

[UT] Outcomes

A
  • 1+ assert statements to validate specific outcomes

- Verify that no/a particular exception was (not) thrown

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

[UT] Substitutes

A

Unit Test substitutes are used to assist in testing a module in isolation.

  • Method Stub: a stand-in piece of code for some programming functionality
  • Mock Object: a simulated object that mimics the behavior of real objects in controlled ways
  • Test Harness
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Integration Testing (IT)

A

any type of software testing that seeks to verify the interfaces between units or components against a software design.

works to expose defects in the interfaces and interaction between integrated components (aka modules)

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

IT vs UT

A

Integration:

  • coarse-grained
  • complex
  • test intricate web of calls
  • slow
  • can’t run in an IDE

Unit:

  • fine-grained
  • simple
  • test single API call
  • fast
  • easy to run in an IDE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Test Driven Development (TDD)

A

Software development process that relies in the repetition of a very short dev cycle

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

[TDD] Cycle

A

1) Dev writes an initially failing automated test case, defining a desired improvement or new functionality
2) Dev produces minimum amount of code to pass that test
3) Def refactors the new code to acceptable standards

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

[TDD] Benefits

A
  • Dev is concerned with the interface before implementation
  • Dev focuses on making the test pass ONLY, not exceptional cases, error handling, etc
  • Early and frequent testing, obviously
  • Code produced is more modularized, flexible
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Code/Test Coverage (C/T C)

A

A measure that describes the degree to which source code of a program is tested by a particular test suite. High code coverage means it’s been thoroughly tested and a lower chance of software bugs.

Tests include: U.A.I.R (unit, automated, integrated, regression)

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

[C/T C] Types

A
  • Functional
  • Statement
  • Branch
  • Path
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

[C/T C] Functional Coverage

A

has each function (subroutine) in the program been called?

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

[C/T C] Statement Coverage

A

Minimum number of paths in which all nodes are covered

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

[C/T C] Branch Coverage

A

Minimum number of paths in which all edges are covered

17
Q

[C/T C] Path Coverage

A

Number of all paths, from start to end

18
Q

Cyclomatic Complexity (CC)

A

Software measurement that indicates program complexity. The number of linearly independent paths through a program’s source code.

19
Q

[CC] Formula

A

CC = E-N + 2