-
Notifications
You must be signed in to change notification settings - Fork 281
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
Ensure high code coverage (now: 51.44%) #406
Comments
For the code in |
As for Not sure if As for other folders, we can surely improve coverage. |
Compiling the library as a phar is useless IMO. a phar is useful for standalone tools, but Mink is not. It is a library used by your own code. Building a phar either needs to include the vendors, which will duplicate them when using them also in yoru project (potentially with different versions thus breaking things), or to exclude them, which makes the phar unusable. Thus, I don't think the phar is kept uptodate on the website. So my suggestion is to drop the phar distribution entirely. @everzet what is your choice ? |
@stof, what is Does idea of having driver mock to improve coverage sounds good? |
For the tests for CoreDriver, this would mean checking that all methods properly throw an UnsupportedDriverActionException, but it would require adding all older methods in the CoreDriver, even though they are implemented in all our existing drivers already (which was the reason to omit them when introducing the CoreDriver). |
Since Session relies on DriverInterface and not CoreDriver, then we can safely created mock just based on interface (that is first test case). And then create another test case for existing CoreDriver implementation, that will test that exceptions are thrown where they should. |
@aik099 Except that the only code needing coverage in the Driver namespace is CoreDriver... But anyway, we have the same issue for CoreDriver than for other piece of code: many uncovered parts of the Element namespace are actually covered when running the driver tests. But as we moved drivers to separate repo, we lost all coverage reporting on the library. |
and covering the Element classes properly through unit tests only will be a huge pain because of the architecture of Mink (the driver is used inside everything) |
Not necessary. Driver is only used in session and everybody else uses session. Yes, getting larger coverage with integration tests is surely easier, than getting that through unit tests. |
@aik099 Look at the implementation of Element classes. They use the driver directly (getting it from the session) |
and we need (and have) the integration tests anyway for drivers. the issue is that drivers are in their own repo, so a coverage report will not include tests where they are run |
I wasn't expecting that one. Reaching through objects is hard to mock during unit testing. Maybe we should rethink how driver is provided to the Elements. If session itself isn't needed by elements, then we should give only driver in constructor and not a session. Getting both driver and session to constructor of an Element class seems odd, but is DI/test friendly. All these kind of thoughts, if they ever will be implemented, surely would produce a large BC break anyway. |
@aik099 IMO, we should rethink the full Mink architecture. Even when limiting to the Session and the Driver, we can already see messy object graph, as the low level Driver has a setter to receive the higher level Session. |
So, for the drivers (I've opened an issue for each driver) we can increase code coverage without much effort. As for Mink this might be done only after major refactoring in future versions. Seems reasonable? |
Code coverage information is now being available on Scrutinizer CI. It doesn't prevent us from still using Converalls.Io as a dedicated coverage reporting service. |
well, from my experience on the Doctrine repos, where coveralls regularly decides to spam the PRs with comments about the coverage changes (which is a crappy integration with github anyway), while being explicitly disabled in the config (we don't like spammy comments), I'm not very much inclined about enabling it to be honest. |
It wasn't doing so initially. Just recently saw it doing that. Doesn't like that.
And I've posted my ideas there as well. If Scrutinizer can improve code coverage reporting then of course we don't need Coveralls.Io at all. |
We now have the coverage badge in the readme of all Mink-related projects |
once #456 is merged, the coverage report for Mink will look like this: And reaching 100% coverage on the Session class is done by merging #453 as the only untested method is It is looking pretty good. The only remaining part without test is the Regarding the other repos, here is the current coverage (according to Scrutinizer):
MinkWUnitDriver does not have Scrutinizer enabled, but I don't think it is maintained anymore |
Updated list:
The drop in MinkBrowserKitDriver is because the conversion of Httpfoundation responses into BrowserKit ones is not used anymore for BrowserKit 2.3+. The 2.0 branch (dropping the support of 2.2 and below) has 91% coverage |
Updated summary:
The 2.0 branch of MinkBrowserKitDriver (dropping the support of 2.2 and below) has 97% coverage |
We are at 98% code coverage in Mink now. |
Closing this as we have a high-enough coverage in Mink itself. Other repos have their own issues to keep track of it |
Just of curiosity I've decided to check code coverage on this repo. The number appeared to be as low as 51.44%. Maybe there wasn't high coverage initially or maybe not all added code was fully covered.
Either way it's time to raise it to prevent any errors in future.
Code Coverage: 51.44%

I also suggest to start using https://coveralls.io/ service, since it can show and track code coverage change with each PR and overall for a project.
P.S.
Code, that is uncovered by tests right now might be of 2 categories:
The text was updated successfully, but these errors were encountered: