Skip to content

Logging of JUnitSampler exceptions#376

Closed
dfa1 wants to merge 2 commits intoapache:trunkfrom
dfa1:log_junitsampler_exceptions
Closed

Logging of JUnitSampler exceptions#376
dfa1 wants to merge 2 commits intoapache:trunkfrom
dfa1:log_junitsampler_exceptions

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
@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.

2 participants