Open bahmutov opened 5 years ago
Quite off topic, but I think it could be great to make tests fail by default, rather than having them pass even when not touching a single line.
Furthermore, considering I know how to use Cypress after almost a day of workshop, I would be pleased to find some test strategy advice (even if it may vary a lot from one projet to another).
@euZebe you mean the exercises in this current workshop have tests that pass by default? And that is bad? I see, although most of the tests are empty and have comments "do this A, do thing B".
under the test strategy advice, what do you mean? Which features to test? Or the breakdown between unit tests and e2e tests and when to write each type of test? I do have some content to put for this topic for sure.
@bahmutov other languages' tutorials and exercices often fail, so that you clearly see that something is missing ; here is an example with Kotlin koans. I didn't think about how to make something similar, but I find it more TDD. I would be glad to help however.
About test strategy advices, I mean you can know how to write a unit test (technically speaking), if you don't know what to test, you're missing the point. It's the same with cypress and e2e tests. Here are a few examples I think about right now:
cy.request()
cy.get('.any-class')
, don't use it. Classes are made to add style, which can change without changing the feature. Prefer using some rock solid selector (id, or attribute specific to tests: data-testid). More generally, for each line of e2e test, think about how it could fail and if you would really want it to fail for such reasons...Of course some of these points may be listed in the best practices, but I see that as a good reminder before finishing the workshop.
great notes @euZebe I appreciate the feedback, and yes, these are good questions. I think using good selectors is a good subtopic. Testing feature X only once goes really well into the "App actions" section (read the blog post, if you haven't already).
I would be interested if you make a pull request with a few tests in https://github.com/cypress-io/testing-workshop-cypress/blob/master/cypress/integration/05-xhr/spec.js#L59 changed to fail. Would you replace all comments with commands without arguments?
first half - same as before
second half - new content
should(cb)
in #29expect
)cypress.json
, command line flags, environment variables, plugins file #32cy.task
#43