Maven 测试与 ant 测试(现在更具体)
好的,关于这个的一点背景故事。我负责将项目从(糟糕的)ant 构建转换为 Maven 构建。我的第一步是简单地重新制作最终的 EAR,使其与 Ant 相似,以免给其他团队带来麻烦。
我做得很完美(谢谢你们,他们之前回答了几个问题)。
然而,现在我碰壁了。蚂蚁测试。
他们曾经直接从 Eclipse 运行 ant 测试。根据我从他们的 build.xml 中收集到的信息,他们创建了一个小 jar,部署它(在 Jetty 上),测试它,然后取消部署它。
我一直在尝试使用 Maven 进行相同的测试(认为不是以相同的方式),并且无法重现它。然而,我认为我的处理方式是错误的。我只是使用 Surefire 插件针对已部署在 JBoss 上的 EJB 运行测试。
我为什么要这么做?因为我希望通过测试成为在 JBoss 上成功部署的条件。如果它没有通过测试,我不想部署它。制作一个 jar,然后部署不会事先进行测试,而是在之后进行测试(因为我将针对编译和部署的 Ear 进行测试)。有什么提示吗?
我应该遵循他们(其他团队)曾经遵循的相同模式吗?或者我可以用另一种方式来做吗?
感谢您的任何回复!
安德烈·卡多佐 PS.:抱歉我的英语不好,这不是我的母语!
Ok, a little backstory on this one. I'm responsible for translating a project from a (terrible) ant build to a maven build. My first step was to simply remake the final EAR as similar as the Ant one, so as not to trouble the other team.
I did it all perfectly (thanks for you guys, who answered a few questions before).
However, now I've hit a brickwall. The ant tests.
They used to run ant tests, right from Eclipse. From what I've gathered from their build.xml, they create a small jar, deploy it (on Jetty), test it, and undeploy it.
I've been trying to make the same tests with maven (thought not on the same way), and was unable to reproduce it. However, I think I'm approaching it the wrong way. I'm simply running the tests with surefire plugin against the EJBs already deployed on my JBoss.
Why am I doing that? Because I want the passing tests be a condition for a successfull deploy on JBoss. I don't want to deploy it if it's not passing the tests. Making a jar, and deploying aftewards won't test beforehand, just after (since I'll be testing it against the compiled and deployed ear). Any hints?
Should I just follow the same pattern they (the other team) used to follow? Or can I do it another way?
Thanks for any responses!
André Cardoso
PS.: sorry for my mangled english, it's not my first language!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案是创建一个包含集成测试的单独模块,这意味着在您的情况下启动 JBoss、部署存档、对其运行测试并关闭 JBoss。
The solution is to create a separate module which contains the integration-tests which means in your case start JBoss, deploy the archive, run the tests against it and shut down JBoss.