CST 438 – Week 3

FIRST properties refer to the software testing properties:

  • First
  • Isolated/dependent
  • Repeatable
  • Self-validating
  • Thorough/Timely

Fast

This is the idea that we want a quick feedback loop. If our tests aren’t fast, we won’t want to run them often. If we don’t run tests often, it becomes harder to isolate problems since we may have introduced several new additions to our code since we last ran our tests.

Isolated and Dependent

Tests should only invoke the method under testing. Other functionality should be stubbed out and asserted. By building the necessary state for your test case, it becomes easier to understand the situation that your test case describes.

Repeatable

Tests should have deterministic results. If test results are highly variable, then they are not reliable. The results of tests should not be affected by the order in which they are called or how many times they are run.

Self-Validating

This is the concept that tests should be able to automatically resolve whether a test has passed or failed. We shouldn’t have to manually inspect the results to determine a pass/fail.

Thorough/Timely

A test suite should do a thorough enough job in covering test cases in order to be confident enough to push the code to production.

Through test-driven development (TDD), writing test cases first can aid in making testing itself timely (i.e. when you need them!) If you let your test cases guide your implementation, you repeatedly test until you meet the expected functionality/behavior.

Additional Resource: https://hackernoon.com/test-f-i-r-s-t-65e42f3adc17

Leave a Reply

Your email address will not be published. Required fields are marked *