Testing | Frontend

Testing | Frontend

CURSOR Education @Roman <roman@cursor.education>


Motivation

ss


Test types

  • Unit tests. Individual functions or classes by mocking input and making sure the output is as expected.
  • Integration tests. Testing several modules to ensure they work together as expected.
  • Functional Tests. Testing a scenario on the product itself (on the browser, for example) regardless of the internal structure to ensure expected behavior.
  • Smoke test (aka Sanity check): A simple integration test where we just check that when the system under test is invoked it returns normally and does not blow up. It is an analogy with electronics, where the first test occurs when powering up a circuit: if it smokes, it's bad.
  • Regression test: A test that was written when a bug was fixed. It ensures that this specific bug will not occur again. The full name is "non-regression test". It can also be a test made prior to changing an application to make sure the application provides the same outcome.

Test tools types

  1. Provide a test environment (MochaJasmineJestKarma)
  2. Provide a testing structure (MochaJasmineJestCucumber)
  3. Provide assertions functions (ChaiJasmineJestUnexpected)
  4. Generate, display, and watch test results (MochaJasmineJestKarma)
  5. Generate and compare snapshots of component and data structures to make sure changes from previous runs are intended (JestAva)
  6. Provide mocks, spies, and stubs (SinonJasmineenzymeJesttestdouble)
  7. Generate code coverage reports (IstanbulJest)
  8. Provide a browser or browser-like environment with a control on their scenarios execution (ProtractorNightwatchPhantomCasper)



Testing tools

Jest

Jasmine

QUnit

Mocha.js

Chai

Protractor

Report Page