If you’re a new developer who is starting to apply for jobs, you’ve probably noticed that some level of testing knowledge is a common requirement in many job postings. But even if it isn’t a requirement for a specific job you want, knowing how to test your application is a good skill to have and can set you apart from other candidates.

Luckily, if you’re developing in a JavaScript environment, you’ll be able to use Cypress to easily test your application. Cypress can be used for all kinds of testing, including end-to-end, integration, and unit tests. Don’t worry if you don’t know what those are quite yet. I’ll be going over those terms first!


Types of Testing

There are many types of testing, but for the sake of time, I’ll give a quick rundown of the three that I’ve noticed come up most often in interviews and job postings:

  • End-to-end testing: Tests application flow from start to finish, mimicking user interaction with the website.
  • Unit testing: Tests that group components of an application together to be tested one at a time, usually with one output.
  • Integration testing: Usually performed after unit testing, this type of testing combines the units from before and tests them as a group.

Each of these types of testing is used to verify that your application is performing as expected, and all three are easily created with Cypress. For more detailed information on types of testing, I recommend checking out this article.


Getting Started With Cypress

Now for the fun part! Installing Cypress is simple, and I prefer to use npm. Simply navigate into the front end of your project and run the following code in your terminal:

$ npm install cypress --save-dev

If you’d like to use a different method, you can find more information about that in the official documentation.

Next, you’ll want to open Cypress. If you’ve installed Cypress using npm, you can run the following line of code to open it:

$ npx cypress open

If you used another method to install Cypress, you can check out the different ways to open Cypress in the docs.

#testing #javascript #tutorial #programming #cypress

Introduction to Cypress and Front-End Testing
1.10 GEEK