javatestingjunit

Would it be worth writing possible JUnit test methods in English/Pseudocode?


I am not looking for the answer to this question, but just a brief outline of how to do it. This is a question from an exam of past paper.

It states:

"Describe in English a sequence of tests that you might use to test code to implement the NumberCoversion class. Your tests should cover all the conditions described in the above definition."

I won't write the specification of the class, but it contains things like:

"It must take String as input and output, accepting two parameters and returning null if a number is not valid", etc.

The question is worth 10%, so will I just be required to write a series of things like:

"Ensure that the constructor only accepts two parameters of type int, and not anything else e.g. double or accept 3 parameters."?

Would it be worth writing possible JUnit test methods in English/Pseudocode?

Would this be the right sort of things to write tests in English?


Solution

  • I think the goal is to describe a test case which checks each of the specifications in the question, whilst also avoiding attempting to test things which are limited by the language construct (e.g. wrong number/type of arguments).