Software Testing Techniques for Beginners / Chapter 1 — What testing is for (lessons 1–3) / Lesson 1

What testing is for

Time needed: about 6 min (estimate)

☆ Read later

You can try the opening of this lesson without an account.

What we did before release

We ran three checks before release.

All passed.

We shipped.

Three days later, a message arrived: "The student discount does not seem to be applied.

I am a fourth-year university student, aged 22."

The subject is the sign-up flow of a fictional online-course service.

Free costs nothing, standard is ¥2,980 a month, pro is ¥9,800. Twelve months or more takes 10% off, twenty-four months takes 15%, and a student aged 22 or under takes a further 20%.

There are coupons too, but they cannot be combined with the student discount.

test_smoke.py

def test_standard_plan_one_month(): assert shipped.price("standard", 1, 30) == 2980 def test_free_plan_is_0_yen(): assert shipped.price("free", 1, 30) == 0 def test_students_get_a_discount(): # a 20-year-old student. correctly gets the discount normal = shipped.price("standard", 1, 20) student = shipped.price("standard", 1, 20, is_student=True) assert student < normal

Test run

$ pytest test_smoke.py ... [100%] 3 passed in 0.01s

Create a free account to keep reading

With an account you can read the rest of this lesson, take the quiz, and read every free lesson in this course. Lessons you answer correctly are recorded as complete.

Report a problem with this lesson

Log in to send a report.

Keyboard shortcuts

Keys available in a lesson
KeyAction
[ or Alt + ←Go to the previous lesson
] or Alt + →Go to the next lesson
?Open this list
EscClose this list

The keys do not work while the cursor is in a code editor or an input field.