Best way to automagically migrate tests from JUnit 3 to JUnit 4?

前端 未结 7 1790
天命终不由人
天命终不由人 2020-11-29 20:14

I have a bunch of JUnit 3 classes which extend TestCase and would like to automatically migrate them to be JUnit4 tests with annotations such as @Before,

7条回答
  •  时光取名叫无心
    2020-11-29 21:10

    I don't know of a tool that would do this at the moment - I'd expect Eclipse to provide some plugin fairly shortly - but you could knock up a simple source tree exploring Java class that would do it for you if you only want to do a basic conversion. I had to write something similar to automatically generate skeleton test cases for a legacy application so I've got a fair amount of the support code already. You're welcome to use it.

提交回复
热议问题