mica 中 test 扩展 mica-boot-test 单元测试插件

5次阅读

共计 932 个字符,预计需要花费 3 分钟才能阅读完成。

介绍
由于在 mica-launcher 组件中我们埋入了一些配置,该组件为了方便单元测试。
依赖坐标
Maven
<dependency>
<groupId>net.dreamlu</groupId>
<artifactId>mica-boot-test</artifactId>
<scope>test</scope>
</dependency>
Gradle
testCompile “net.dreamlu:mica-boot-test”
使用方式
示例代码一
采用 @RunWith(MicaSpringRunner.class)。
@SpringBootTest
@MicaBootTest(“appName”)
@RunWith(MicaSpringRunner.class)
public class MicaExampleApplicationTests {
@Test
public void contextLoads() {
}
}
示例代码二
继承 MicaBaseTest。
@SpringBootTest
@MicaBootTest(“appName”)
public class ApplicationTests extends MicaBaseTest {
@Test
public void contextLoads() {
}
}
说明:上面 2 种方式均可,@MicaBootTest 注解属性有:服务名、profile 和 enableLoader。
开源推荐

Spring boot 微服务高效开发 mica 工具集:https://gitee.com/596392912/mica

Avue 一款基于 vue 可配置化的神奇框架:https://gitee.com/smallweigit/avue

pig 宇宙最强微服务(架构师必备):https://gitee.com/log4j/pig

SpringBlade 完整的线上解决方案(企业开发必备):https://gitee.com/smallc/SpringBlade

IJPay 支付 SDK 让支付触手可及:https://gitee.com/javen205/IJPay

加入【如梦技术】Spring QQ 群:479710041,了解更多。

关注我们

扫描上面二维码,更多精彩内容每天推荐!

正文完
 0