From the course: End-to-End JavaScript Testing with Cypress.io
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Working with test doubles
From the course: End-to-End JavaScript Testing with Cypress.io
Working with test doubles
- [Instructor] All right, so the next thing that we're going to talk about here is working with something called test doubles in Cypress. As a general rule, when we're end-to-end testing, as we almost always are with Cypress, we want the app that we're testing to mimic the production environment as closely as possible. This means that we want to be very careful about using techniques that are popular in unit and integration testing, such as mocking, or stubbing, or other test doubles. These are meant in unit and integration testing to make it easier to test individual pieces of our app in isolation. So, usually, using test doubles in end-to-end testing is going to kind of ruin the point of end-to-end testing in the first place. Now, that being said, there are times when using test doubles is the best option, even in end-to-end testing. For example, if we need to see how our app works when it encounters a server error, it's usually much easier to simply create a server stub that…
Contents
-
-
-
-
-
(Locked)
Interacting with elements6m 6s
-
(Locked)
Triggering other actions8m 46s
-
(Locked)
Common assertions8m 46s
-
(Locked)
Automatic retries3m 21s
-
(Locked)
Debugging Cypress tests5m 41s
-
(Locked)
Setting environment variables6m 10s
-
(Locked)
Working with test doubles4m 34s
-
(Locked)
Challenge 2: Writing your own tests1m 20s
-
(Locked)
Solution 2: Writing your own tests3m 29s
-
(Locked)
-
-