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
base: trunk
from

Conversation

Projects
None yet
2 participants
@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

This comment has been minimized.

Show comment
Hide comment
@FSchumacher

FSchumacher Feb 15, 2018

Contributor

Thanks for your contribution.

Contributor

FSchumacher commented Feb 15, 2018

Thanks for your contribution.

@FSchumacher

This comment has been minimized.

Show comment
Hide comment
@FSchumacher

FSchumacher Feb 15, 2018

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?

Contributor

FSchumacher commented Feb 15, 2018

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

This comment has been minimized.

Show comment
Hide comment
@dfa1

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

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

Log assertion errors with a lower criticality
Part of #376 on github


git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1824658 13f79535-47bb-0310-9956-ffa450edef68

ham1 added a commit to ham1/jmeter that referenced this pull request Jun 20, 2018

JUnitSampler logs exceptions except assertion-failures from test case…
…s as warnings.

Contributed by Davide Angelocola (davide.angelocola at fisglobal.com)
Closes apache#376 on github


git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1824355 13f79535-47bb-0310-9956-ffa450edef68

ham1 added a commit to ham1/jmeter that referenced this pull request Jun 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment