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

Logging of JUnitSampler exceptions #376

Closed
wants to merge 2 commits into from

Conversation

dfa1
Copy link

@dfa1 dfa1 commented Feb 14, 2018

Description

Logging of any non-assert exception generated inside a test.

Motivation and Context

The main motivation is to speedup fixing of errors inside test methods. We have a big test suite that
is run using the JUnitSampler using this pattern:

private final Logger logger = LoggerFactory.getLogger(getClass());

@Test
public void testName() {
    try {
       // test body
    } catch (Exception ex) {
        logger.warn("caught exception", ex);
        throw ex;  
   }
}

With this change the code would be simpler:

@Test
public void testName() {
     // test body
}

How Has This Been Tested?

Still to be tested. Since we are using jmeter-maven-plugin, we need to install the JMeter core in the local maven repository. There is a quick way to do this using ant?

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.

@asfgit asfgit closed this in d50d8d8 Feb 15, 2018
@FSchumacher
Copy link
Contributor

Thanks for your contribution.

@FSchumacher
Copy link
Contributor

Some discussion about the performance impact of the log messages has taken place on the dev mailing list.

Would this patch be still useful for you, if we logged the messages at debug or info level?

@dfa1
Copy link
Author

dfa1 commented Feb 15, 2018

Thanks to you for accepting this change.

Naturally It would be still useful at info or debug level: the important point imho is to see the complete stacktrace when a test throws an exception.

asfgit pushed a commit that referenced this pull request Feb 18, 2018
Part of #376 on github


git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1824658 13f79535-47bb-0310-9956-ffa450edef68
@dfa1 dfa1 deleted the log_junitsampler_exceptions branch September 5, 2019 20:01
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

Successfully merging this pull request may close these issues.

None yet

2 participants