/vuejs-testing-sample

Testing in VueJS with Vue Component Testing & Cypress

Primary LanguageJavaScript

vuejs-testing-sample

This repo includes 2 types of testing for frontend application with VueJS

  • Unit testing with Vue Components testing
  • E2E testing with Cypress

Project setup

npm install

Compiles and hot-reloads for development

npm run serve

Compiles and minifies for production

npm run build

Run your unit tests

npm run test:unit

Run your end-to-end tests

UI Mode

npm run test:e2e

Headless mode

npm run test:e2e -- --headless

Lints and fixes files

npm run lint

Result of running tests:

  1. Unit testing:

    • Run command:

      npm run test:unit
      

      Unit testing

  2. E2E testing

    • UI mode

      • Run command:

        npm run test:e2e
        

        Cypress UI

        Click on test.js or Run all specs

        Test results

        Here is result after running e2e testing with Cypress in UI mode

    • Headless mode

      • Run command:

        npm run test:e2e -- --headless
        

        Cypress UI

        Cypress UI

After this article, I will show how to create performance test with Gatling.