mercredi 16 octobre 2019

Is naming test classes with user story id a bad thing?

I worked in the past in a team where we used to prefix our automated (unit, integration, etc) tests class names with the user story id.

For example, "US1234NewFeature", where "US" means "user story", "1234" is the user story/defect id and some short description.

This convention worked fine for us, but as I do not see something similar in discussions, I would like to ask if there is any problem with it that I do not see it.

I like this convention because:

1 - When making TDD, in the very first moment we still do not know exactly what classes you are going to test. There is a criteria you would like to fulfill or behavior you need to verify. Naming a test class here it may be unclear.

2 - For this user story you may have to test different classes, but all of these tests are linked to a set of criteria, defined in the user story. So at the end you will have all tests related to the user story or defect together. This is the responsibility of the class.

3 - When a given test breaks, you will quickly know from what user story it belongs and could check if there is a problem in your test implementation or if it was because actually the criteria has changed. This is assuming you test more behavior then implementation.

I know this may be a generic question, but the question would be what would be the drawbacks of such approach?

Aucun commentaire:

Enregistrer un commentaire