使用@Profile决定执行测试类

使用@Profile决定执行测试类,第1张

使用@Profile决定执行测试

的确如此,因为会

@Profile
影响Spring组件并且未连接到Test框架。

不过,您可以拥有测试配置文件,该配置文件将在运行测试时加载Spring组件(作为配置类)

带配置文件的Test类示例:

// load related configuration classes@ContextConfiguration(classes = { TestConfiguration.class }) @ActiveProfiles(profiles = { "testing" })public class MyTest extends AbstractTestNGSpringContextTests {


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5560010.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-14
下一篇 2022-12-14

发表评论

登录后才能评论

评论列表(0条)

保存