Junit 在使用mule';s org.mule.tck.FunctionalTestCase?
我们将org.mule.tck.FunctionalTestCase用于测试用例。这是一个抽象的JUnit测试用例 以下是在pom.xml中声明依赖项的方式:Junit 在使用mule';s org.mule.tck.FunctionalTestCase?,junit,mule,Junit,Mule,我们将org.mule.tck.FunctionalTestCase用于测试用例。这是一个抽象的JUnit测试用例 以下是在pom.xml中声明依赖项的方式: ... <dependency> <groupId>org.mule.tests</groupId> <artifactId>mule-tests-functional</artifactId> <scope&
...
<dependency>
<groupId>org.mule.tests</groupId>
<artifactId>mule-tests-functional</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
...
问题是doStuff()从未被调用。我的理解是在每次测试之前调用@Before注释的方法。此外,@Test注释不是插件的一部分。看起来我也需要从org.junit导入它,但我不相信它是受支持的
在使用org.mule.tck.FunctionalTestCase时,我们可以使用JUnit注释吗
---更新---
我发现FunctionalTestCase的父类AbstractMuletTestCase有一个名为doSetUp()的方法,我可以在测试中重写该方法。与@Before方法一样,它在每次测试之前都会被调用。我仍然希望使用注释,因为JUnit文档中没有列出doSetUp()。如果扩展org.mule.tck.FunctionalTestCase类,则必须遵守其规则,即覆盖doSetUp()。请注意,JUnit文档中没有概述doSetUp(),因为它特定于FunctionalTestCase 否则,扩展org.mule.tck.junit4.FunctionalTestCase,它是junit4友好的
import org.junit.Before;
import org.mule.tck.FunctionalTestCase;
public class SomeSuiteTest extends FunctionalTestCase {
protected String getConfigResources() {
return "my-mule-config.xml";
}
@Before
public void doStuff() {
...
}
public void testThisCode() throws Exception {
...
}
}