wazuh-splunk icon indicating copy to clipboard operation
wazuh-splunk copied to clipboard

Add E2E and unit tests to the front-end side and improve back-end tests

Open pablotr9 opened this issue 5 years ago • 0 comments

Front-end side

Our application is growing day by day and the manual testing is going to be unmaintainable. For this reason, I think we should add unit tests for the frontend side (all the Angular.js and React.js part) and we should also add E2E tests.

What's an E2E test?

Simulating human actions such as "Open Overview Welcome, then apply a filter, the visualizations must change depending on the filter"

What's a unit test

Automatic tests for all the logic under the views, this means we can properly test a module or a directive at the function level.

For example the function addLevel(parameters) is expected to receive no more than one parameter, if it's an integer it should return the integer x 2, then, if it's not an integer it should return false.

The example function may have multiple unit tests such as: "call the function with zero parameters", "call the function with a valid parameter and check the output", "call the function with an invalid parameter and check the output", etc..

image

First iteration

  • [ ] Decide which framework we should use for E2E testing on the front-end side.
  • [ ] Decide which framework we should use for unit testing on the front-end side.
  • [ ] Create a fake but functional E2E test.
  • [ ] Create a fake but functional unit test.

Second iteration

  • [ ] Cover most common visualize actions with E2E tests.
  • [ ] Cover most common visualize actions with unit tests.

Third iteration

  • [ ] Cover the rest of the frontend parts with E2E tests.
  • [ ] Cover the rest of the frontend parts with unit tests.

Fourth iteration

  • [ ] Add coverage reports using external libraries for all the frontend side.

image

Example frameworks for front-end testing:

  • https://www.cypress.io/
  • https://www.protractortest.org/#/

Server side

For the server, we've already made some tests using Mocha, see https://github.com/wazuh/wazuh-splunk/tree/master/tests for details. However, they are probably outdated and some of them are broken. For this reason, we must improve and create new tests for the server side too.

image

First iteration

  • [ ] Review and fix all existing tests for the server.
  • [ ] Cover all the server side with more Mocha tests.

Second iteration

  • [ ] Add coverage reports using external libraries for all the server side.

pablotr9 avatar Jun 19 '19 08:06 pablotr9