Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop automated tests #7

Closed
julienmoumne opened this issue Sep 28, 2014 · 5 comments · Fixed by #45
Closed

Develop automated tests #7

julienmoumne opened this issue Sep 28, 2014 · 5 comments · Fixed by #45
Assignees
Milestone

Comments

@julienmoumne
Copy link
Member

julienmoumne commented Sep 28, 2014

As discussed in #29, a http mocking library will be used to verify the requests are received and have the expected format (ie. the right piwik parameters).

For a more detailed explanation of the approach and its goals see #46 (comment)

@tetsuo13
Copy link
Contributor

What's going to be tested? The few mocking libraries mentioned in #29 look like shims on top of HttpClient that don't provide much for increasing the dependencies of this project. Also, the idea of spinning up a Docker instance or an otherwise embedded HTTP server seems like overkill here.

If the tests are going to ensure "calling these methods in our library should produce a URL with arguments that match a known-good set" then it you could fake the response handler in sendRequest() of a call to HttpClient (this ensures no HTTP request is ever made) and test against the url parameter in that method which contains the arguments to check.

I can create a quick PoC if interested.

@julienmoumne
Copy link
Member Author

Hi Andrei, thank you for your input. If I'm not mistaken Peter has already started working on this.

We'll definitely like to have your input on the PR.

@mattab
Copy link
Member

mattab commented Jan 13, 2017

and test against the url parameter in that method which contains the arguments to check.

(fyi: this is the technique we use to test the piwik.js javascript tracker (integration tests will call a fakepiwik.php endpoint which logs the requests, then we check the expected URL params are found in the requests. and on top we have unit tests to check the methods separately. could be done even simpler in your case as you suggest)

@julienmoumne
Copy link
Member Author

That's what Peter (@ptr1120) is aiming for + being able to reproduce mismanagement of resources such as the ones that caused timeouts for several users.

@julienmoumne
Copy link
Member Author

@ptr1120 implemented several tests in #42 and #46

Tests are continuously executed on travis since #41

Let's close the ticket and continually add more tests in future commits

Let's handle code coverage tracking in #47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants