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

Invocation of method 'getTestResult' in class fitnesse.reporting.history.SuiteXmlReformatter threw exception java.lang.NullPointerException #514

Closed
konstantinvlasenko opened this issue Aug 28, 2014 · 5 comments
Milestone

Comments

@konstantinvlasenko
Copy link
Contributor

Hi All,
I have this issue if I run my suite trough command line -c ?...&format=xml.

-----Command Output-----

v20140630 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX 5 0 0 0 10858 SuiteSetUp XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.SuiteSetUp?pageHistory&resultDate=20140828152108 WARNING: error registered in test system [Invocation of method 'getTestResult' in class fitnesse.reporting.history.SuiteXmlReformatter threw exception java.lang.NullPointerException at suiteXML.vm[line 16, column 35]] org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getTestResult' in class fitnesse.reporting.history.SuiteXmlReformatter threw exception java.lang.NullPointerEx ception at suiteXML.vm[line 16, column 35] at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:243) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:187) at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280) at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:567) at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71) at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142) at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:420) at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207) at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) at org.apache.velocity.Template.merge(Template.java:356) at org.apache.velocity.Template.merge(Template.java:260) at fitnesse.reporting.history.SuiteXmlReformatter.close(SuiteXmlReformatter.java:57) at fitnesse.testrunner.CompositeFormatter.close(CompositeFormatter.java:29) at fitnesse.testrunner.MultipleTestsRunner.allTestingComplete(MultipleTestsRunner.java:75) at fitnesse.testrunner.MultipleTestsRunner.executeTestPages(MultipleTestsRunner.java:70) at fitnesse.responders.run.TestResponder.performExecution(TestResponder.java:273) at fitnesse.responders.run.TestResponder.doExecuteTests(TestResponder.java:121) at fitnesse.responders.run.TestResponder.doSending(TestResponder.java:109) at fitnesse.responders.ChunkingResponder.startSending(ChunkingResponder.java:70) at fitnesse.http.ChunkedResponse.sendTo(ChunkedResponse.java:25) at fitnesse.http.MockResponseSender$OutputStreamSender.doSending(MockResponseSender.java:57) at fitnesse.FitNesse.executeSingleCommand(FitNesse.java:89) at fitnesseMain.FitNesseMain.executeSingleCommand(FitNesseMain.java:118) at fitnesseMain.FitNesseMain.launch(FitNesseMain.java:92) at fitnesseMain.FitNesseMain.launchFitNesse(FitNesseMain.java:72) at fitnesseMain.FitNesseMain.launchFitNesse(FitNesseMain.java:51) at fitnesseMain.FitNesseMain.main(FitNesseMain.java:35) Caused by: java.lang.NullPointerException at fitnesse.reporting.history.SuiteXmlReformatter.getTestResult(SuiteXmlReformatter.java:70) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395) at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384) at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173) ... 26 more
@konstantinvlasenko
Copy link
Contributor Author

ok. I've bypassed this issue for a while https://github.com/konstantinvlasenko/fitnesse/blob/master/src/fitnesse/reporting/history/SuiteXmlReformatter.java#L73-L76
But we need to find the root cause of it. Anyway right now I can run my Fitnesse tests from TeamCity.

TestExclusionsAreNotZipped
XXXXXXXX?pageHistory&resultDate=20140828163807</pageHistoryLin
k>
WARNING: Unable to get page history




0
6
0
1

@amolenaar amolenaar added this to the Next release milestone Sep 5, 2014
@amolenaar
Copy link
Collaborator

The XML formatter is simply putting the history collected for one test run (as persisted by the page history formatters). It looks like it's not able to find a result file with the specific timestamp. The timestamps should be in sync between the suite history and test history file.

Catching this condition looks like a good thing to do anyway. Can you make a pull request out of it?

@amolenaar
Copy link
Collaborator

I think I found the error (that quick? 😆)

In TestXmlFormatter, the contents is written with a timestamp like this:

protected void writeResults() throws IOException {
  writeResults(writerFactory.getWriter(context, getPage(), getPageCounts(), totalTimeMeasurement.startedAt()));
}

In SuiteHistoryFormatter we store the reference as:

