-
Notifications
You must be signed in to change notification settings - Fork 68
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
Reports are created but no summary (NullPointerException in Utils.groovy) #63
Comments
try to add a try/catch block to your summary and detail template in order to output errors which might been thrown by the templates. At least, that's what helped me in the past. |
Thanks for the suggestion. I will report any progress. |
I may have found something, there is a NullPointerException thrown within
Update: This seems to be a bug. The commit is from release 1.2.10 and the error won't occur with 1.2.9. |
@renatoathaydes This NullPointerException may be a bug in the latest release. |
My test project does not cause this issue. Can you make sure to clean the build directory (so there's no hidden files in the directory where the reports are created) and try to run your tests again? Are you trying to run an empty Specification? |
BTW to enable logging by spock-reports (and see more clearly errors like this), follow the instructions on README (just add these to your Gradle file): dependencies {
...
testCompile group: 'org.slf4j', name: 'slf4j-simple', version: '1.7.13'
}
test {
// set spock-reports logging level
systemProperty 'org.slf4j.simpleLogger.defaultLogLevel', 'debug'
} |
I get the error only if I use my own summary template via For stacktrace I add the prefix: <%
try {
%> and suffix: <%
} catch (Exception ex) {
org.codehaus.groovy.runtime.StackTraceUtils.sanitize(ex).printStackTrace()
}
%>
The suggestion witzh slf4j did not print the error only silently failed. |
Can you please try to find out what exactly causes this exception? What is different in yours? |
Yep, my template also runs fine, I can't reproduce this. |
Is that because you are catching the Exception in your template, maybe? |
Incorrect, ignore! Yes, the error is cause by def stats = utils.aggregateStats( data ) must be def stats = data because The stats are already extracted when void addData( SpecData specData ) {
log.debug( "Adding data to report ${specData.info.description.className}" )
aggregatedData[ specData.info.description.className ] = Utils.stats( specData )
} TLDR Also: Also: Am I correct to assume that there is a spec for testing the report but not the summary? That's probably why this one slipped through. |
Okay, seems to be incorrect what I assumed about the |
Do you have tests which are executed? Or is the |
No, tests execute normally. I made a pull request with a fix. But maybe @renatoathaydes will want to refactor this alltogether. |
@rdmueller The problem can be reproduced by making using |
@mfuerstenau Thank you for the PR! I have confirmed the bug and, related, another bug regarding the logger which does not work for that particular class (and maybe others, but at least some classes are logging fine!! I am investigating it). I will take your PR and then try to fix the loggers so they show errors like this in the future. Thanks! |
Please notice the commit where I fixed the default summary template to use the new aggregated data structure. Will have to update all current templates as this is a breaking change... sorry about that. |
@rdmueller @mfuerstenau if you guys could help by testing master before I make a new release, I would really appreciate... everything seems to be working on my side. |
I can run tests and get reposrts for each test but not a summary.
my
.properties
-file isthe paths are correct and no error is thrown or logged. I run
test
with or without single tests. Is a summary supposed to be always created. I do have a fileaggregated_report.json
created inside myspock-reports
directory though. I use version 1.2.4.The text was updated successfully, but these errors were encountered: