I have construct like this in my Scala tests:
class ExpressionsTest extends AnyFunSpec {
describe("simple literals") {
describe("valid") {
it("123") {
runTest("123")
}
it("123.456") {
runTest("123.456")
}
// gazillions of other tests here
}
}
def runTest(ex: String) {
// some repetitive implementation of a test
// includes assertions, which sometimes break
}
}
... and there a lot of instances of it(...) which provide structure of test cases, every one of them calling runTest(...) internally. However, when a test breaks, Intellij IDEA navigates to inner lines of runTest(...) (which are normally not broken), and I want it to navigate to test case itself — i.e. it(...) line.
Two alternative ways I'm aware of are:
- Obviously, copying
runTest(...)into every single method — ugly and error-prone - Macros, effectively doing these same embedding of
runTest(...)intoit(...), which seems to be a huge overkill here
Is there any way to achieve nicer developer's experience with IntelliJ IDEA here?