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

Cannot get an exception's stack trace via ExceptionResult class #1162

Closed
jinlxz opened this issue Nov 6, 2018 · 3 comments
Closed

Cannot get an exception's stack trace via ExceptionResult class #1162

jinlxz opened this issue Nov 6, 2018 · 3 comments

Comments

@jinlxz
Copy link

jinlxz commented Nov 6, 2018

Hi,

I designed a custom class A implemented the class TestSystemListener , I can't get the stack trace of an exception in the override method testExceptionOccurred, my code is as follows:

	@Override
	public void testExceptionOccurred(Assertion assertion, ExceptionResult exceptionResult) {
		// TODO Auto-generated method stub
        String message = (exceptionResult.getMessage()==null)?"":exceptionResult.getMessage();
      // xmlnode is an instance of class org.w3c.dom.Element
        xmlnode.setAttribute(ATTR_MESSAGE, message);
	}

the variable message is always empty when executing some test case with exception, also methods getActual() and getExpected() of class TestResult return null, I suppose they can return some useful information, exceptionResult.getMessage() returns the stack trace and the previous 2 calls return the expectation and actual result in the test, is it a bug of Fitnesse?

Can you help me with these issues?

Thanks.

@six42
Copy link
Contributor

six42 commented Nov 6, 2018 via email

@jinlxz
Copy link
Author

jinlxz commented Nov 8, 2018

Thank you six42.

I fixed it, I converted the instance of class ExceptionResult to that of class SlimExceptionResult and invoked the method getException() on it, it returned the stack trace successfully.

@jinlxz jinlxz closed this as completed Nov 8, 2018
@six42
Copy link
Contributor

six42 commented Nov 8, 2018 via email

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