In the previous post, we did an exercise about the specification for a simple function. Let’s comment on our answers to this exercise. We will introduce you to software testing based on the remarkable book, Introduction To Software Testing by Paul Ammann and Jeff Offutt.
All testers have encountered issues with specification clarity. But even with precise requirements, there is always a need for the skill of making relations between specification, possible faults, and test cases.
Write a function, in a programming language by your choice, that returns a union of two input lists. The union is a list that has elements present in either of the input lists.
As we have a series of posts on Elixir, we implemented SET UNION in Elixir with module and function documentation, and function type specification. We simply concatenate two lists and then remove duplicate elements as elements present in both lists should be showed only once.
Identify as many faults that you can think of.
- the input list is not of list type
- the input list is empty
- input list is
Create test cases that would reveal those faults.
Rewrite original specification that would capture all identified faults.
Write a function, in a programming language by your choice, that returns a union of two input lists. The union is a list that has elements present in either of the input lists. The function must handle these input parameters with the error message:
- input parameters must be a list