question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Explore use of InvocationInterceptor to disable (parameterized) tests

See original GitHub issue

In #163, I wrote:

We just updated to Jupiter 5.5 (#278) to use the new InvocationInterceptor API. If that API gets called for individual parameterized test invocations, it would be a very powerful way to implement disabling parameterized tests. The provided Invocation allows skipping tests and the ReflectiveInvocationContext seems to give access to the actual arguments. Someone should look into that and possibly create an issue if the approach seems promising. 😊

Yes, someone should.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
nipafxcommented, Dec 22, 2020

I was told I need to make an executive decision - here it is:

  • parameter names: use where possible, otherwise exception with good explanation
  • and/or for several annotations: or, i.e. as soon as one @DisableIf-check passes, the test is disabled
  • contains and matches: disallow use of both in the same annotation for now - we can then revisit the decision later

And there’s more: We change @DisableIfDisplayName to also disallow use of both contains and matches. That change needs to be highlighted in the new documentation (including the version where that change was added.)

2reactions
Michael1993commented, Nov 27, 2020

After wasting about an hour, I learned that while we could use Parameter#getName, it only works if the information was included during compilation (which can be checked with Parameter#isNamePresent).

I’ve created an alternate approach that’s index based. That’s always available, at least.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disable Parameterized Test - JUnit Pioneer
This extension can be used to selectively disable parameterized tests based on their arguments (converted with toString() ). The extension comes with three ......
Read more >
JUnit 5 User Guide
@Disabled. Used to disable a test class or test method; analogous to JUnit 4's @Ignore . Such annotations are not inherited. @Timeout.
Read more >
Is it possible to disable a Parameterized test basis arguments ...
No, as of JUnit Jupiter 5.6 (pending GA release at the time of this writing), there is no way to access the arguments...
Read more >
Guide to JUnit 5 Parameterized Tests - Baeldung
In this tutorial, we're going to explore parameterized tests in depth, ... Learn how to use the Parameterized JUnit test runner with a ......
Read more >
Parameterized tests - ServiceNow Docs
Dependencies for custom applications · Application files ... Exploring App Engine Studio ... Disable component preset event mappings.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found