Skip to content
This repository has been archived by the owner on Oct 9, 2019. It is now read-only.

Proposal: Having two tests / suite with the same title should fail the tests #115

Closed
jfmengels opened this issue Jan 25, 2017 · 5 comments
Closed

Comments

@jfmengels
Copy link

I'm proposing a breaking change, that would aim users to have a better test suite (or at least better documented in a way):

  • having two tests in a test suite share the same title should fail the tests
  • having two test suites inside another test suite share the same title should fail the tests

The reasoning is kind of the same as for #95. If I have two tests with the same title, I have probably copy-pasted a test without updating the title. Enforcing different titles for every test should help have more descriptive tests. For reference, In JS land, popular testing frameworks like Mocha and AVA have ESLint plugins with rules that detect identical titles for tests and test suites.

Let me know what you think :)

@rtfeldman
Copy link
Member

I love this idea! @mgold what do you think?

@mgold
Copy link
Member

mgold commented Jan 25, 2017

Seems a little bit finicky to implement but we have precedent for failing obviously wrong test cases. OP seems to suggest checking siblings and parent-children only, which seems right to me. There's probably a legitimate use for sharing names among grandchildren.

@zkessin
Copy link
Contributor

zkessin commented Jan 25, 2017

i would say not across cousins, but otherwise makes sense

@rtfeldman
Copy link
Member

rtfeldman commented Jan 25, 2017

Yeah, I'm thinking this could be as simple as maintaining a Set (List String) of each "fully qualified" (in the sense of this being a list of ancestor descriptions for a particular test) and then erroring out if we try to add an entry to the set that's already present.

@mgold
Copy link
Member

mgold commented Jan 26, 2017

Or making a set from a list and checking the lengths of each, although that wouldn't give you a good error message.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants