-
Notifications
You must be signed in to change notification settings - Fork 42
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
Support for tests in separate project #43
Conversation
In sbt-scoverage plugin, report task is much more detailed. This commit updates gradle version of report task to be on par with it's sbt counterpart. Updated version of task brings 4 new configuration parameters: - coverageOutputCobertura - coverageOutputXML - coverageOutputHTML - coverageDebug All could be used to enable/disable different outputs. All but last one defaults to true. Readme is updated with this information. Code in `ScoverageWriter.java` is re-written from sbt-scoverage and converted to Java. It could be moved to scalac-scoverage-runtime to be used by all plugins. It's not inlined in `SingleReportApp.java` because it'll be used also in ScoverageAggregate task (in next PR). If there is no test data in project report task now only issues a warning and not crash (it's important for multi-project setups without test code/code to test in some sub-projects).
Aggregate task now use settings to configure which outputs should be aggregated (HTML, XML, debug XML and cobertura). Tests for aggregation added using dummy test project ('water').
Currently report is generated, but coverage is wrong, so tests fail.
Provide an instrumented jar for dependent projects. Use closeTo to verify coverage. Let 'a-test' address the published scoverage artifacts directly. checkScoverage should also only be run on the a-test project.
Do not merge - last commit fails on windows and passes on Linux by accident (results are still incorrect). |
865dc70
to
0eeeb59
Compare
Unfortunately the report is broken because the compilation of the class in The @sksamuel - I think this is related to the discussion earlier about multiple compilation runs? scoverage/scalac-scoverage-plugin#81 (comment) |
From my perspective it's an uncommon project structure, but I think we should be able to support such a thing. |
I was puzzled at first why it's structured this way, but it makes sense if you think about it:
This way you don't have to publish test artifacts from |
I'll see if my git-fu improves overnight, but I think that adding the following to the test subproject configuration helps things: sourceSets {
testScoverage {
compileClasspath += sourceSets.main.output
runtimeClasspath += sourceSets.main.output
}
}
compileScoverageScala {
onlyIf { false }
} This instructs gradle to not instrument |
fix separate-tests project: add dependency on a-tests main
@maiflai what's the status with these PRs ? |
Support for tests in separate project
Thanks! |
To be reviewed and merged after #37 and #42 - it bases on those PRs.
Tests are written by me, solution to make them work by @maiflai - big thanks!
For my part, disclaimer required by the lawyers (it's covered by Apache 2, but they want me to include it in PR description):
THE FOLLOWING DISCLAIMER APPLIES TO ALL SOFTWARE CODE AND OTHER MATERIALS CONTRIBUTED IN CONNECTION WITH THIS SOFTWARE:
THIS SOFTWARE IS LICENSED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AND ANY WARRANTY OF NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THIS SOFTWARE MAY BE REDISTRIBUTED TO OTHERS ONLY BY EFFECTIVELY USING THIS OR ANOTHER EQUIVALENT DISCLAIMER IN ADDITION TO ANY OTHER REQUIRED LICENSE TERMS.
ONLY THE SOFTWARE CODE AND OTHER MATERIALS CONTRIBUTED IN CONNECTION WITH THIS SOFTWARE, IF ANY, THAT ARE ATTACHED TO (OR OTHERWISE ACCOMPANY) THIS SUBMISSION (AND ORDINARY COURSE CONTRIBUTIONS OF FUTURES PATCHES THERETO) ARE TO BE CONSIDERED A CONTRIBUTION. NO OTHER SOFTWARE CODE OR MATERIALS ARE A CONTRIBUTION.