运行Cucumber测试时的Rails应用程序端口 [英] Port of the Rails app when running Cucumber tests

查看:159
本文介绍了运行Cucumber测试时的Rails应用程序端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法得到,在测试中,rails应用程序运行黄瓜测试期间的端口?我尝试了Capybara.server_port,但是没有。

Is there a way to get, in the test, the port in which the rails app is running during cucumber test? I tried Capybara.server_port but that's nil.

谢谢。

推荐答案

使用selenium驱动程序时,端口可以在以下位置找到:

When using the selenium driver, the port can be found on:

Capybara.current_session.driver.rack_server.port

,当使用webkit驱动程序时,它可以在以下位置找到:

and when using the webkit driver, it can be found on:

Capybara.current_session.driver.server_port

,您可以设置

Capybara.server_port

到一个已知的值并使用。

to a known value and use that.

这篇关于运行Cucumber测试时的Rails应用程序端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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