Software Development free courses

Master the TrickFoundationFree

Automated Testing Foundations

Write behavior-focused cases and choose unit, integration and end-to-end checks for a small feature.

3 reading lessons · about 30 min ·written by MTT

The idea

A test needs input, action and an observable expectation. Include ordinary, boundary and error cases tied to the feature contract. An assertion that only checks no exception may miss an incorrect value. Avoid copying the implementation into the expected-result calculation when an independent expected result is available.

Worked example

A discount function turns 100 with a 10% discount into 90. A test expecting exactly 90 detects a faulty result of 95; a test merely checking that a number was returned does not. A negative discount requires the contract to specify rejection or another deliberate behavior.

Try it

Write four tests for a fictional total function: normal values, empty input, zero and invalid input. Supply independent expected results. Introduce one plausible defect and identify the test that would fail rather than merely execute the function.

Lesson 1 of 3 · About 10 min

Test the behavior contract

Check your understanding

Course quiz

Finish the course to unlock the quiz

Complete all 3 lessons and 5 questions open up here. You have 3 to go.

What you will learn

  • Define observable expected behavior
  • Distinguish testing scopes
  • Keep tests deterministic and failure-sensitive

Before you start

Prerequisites
Basic programming familiarity. Exercises can be written as test cases before choosing a test framework.
Cost
Free introductory reading lessons, exercises and quiz. Optional third-party tools, hosting or AI subscriptions may cost money.

Original introductory lessons and assessment by Master the Trick. Estimated times include the suggested exercises.