| Summary: | Consider adopting JUnit 4 for tests | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Ralf Sternberg <rsternberg> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | ruediger.herrmann |
| Version: | 1.5 | ||
| Target Milestone: | 2.0 RC1 | ||
| Hardware: | PC | ||
| OS: | Linux | ||
| Whiteboard: | |||
|
Description
Ralf Sternberg
+1 Though JUnit 4 treats every method that has a @Test annotation as a test, I would prefer to keep the convention that every test must start with "test". I see your point. With the "test" prefix, the methods names start with a verb and make their meaning more clear. But OTOH, I also don't like the redundancy in @Test testXXX. When you look at the method name as the assumption under test, wouldn't the former of these two look better? @Test public void callBackRequestIsReleasedOnSessionInvalidate() @Test public void testCallBackRequestIsReleasedOnSessionInvalidate() Another point is the tooling support. In the outline, you can easily distinguish testXXX methods from others. But then again, do we have any public methods in our test classes that are not methods? (In reply to comment #2) > I see your point. With the "test" prefix, the methods names start with a verb > and make their meaning more clear. But OTOH, I also don't like the redundancy > in @Test testXXX. I agree that the redundancy isn't nice. > When you look at the method name as the assumption under test, wouldn't the > former of these two look better? > > @Test > public void callBackRequestIsReleasedOnSessionInvalidate() > > @Test > public void testCallBackRequestIsReleasedOnSessionInvalidate() > > Another point is the tooling support. In the outline, you can easily > distinguish testXXX methods from others. But then again, do we have any public > methods in our test classes that are not methods? Unlikely that there are public methods that aren't tests. However, having every method start with test also allows to filter (Ctr+O + "test"). This is what I prefer over visually distinguish green (=public test) methods from differently colored non-test methods in the outline. As of commit af36901793519270685d7e1240a5ca8ee110c6f6, all tests have been migrated to JUnit4. I did not change any method names. |