Test Case Message and Requirement

Yudi Supriyadi
2 min readNov 3, 2021

Test case message should be tell us the requirement. How? Try to writing test case in actor perspective. For example:

test('User can see Booking fields is filled by Booking Search Data');
test('User cannot edit Log Date');
test('User navigated to Landing after Create Data is success');
test('System cancelled Create Data Process if fields not filled');

Usually there are two actors: User and System.

Bad Test Message And Implementation

Don’t write test message that tell how it implemented. For example this is bad one:

test('Log Date should use Datepicker');

Even our user story tell us it should use datepicker. Don’t accept it as test message. Because actually that user story contains hidden requirement in it.

First, Log Date can’t contains non-date.
Second, Log Date should be valid date.

Imagine client don’t want to use Datepicker because Datepicker is not UX-friendly. So client want us to use Plain Text Field with date submask. Then you change the message like below.

test('Log Date should use Text Field with Date Submask');

But do you know that you miss one test case after that change. What is that? I’ll tell you.

test('User not allowed to enters non-date value to Log Date field');
test('User not allowed to enters invalid date to Log Date field');

You missed the second test case. What if user enters 50–50–2021? Imagine you forgot to handle second test case and the unit test doesn’t tell you that you are missing that one because, unfortenely, you were not write that test case before.

So here:

Write test message that expresses the requirement not how it implemented.

Repeat again. This is correct test message:

test('User not allowed to enters non-date value to Log Date field');
test('User not allowed to enters invalid date to Log Date field');

And do not write like this:

test('Log Date should use Datepicker');

--

--