在测试用例期间部署工件 - JBoss AS
我有一个非常具体的测试用例:
- 我必须部署 JAR
- 做一些测试
- 部署另一个 JAR
- 做更多测试
JAR 必须按此特定顺序部署(在调用测试方法之前我无法同时部署两者)
你知道吗有什么方法可以在类似 JUnit 的环境中执行这种情况吗? 我知道 1. 绝对可以在 Arquillian 中完成,但我不知道是否有可能在测试方法中执行另一个部署。
I have a very specific test case:
- I have to deploy JAR
- Do some testing stuff
- Deploy another JAR
- Do some more testing
JARs have to be deployed in this specific order (I can't deploy both before invocation of the test method)
Do you know any way to perform such scenario in some JUnit-like environment?
I know that 1. can be definitely done in Arquillian but I don't know if there's a possibility of performing another deployment inside the test method.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以在 Arquillian 中使用 TestMethod 中的 Deployer api 来执行此操作。
首先,您必须定义您的 @Deployment 不由 Arquillian 管理:
下一步是注入 Deployer:
然后从您的 @Test 方法中您可以调用:
如果您的部署 X 设置为容器内测试(@Deployment .testable=true(默认行为)),您可以在刚刚部署的部署中执行下一个 @Test 方法。
默认情况下,JUnit TestMethods 以随机顺序执行,但 Arquillian JUnit 集成提供了 @InSequence(n) 注释,您可以使用它来强制执行顺序。
You can do this in Arquillian using the Deployer api from within your TestMethod.
First you have to define your @Deployment to not be managed by Arquillian:
The next step would be to inject a Deployer:
Then from within your @Test method you can call:
If your deployment X is setup for in-container testing (@Deployment.testable=true (default behavior)), you can have the next @Test method be executed inside the deployment you just deployed.
By default JUnit TestMethods are executed in random order, but Arquillian JUnit integration provide a @InSequence(n) annotation you can use to force the order of execution.
测试方法刚刚执行 - 另外,您必须能够从那里进行部署。如果您已经通过设置阶段测试进行了设置部署工作,那么测试是否有效
Test method is just executed - also, you must be able to deploy from there. I f you already have setup deplying stuff through set up phase testing whether it works from test is easy