【发布时间】:2016-05-18 06:45:58
【问题描述】:
我正在尝试为使用 [jHipster 版本 3.3.0][1] 生成的 jHipster 应用程序编写一些新的单元测试,我已将我的项目导入 [STS (w/ Gradle)][2],如果我选择“作为 Spring Boot 应用程序运行”或“作为 Spring Boot 应用程序调试”,它运行良好,并且运行 ./gradlew test 似乎运行所有测试,但是,我想只运行带有 JUnit 集成测试的单个测试[如上所述][3]:
这些测试可以直接在您的 IDE 中运行,只需右键单击每个 测试类,或者通过运行 mvn clean test (或者 ./gradlew test 如果你运行 摇篮)。
当我右键单击我的测试并使用“Run As Junit Test”时,整个应用程序似乎正在运行(尽管它提到 No Profile Selected using Default)。
这是我的简单测试类:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = MyAPP.class)
@IntegrationTest
@Transactional
public class UtilTest {
@Test
public void testGenerateRandomName(){
Assert.assertNotEquals(null,RandomUtil.generatedRandomWordString());
}
}
建议?
【问题讨论】:
标签: jhipster