Reputation: 163
I have a basic test suite that is successfully running all of my tests. I've tied this into a git pre-push
hook, and notice that some tests just don't make sense in that use case (i.e. testing if customer email is sent and received may take 15+ minutes).
So my question is how to organize things to only run desired tests, or omit tests when deploying. I could use tags and groups, but that seems to not be a great fit here, and could lead to code duplication (putting the same test in two or more groups).
Any tips / suggestions? (I'm still looking at tags to see if I can make them work for our use case...)
Upvotes: 0
Views: 133
Reputation: 2858
I think tags is the way you want to go. Think of tags as suites. You can add one test to multiple test suites. For example, say I have several login tests. If I want them to be in a smoke test suite AND a login suite I can just add all the tags that apply to this test.
'@tags': ['smoke', 'login']
This way you don't need to duplicate the code. You can just add as many tags as you need if they apply to this test. In the example above the tests belong to 2 different suites and I can either run the full smoke tests suite or just the login suite using the same tests.
nightwatch --tag smoke
nightwatch --tag login
Upvotes: 1