@diosmosis opened this Issue on October 20th 2014 Member

Currently system tests (through Fixtures) will invoke many HTTP requests via curl to track visits. Instead of doing this in EVERY system test, we should create two new system tests that use HTTP (one for the normal HTTP tracker API, and another for bulk tracking). Then change all fixtures to use LocalTracker. This will hopefully speed up tests and make it easier to maintain the old system tests.

TODO:

  • [ ] create HttpTrackingTest. We should look through all existing fixtures and see how the HTTP API is tested and make sure those tests that require being tested through an HTTP request are replicated in the new test.
  • [ ] create BulkTrackingTest. Do the same as above just for bulk tracking requests only.
  • [ ] switch to LocalTracker in all Fixtures. Should probably be enough to change Fixture::getTracker
  • [ ] make sure there are no major drops in code coverage

Notes:

  • LocalTracker was written a long time ago as a hack to improve test speed. Sometime in the future when the tracker is refactored, we should switch to doing something like:
$tracker = new \Piwik\Tracker();
$tracker->track(...);

CC-ing @tsteur since you've been thinking about refactoring tests for a while now.

@tsteur commented on October 20th 2014 Owner

What I have in mind is getting rid of all SystemTests except maybe 10 or 50 ;) Long term...

Not sure if LocalTracker would make it much faster but curious. Maybe you can test with one or two tests easily whether there is a big difference?

@diosmosis commented on October 20th 2014 Member

I doubt it will make it that much faster, in my past experience it was a tiny bit faster than using a bulk tracking request. Anyway that's more of a side effect, the main improvement is better scoped tests.

I don't consider this the only thing to do to the tests, but I think it's a good first step to take to clean up the test suites, w/o losing our existing coverage.

This Issue was closed on July 8th 2016
Powered by GitHub Issue Mirror