Spring参数化/理论JUnit测试 [英] Spring Parameterized/Theories JUnit Tests

查看:82
本文介绍了Spring参数化/理论JUnit测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望结合

I'm looking to combine the flexibility of Spring Profiles and Configurations with the parallel running of JUnit tests which utilize either the Parameterized or Theories annotation. Is there any way to incorporate all of these features to get my unit tests running?

我一直遇到的问题是参数需要访问注入的bean,这是不可能的,因为用@Parameters或@DataPoints注释的函数应该是静态的.我真的很讨厌不得不将它连接到每个类甚至某个地方的静态函数中,因为我希望能够快速切换配置文件而不必更改Java代码.这可能吗?

The problem I keep running into is the parameters need access to an injected bean, which isn't possible since the function annotated with @Parameters or @DataPoints is supposed to be static. I'd really hate to have to wire that into each class or even a static function somewhere because I'd like to quickly be able to switch profiles without having to change Java code. Is this possible?

推荐答案

找到了门票对此请求.附件似乎有问题.看起来已经有一段时间了.

Found the ticket for this request. It seems the attached file has some issues though. Looks like it's been a feature request for quite some time now.

这篇关于Spring参数化/理论JUnit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