Using natural language test function names with backticks


#1

Hi,

I’ve been playing with the idea of using natural language test function names with backticks. e.g.

class MyTest: TestCase() {

  fun test empty string() {
  }

  fun test single positional parameter() {
  }

  fun test multiple positional parameters() {
  }
}

This seems to be a lot more readable than the camel case equivalents such as testMultiplePositionalParameters.

This kinda works. You can run the whole test case using the jUnit Runner - it even demangles the names correctly. However, you can’t run individual tests by right-clicking and you can’t re-run tests from the jUnit Runner. Also, jUnit 4 style tests with Test annotations don’t work at all.

So my question is: should I raise a ticket to support this as a feature? Or should I stop abusing backticks?

Cheers,
Andrew


#2

Please, raise an issue.

(I’m not sure whether it is a good idea to “abuse backticks” in this way, though)


#3

As an experiment I tried adding an annotation based example using natural language test function names; it works great in the maven build. I think its just the IDE integration with the JUnit runner that doesn't seem to like it. Using back ticks in function names seems to hide the context menu Run option for running in JUnit inside IDEA.


#4

Thanks for the extra info James. I've created the following issue to track this: http://youtrack.jetbrains.com/issue/KT-2339