@Override
public void testStarted(WikiTestPage test) {
  String pageName = test.getFullPath();
  testHistoryFormatter = new TestXmlFormatter(context, test.getSourcePage(), writerFactory);
  testHistoryFormatter.testStarted(test);
  referenceToCurrentTest = new SuiteExecutionReport.PageHistoryReference(pageName, testHistoryFormatter.startedAt());
}

testHistoryFormatter.startedAt() returns currentTestStartTime.startedAt(), which can be a slightly different timestamp compared to totalTimeMeasurement, used by TestXmlFormatter.

I'll fix it.

amolenaar added a commit that referenced this issue Sep 5, 2014
@konstantinvlasenko
Copy link
Contributor Author

I still have this (or similar) issue in the latest release:
java [12:23:15]WARNING: error registered in test system [Invocation of method 'getTestResult' in class fitnesse.reporting.history.SuiteXmlReformatter threw exception java.lang.NullPointerException at suiteXML.vm[line 16, column 35]] [12:23:15]org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getTestResult' in class fitnesse.reporting.history.SuiteXmlReformatter threw exception java.lang.NullPointerException at suiteXML.vm[line 16, column 35] [12:23:15] at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:243) [12:23:15] at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:187) [12:23:15] at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:280) [12:23:15] at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:567) [12:23:15] at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71) [12:23:15] at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142) [12:23:15] at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72) [12:23:15] at org.apache.velocity.runtime.directive.Foreach.render(Foreach.java:420) [12:23:15] at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:207) [12:23:15] at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:342) [12:23:15] at org.apache.velocity.Template.merge(Template.java:356) [12:23:15] at org.apache.velocity.Template.merge(Template.java:260) [12:23:15] at fitnesse.reporting.history.SuiteXmlReformatter.close(SuiteXmlReformatter.java:51) [12:23:16] at fitnesse.testrunner.CompositeFormatter.close(CompositeFormatter.java:29) [12:23:16] at fitnesse.testrunner.MultipleTestsRunner.allTestingComplete(MultipleTestsRunner.java:70) [12:23:16] at fitnesse.testrunner.MultipleTestsRunner.executeTestPages(MultipleTestsRunner.java:65) [12:23:16] at fitnesse.responders.run.SuiteResponder.performExecution(SuiteResponder.java:283) [12:23:16] at fitnesse.responders.run.SuiteResponder.doExecuteTests(SuiteResponder.java:129) [12:23:16] at fitnesse.responders.run.SuiteResponder.doSending(SuiteResponder.java:117) [12:23:16] at fitnesse.responders.ChunkingResponder.startSending(ChunkingResponder.java:70) [12:23:16] at fitnesse.http.ChunkedResponse.sendTo(ChunkedResponse.java:25) [12:23:16] at fitnesse.http.MockResponseSender$OutputStreamSender.doSending(MockResponseSender.java:57) [12:23:16] at fitnesse.FitNesse.executeSingleCommand(FitNesse.java:89) [12:23:16] at fitnesseMain.FitNesseMain.executeSingleCommand(FitNesseMain.java:115) [12:23:16] at fitnesseMain.FitNesseMain.launch(FitNesseMain.java:89) [12:23:16] at fitnesseMain.FitNesseMain.launchFitNesse(FitNesseMain.java:69) [12:23:16] at fitnesseMain.FitNesseMain.launchFitNesse(FitNesseMain.java:48) [12:23:16] at fitnesseMain.FitNesseMain.main(FitNesseMain.java:32) [12:23:16]Caused by: java.lang.NullPointerException [12:23:16] at fitnesse.reporting.history.SuiteXmlReformatter.getTestResult(SuiteXmlReformatter.java:64) [12:23:16] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [12:23:16] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [12:23:16] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [12:23:16] at java.lang.reflect.Method.invoke(Unknown Source) [12:23:16] at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:395) [12:23:16] at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:384) [12:23:16] at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:173)

@konstantinvlasenko
Copy link
Contributor Author

Please, re-open this issue.
I'll use my workaround for a while in my fork.
But I am going to spend some time to fix an original issue.

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

No branches or pull requests

2 participants