Skip to content

Behavioural, functional and unit testing suite

Olivier Paroz edited this page Aug 25, 2015 · 6 revisions

Intro

Automated testing is really needed in some key areas as it's not possible to understand all the repercussions a simple change can have. It can also help detect changes in core.

There is a lot of documentation on the Internet about the whys and the hows. This is just a short summary of how we think it should work in this project.

Unit testing

Speed Coverage
☀️☀️☀️

Tests each method in isolation by mocking and stubbing the objects, scalars, arrays it uses

  • 100% coverage is not necessary as the law of diminishing returns does apply here
  • Private and static methods are testable if needed, just use the right tool for the job

Integration testing

Speed Coverage
☀️☀️

Tests components together, especially the interaction with core components

  • Key components which interact with ownCloud's public API should be tested. Things like Environment, Preview and FilesService
  • Any method which involves a lot of mocking should be part of an integration test to try and cover many cases without spending too much time writing the test

API testing

Speed Coverage
☀️

It's a good way to make sure the response the frontend gets are in line with what's happening in the backend.

  • Tests the controllers and the services they use.
  • Validates status codes, error messages, content-type, etc.
  • Makes sure the published REST APIs always works

Acceptance testing

Speed Coverage
☁️

This is to make sure that the user interface behaves as expected. It's really easy to silently break something in Javascript per example and by automating the detection of elements and using the interface as a user, we can make sure we don't let down users by shipping a broken product.

  • Can take screenshots of the entire journey
  • Can be cross-browser tested

Documentation

Testing the Gallery app

https://github.com/owncloud/gallery/blob/master/tests/README.MD

Reports