Summary
End-to-end tests with Cypress allow us to quickly cover areas of our app. However, they require a fully operational frontend and backend, including a database. Cypress abstracts away the complexity of the asynchronous nature of single-page applications, making our tests nice and easy to write.
Unit tests can be written using xUnit in .NET and can be placed in a xUnit project, separate from the main app. xUnit test methods are decorated with the Fact
attribute, and we can use the Assert
class to carry out checks on the item that we are testing.
Unit tests can be written using Jest for React apps and are contained in files with test.ts
or test.tsx
extensions. Jest's expect
function gives us many useful matcher functions, such as toBe
, that we can use to make test assertions.
Unit tests often require dependencies to be mocked. Moq is a popular mocking tool in...