DevOps Automation

 View Only

Whats New? Cypress Test Automation & Continuous Integration

By ANDREW MARTINEZ posted Fri March 26, 2021 09:41 PM

In the past couple of years, I've had the pleasure of learning the ins & outs of frontend test automation. It's simply the case that not all testing frameworks are equal and not all frameworks will match your specific needs. Some are too bulky with tools you won't ever use and take forever to start up. Some are too slim and you have to write a lot of boilerplate before you can get to work. New frameworks are coming out all the time and it's hard to discern: "Should we switch to this new framework?" "What about our existing frameworks?" "What if this framework isn't going to be supported in the future?" You then must do the unavoidable cost/benefit analysis on whether or not it's worth it.

This is certainly what happened as we experienced a gap in our Continuous Testing coverage for our SaaS offering. Here at Aspera, one of our offerings is a web app that enables users across the world to transfer data at incredibly high speeds. As we have rolled out many capabilities in the past year, it has become a priority to ensure that we have routine automated coverage of the application. So, we considered and implemented a new solution that would help us meet our vision. And it worked.

Whether you're a DevOps engineer, software developer, or test automation engineer, I think it's incredibly important that you take the time to decide your testing framework well. If you're working on a new project, do not neglect this significant decision or do what everyone else has been doing the past 10 years-- you'll be thankful you gave it some thought! Technology is moving fast, it saves time, money (and headaches) to keep up.

A good testing framework will provide 1) ease of integration into your CI pipelines ("Yay! More time to work on better things!" - DevOps), 2)  immediate & clear feedback to developers, minimizing the back-and-forth chaos that can arise between QA & dev ("Yay! Stop bothering me QA!" - Developers), and finally 3) the automation engineers will have no lack in innovative work they could be doing. As a test automation engineer, I find a lot of joy in the fact that I can focus on developing tests quickly, consistently, and effectively, without having to result back to the drudgery of manual testing or fixing flaky tests (darn you asynchronous requests and detached element errors!).

So many of our apps are being written in libraries React, Angular, and Vue, that we have to write hacky tests to wait for elements to even show up or render. Selenium was written at a time where only static webpages were the norm. As a result, at least in my personal experience, this has heavily slowed down the development and testing cycle.

I know I'm also not the only one who has run into the issue of having no idea why the tests are failing. I believe that anyone on your team (DevOps included) should be able to clearly understand test results without having to wait for a QA Engineer to interpret. Is there such a framework that addresses these common issues?

Enter Cypress.

I'm not going to go into the details of our current Cypress testing framework here at IBM Aspera as the implementation details are up to you. But I want to say that the tools that the Cypress team provides are foundational and game-changing. It's essentially Selenium-less frontend UI testing. "Say what?!" Yes. That's right. No selenium!! Now I'm not against Selenium and it's still a great resource if Cypress does not meet your needs at the end of the day. But there are a lot of reasons to choose Cypress over Selenium.

Let me get straight to the point, especially given that this is a DevOps community. It may not be your immediate job to test, but you will be appreciated for recommending that your team take on this direction if it fits your needs. In the long run (and I'm speaking from the heart here), it will save you the headache of working with QA engineers in setting up a CI environment that works consistently. 

Here are some highlights for DevOps (or anyone who might be interested):

• Run Cypress with a single Docker command utilizing a variety of existing images
Cypress Dashboard to record, screenshot, and provide insight to your tests (i.e. get immediate answers to "why are our tests failing?")
• Test Time Travel: Hover over commands to see what happened at each step
• Built-in parallelization and load balancing -- optimize usage of test resources
• Developer & QA Engineer friendly (let them write the tests with less infrastructure errors, freeing you up)
• Simple installation & support for Mac, Linux & Windows. No dependencies, extra downloads, or changes required to existing code.
• Built-in support for Chrome & Firefox (WebKit support coming soon) -- These browsers are also bundled with the official Docker images
• An alive and well open source community

If you visit, you'll see front and center: "The web has evolved. Finally testing has too".

All I'm saying is that don't just rely on the tools of the past, but keep your eyes peeled for what's to come next! You (and your team) will be glad you did.

#whatsnew #cypress #continuous-testing #ci #testautomation #ibm #aspera​​​​​​​​​