google / error-prone

Catch common Java mistakes as compile-time errors
https://errorprone.info
Apache License 2.0
6.84k stars 743 forks source link

Custom JUnit TestRunner #352

Open JeffFaer opened 9 years ago

JeffFaer commented 9 years ago

The current pattern for tests leaves something to be desired:

My proposal:

@interface ExpectDiagnostic {
    String value();
    String[] messageContains() default {};
    String[] fixesContain() default {};
    .
    .
}

Thoughts?

alexeagle commented 8 years ago

Sorry for the long delay. That seems pretty reasonable to me, except for a concern about placing an annotation in every place we currently have the //BUG comment - are all of those places legal to place an annotation? Are you interested in contributing this still?

tjog commented 2 years ago

Hi, we (a group part of a software engineering course at KTH) are going to try and tackle some of this issue. The sheer amount of files this affects makes it difficult to estimate how much we will accomplish, in terms of reducing Stringly typed source code test cases and annotating with @Test in Cases.java files, but the TestRunner and ExpectDiagnostic components will hopefully be implemented and then start the conversion.

tjog commented 2 years ago

So after working on this our group concludes, like the above comment suggests, annotations are not general enough to target all locations currently targeted by the // BUG comments. Further, we find the solution of annotating **Cases.java files with @RunWith(...) as contradicting the purpose of those files, as they are really only resources. The intermediate test file that "includes" the Cases files is the one which should have the custom runner annotation.

We are out of time working on this issue, but if someone were to develop this further we would revise the plan to: