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.

Feature Request: JUnit 5 TestSource (IDE "jump to source" feature)

See original GitHub issue

Karate has a nice JUnit 5 support. IntelliJ has a nice JUnit 5 support. What is missing is support for JUnit 5 TestSource (https://junit.org/junit5/docs/current/user-guide/#writing-tests-dynamic-tests-uri-test-source) which would allow clicking on a failed test…

image

to jump to the corresponding scenario: image

Currently we implement that feature on our own:

    fun ScenarioResult.asTestSourceUri(): URI {
        val workingDir = System.getProperty("user.dir")
        val featurePath = scenario.feature.relativePath.replace("classpath:", "")
        val line = scenario.line

        return URI.create(File("$workingDir/src/test/resources/$featurePath").toURI().toString() + "?line=$line")
    }

Though it works, implementation could be more robust and also for that to work we virtually had to turn Karate upside down as the URI is required during the DynamicTest instantiation.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
ptrthomascommented, Oct 17, 2020

@chaudharydeepak this is great, I think the IDE auto experience is good enough

1reaction
ptrthomascommented, Oct 19, 2020

@chaudharydeepak yes I haven’t thought this through - actually we may be overthinking this - what if this was just yet another param we can pass into the Runner / RunnerOptions etc and even CLI

Read more comments on GitHub >

github_iconTop Results From Across the Web

JUnit 5 TestSource (IDE "jump to source" feature) · Issue #1329
What is missing is support for JUnit 5 TestSource ... Feature Request: JUnit 5 TestSource (IDE "jump to source" feature) #1329.
Read more >
JUnit 5 User Guide
The goal of this document is to provide comprehensive reference documentation for programmers writing tests, extension authors, and engine ...
Read more >
Writing Tests with JUnit 5 | The IntelliJ IDEA Blog
In this tutorial we're going to look at features of JUnit 5 that can make it easier for us to write effective and...
Read more >
How to Write Effective Unit Tests in Java - Twilio
How To Test Code With JUnit 5 · A Glance At The Test Source Set · Importing JUnit 5 With Gradle · Create...
Read more >
Writing JUnit Tests in NetBeans IDE
java from the sample project JUnitSampleSol into the class library project that you created. In the Projects window, right-click the Source Packages node...
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