A Little Bit of Cypress
Cypress has some trade-offs and limitations, that is for sure. But is it missing other important things which are important to me as a Mobile Test Automation Engineer? Unfortunately yes it does. Cypress currently won’t make it into my mobile testing tool belt 😢, because it does not support:
- remote execution
- 3rd party cross-browser testing tools
- Mobile Test Automation for Android/iOS Apps
But nevertheless (and I guess cypress isn't build for doing Mobile App Test Automation anyway), let’s experiment a bit with it and do some baby steps in Web and API testing.
First baby steps
The installation procedure of cypress is easy. Here are the things I did in particular order to get cypress flying:
- Install node js
- Initialise a new nodejs project with:
- Install cypress with for that specific project:
npm install cypress --save-dev
- Open up a terminal in the IDE and hit
npx cypress opento start the Cypress Test Runner
- Additionally I have had a look at the official Getting Started to gain more insights.
That’s about it, six steps and I was done with setting things up for my very first cypress project! Pretty slick isn’t it?
Next up I enjoyed myself by creating a Cucumber feature file with the corresponding implementation behind it. While developing and debugging or bug fixing cucumber scenarios, one can put the smart tag @focus in front of a scenario to just run one (or of course more) scenarios (out of many scenarios) focused.
I am looking forward to working more on such small experiments 😉. Here is my repo if you are interested:
The list of plugins is quite impressive. In my baby-steps project I currently use the cy-api for api testing and the cypress-cucumber-preprocessor for the feature file Gherkin thingy (thanks Toyer for pointing me to this one!). Of course there are tons of other things I want to dive into and explore 🧭!
Despite the fact that I as a Mobile App Enthusiast can’t use cypress, I am impressed. Setting up cypress is done within a few seconds, while setting up Selenium needs a bit more of these seconds 😉. The documentation is right before perfection! I have probably never seen such a complete guide and information source for a tool ever before. Bravo and a big applause for that folks 👏🏼!
Developers and automation engineers like to have a tool in their hands which is as close as possible to the “production code”. And sometimes it even may make sense to integrate an applications test automation framework into the same repo as the productive app code. But writing the right tests is still the hardest part of it all.
In order to develop the right tests you need to explore with a testers mindset the different paths of your application and understand from a business value perspective what your end-users are doing and what not.
I am not finished yet with experimenting with cypress, there is more to come in the coming weeks to my repo.
A bit of music
I don’t know why - but cypress always reminds me of Cypress Hill and their two songs from the nineties.Maybe it’s just me getting a bit older. Let’s see how long cypress can make some noise in the clubs. 😉
Thanks for reading! Stay safe and happy! 💃🏽
Further resources which may help
Modern Web testing with Cypress REST API testing with Cypress API Testing with Cypress Integrating Cypress with Cucumber and Gherkin Introduction to E2E Testing with Cypress Testing with Cypress - Basic API overview