Skip to content

Latest commit

 

History

History
68 lines (40 loc) · 2.38 KB

TESTING.md

File metadata and controls

68 lines (40 loc) · 2.38 KB

Testing

Why is testing important? Many of us like to sleep at night. So to give us peace of mind when we release a new version of our software, we want to guarantee that the application works as it should, always. To accomplish this we write two kinds of tests that will ensure that our applications behaves as it should even as we add new features.

Unit Tests

These tests ensure that individual units of code (functions/methods) return the expected results with different inputs. Think of a sum function. When called as sum(1) we may expect a return value of 1. When called as sum(1, 2) we may expect a return value of 3. And when called with no arguments, we may expect an error to be thrown.

Running Unit Tests

Make sure your packages are up to date by running npm install, and then run tests with:

npm test

Integration Tests

We want to guarantee that our project DC/OS UI works as it should within DC/OS as a product. To do this we want our integration tests to run against a DC/OS cluster. For example we want to test that when an slave fails in a cluster, the UI visually shows this slave failure. A different example is validating that when a new service is installed on a cluster it will show up in the services page.

Integration Tests Setup

  1. Install Cypress CLI
npm install -g cypress-cli
  1. Install Cypress desktop app
cypress install
  1. Open Cypress
cypress open

This should show a new icon on your desktop menu bar.

img

  1. Login with Github. Click on the icon on your desktop menu bar and login.

img

  1. Add project to Cypress app

Once you've logged in click on the plus button and add the dcos-ui folder.

img

Running Integration Tests

  1. Serve the integration test environment:
npm run testing
  1. Click on the project in the Cypress app to start the server

img

img