An example speaks itself. Let’s say you’re developing an authentication form, probably, you:
then, you can’t go ahead because, without changing the source code, you need that a stubbed/mocked server responds to the app XHR requests. Then you start writing an integration test that:
Take a look at the first test steps, they are the same we made manually while coding the authentication form. Then, we stub the server responses and check the final behavior of the form (with success/failure responses).
This working flow could be easily improved if we write the test alongside the form itself (TDD developers are already trained to do that):
* please note that the first and the second step could be inverted if you want to apply a strict TDD approach
What are the most important advantages of doing that?
How to leverage the existing Development Tools?
Well, you can do that in
almost every testing tool but Cypress stands out for this kind of goal. Cypress has a dedicated
Chrome user that’s persisted across all your tests and all your projects. Doing so, Cypress allows
you to have a real testing-dedicated browser with your favorite extensions, even if you use the
same Chrome version you use to browse.
Mix it with a great UI and you are ready to start developing all your app directly with Cypress.
Below you can find some screenshot of the Cypress UI to show you how much easy is using it as a primary development tool.
Browser Selection
The Cypress-controlled browser DevTools
Cypress Skip and Only UI plugin that allows you to add some .only
or .skip
to the tests directly from the Cypress UI.
Cypress Watch and Reload plugin that allows you to re-run the cypress tests on every source code compilation.
If you want to see the React/Redux devtools in action with the Cypress controlled browser you can use the cypress-react-devtools repository.