同时集成测试两个 Grails Web 应用程序?
我有两个 grails 应用程序:A
和 B
。
A
对 B
进行显式 REST 调用,我想要一种自动方式来了解其工作原理。在传统的 Grails 集成测试模型中,一次仅拉出一个实例。我正在使用 jenkins 作为我的构建服务器,但似乎我需要部署两者系统并在本地运行测试,我不确定詹金斯是否支持。
使用 B
对 A
进行全面集成功能测试的最佳方法是什么?
I've got two grails applications, A
and B
.
A
makes explicit REST calls to B
, and I'd like an automated way of knowing this works. In the traditional grails integration-test model, only a single instance is pulled up at a time. I'm using jenkins as my build server, but it almost seems like I would need to deploy both systems and run tests locally, which I'm not sure jenkins supports.
What's the best way to do full integration functional testing of A
using B
?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
成功构建后,使用 jenkins 将应用程序部署到容器中。并具有一些环境属性或配置来在应用程序 A 中设置应用程序 B 的 url。
use jenkins to deploy your apps to a container after successfull builds. and have some environment property or config that sets the url of app B in app A.
这并不是 Grails 甚至 Jenkins 所独有的,但这就是您可以做的。
设置功能测试服务器,您可以在其中部署应用程序。创建一项 Jenkins 作业来轮询项目
A
以了解 SCM 更改并部署到服务器A
,创建一项作业来轮询项目B
以了解 SCM 更改并部署到服务器B
。创建下游构建
C
,它针对组合系统运行任何功能测试。请注意,您可能不想在此处引导任一数据库,因此不要使用集成测试阶段。在这里你可以使用像硒这样的东西。确保在下游构建上阻止上游构建A
和B
,并在所有上游构建上阻止C
。这样,在测试运行期间就不会重新部署服务器。
至于集成测试,想象一下
B
就像任何其他 Web 服务一样,例如数据库或 LDAP 服务器或任何其他东西。如果您想要进行完整的集成测试,您只需为测试运行设置一个服务器并针对它运行,对吧?做同样的事情。使用您的B
构建或其他构建,创建一个明确了解B
服务器的集成测试作业。This isn't unique to grails or even Jenkins, but here's what you can do.
Set up a functional test server where you can deploy your applications. Create one Jenkins job to poll project
A
for SCM changes and deploy to serverA
, and one job to poll projectB
for SCM changes and deploy to serverB
.Create a downstream build,
C
, which runs any functional tests against the combined system. Note that you probably don't want to bootstrap either database here, so don't use the integration test phase. This where you would use something like selenium. Make sure to block both upstream buildsA
andB
on dowstream builds, and blockC
on all upstream builds.That way, no server gets re-deployed in the middle of a test-run.
As for integration testing, imagine
B
to be like any other web service, like a database or an LDAP server or anything. If you wanted a full integration test, you'd just setup a server for your test run and run against it, right? Do the same. Using yourB
build or another build, create an integration test job which explicitly knows about theB
server.