jeudi 21 septembre 2017

One test for multiple data in BDD-style testing

What is the proper way to write a test case in BDD-style when a set of criteria should be met on multiple data without code duplication?

As an example, assume this test scenario:

GIVEN An object
WHEN It is initialized by method1
OR WHEN It is initialized by method2
THEN (whatsoever) It should pass all these requirements

I am using C++ and Catch framework for testing, however, the answer might be independent from the framework.

Aucun commentaire:

Enregistrer un commentaire