From: SourceForge.net <no...@so...> - 2009-10-23 13:45:56
|
Bugs item #2866423, was opened at 2009-09-25 05:39 Message generated for change (Settings changed) made by dsaff You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=115278&aid=2866423&group_id=15278 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: framework Group: None >Status: Pending Resolution: None Priority: 7 Private: No Submitted By: Reinhold Füreder (reinholdfuerede) Assigned to: Nobody/Anonymous (nobody) Summary: Only one (the last) filter is considered Initial Comment: In the course of upgrading from JUnit 4.4 to JUnit 4.7 I stumbled over this bug: @Test public void testMultipleFilters() throws Exception { JUnitCore junitCore = new JUnitCore(); Request request = Request.aClass(ExampleTest.class); Request requestFiltered = request.filterWith(new SingleMethodNameFilter("test1")); Request requestFilteredFiltered = requestFiltered.filterWith(new SingleMethodNameFilter("test2")); Result result = junitCore.run(requestFilteredFiltered); printResult(result); assertEquals(1, result.getRunCount()); // Fails here: actual 2 } private static class SingleMethodNameFilter extends Filter { private String methodName; public SingleMethodNameFilter(String methodName) { this.methodName = methodName; } @Override public boolean shouldRun(Description description) { return !description.getMethodName().equals(methodName); } @Override public String describe() { return "filter method name: " + methodName; } } public class ExampleTest { @Test public void test1() throws Exception { System.out.println("Run: test1"); assertEquals(1, 1); } @Test public void test2() throws Exception { System.out.println("Run: test2"); assertEquals(1, 1); } @Test public void test3() throws Exception { System.out.println("Run: test3"); assertEquals(1, 1); } } ---------------------------------------------------------------------- >Comment By: David Saff (dsaff) Date: 2009-10-23 09:45 Message: Can you please move this bug over to github at http://github.com/KentBeck/junit/issues? We'll be closing this tracker down soon. ---------------------------------------------------------------------- Comment By: Reinhold Füreder (reinholdfuerede) Date: 2009-09-25 05:52 Message: Of course one could make a composite Filter, but the old behaviour and the API seem to show that this limitation is not on purpose. The Bug "ID: 2094316" ("Request.filterWith has bizarre behavior") is kind of related, but does not point to the main problem in my mind. Moreover, the filtering is carried out too often in my mind (we are using filters for a range of QA/TA related aspects): e.g. in the testSingleFilter() method the filters shouldRun() method is called 11 times for ExampleTest (containing 3 test cases): @Test public void testSingleFilter() throws Exception { Request requestFiltered = request.filterWith(new SingleMethodNameFilter("test1")); Result result = junitCore.run(requestFiltered); printResult(result); assertEquals(2, result.getRunCount()); } ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=115278&aid=2866423&group_id=15278 |