How to run all JUnit tests in a category/suite with Ant?

前端 未结 2 1090
孤街浪徒
孤街浪徒 2020-12-01 07:58

I\'m using JUnit Categories and ClassPathSuite in a setup similar to that described in this answer. To recap:

public interface FastTests {
}

@RunWith(Catego         


        
2条回答
  •  情深已故
    2020-12-01 08:47

    I found a workaround to use ant's junit task to run test of a specific Category:

    
        
    
        
            
            
    
            
                
                    
                    
                
            
        
    
    

    Execute test by supplying category.name property to ant like this:

    ant -Dcategory.name=FastTests test
    

    Using batchtest will also produce separate JUnit XML report files per test (e.g. TEST-fi.foobar.FastTestClassN.xml).

提交回复
热议问题