QA Engineers, Stay Out of Cypress Component Testing, for Your Own Sake!
Human Factors. Developers may do as their wish. But for QA Engineers, just do your black-box testing, and stay out of the developer’s turf.
A repost of my past article published on Medium in 2023.
Update 2023–08–28: Developers, you shouldn’t do Cypress Component Testing either.
I have been hearing Cypress testers, who are unable to do end-to-end testing, started talking about how great Cypress Component Testing is.
Cypress Component Testing, let’s just accept the term that Cypress defines, is mainly for developers.
“Cypress currently has official mounting libraries for React, Angular, Vue, and Svelte and support for the following development servers and frameworks: Create React App 4+, Next.js 11+, …” — Cypress Doc
Clearly, Cypress Component Testing is NOT black-box testing (as an end-user), as it is limited to the apps in a certain web framework (even specific versions). At most, it is ‘Gray-box testing’. I have seen some examples on its official doc, but frankly, it is quite complex and messy (You can verify the example script with your end-user or manual tester).
There is a mount
task (to include the component code) before testing. Here is an official example:
import Button from './Button'
it('uses custom text for the button label', () => {
cy.mount(<Button>Click me!</Button>)
cy.get('button').should('contains.text', 'Click me!')
})
I know the argument for Cypress component testing, “browser-based, allowing you test not only your component’s functionality but also styles and appearance” [doc]. From my 20+ years of experience (in both coding and testing), this has very little value, which I will elaborate in a separate article. For Cypress testers fixated on this, (by the way, Cypress.IO is dying) just think the following simple questions:
Why it is NOT included in the Testing Pyramid?
Did your team do end-to-end UI Testing (in the Testing Pyramid) well?
Every activity comes with a cost. Do you, from the project’s perspective, really think the effort on this kind of component testing is justifiable?
Black and White
By the way, we call “BlackBox” and “WhiteBox” testing for a very good reason, indicating there is a clear gap, no middle ground. But the so-called cypress component testing (if performed by QA engineers) crosses that line.
I might be an old-fashioned software engineer and SET. I think mixing black-box and white-box testing is wrong, very wrong.
Keep reading with a 7-day free trial
Subscribe to AgileWay’s Test Automation & Continuous Testing Blog to keep reading this post and get 7 days of free access to the full post archives.