Week 5

Testing my twttr

The vowel program, split so a function returns the text and the tests call that function.

You type

You write the tests. The function takes text.

The tool
A function returns text. A test checks it. A function returns text A test calls it Pass or fail
What comes out

Tests that fail when the function is wrong.

The question, more slowly

The question is not 'shorten a word' again. It is: put that behavior in a function that returns the shortened text, and write tests that call the function. The tests live in the file the spec names. Pytest runs whatever is named like a test.

A good set of tests includes a word with vowels, a word with none, a word with capitals, and a word with punctuation or numbers if the spec says those stay. Each test should say the input and the expected return, and nothing else.

People test by running the program and looking at the screen. That is a manual check. This week the checker runs your tests, including against a broken version of the function, so a test that never fails is not a test.

Before you code

Write one test in words: given this word, I expect these letters left. Then make that a test. The spec says how the files are named.