[英]Does capybara ignore code in a before(:all) block? What can I do about this?
我完全理解為什么您應該使用before(:each)並使所有期望彼此獨立,但是我只是想知道為什么會這樣:
before(:each) { visit "/" } # Selenium visits the root path of my app
before(:all) { visit "/" } # Selenium doesn't even open firefox.
background(:all)
沒有任何反應,但是如果我在相同的上下文中引發異常,Selenium確實會打開Firefox並訪問此奇怪的空文件。
file:///home/starkers/.rvm/gems/ruby-2.0.0-p247/gems/capybara-2.2.0/lib/capybara/empty.html
那么,有誰知道Capybara是否主動忽略before塊(:all)中的代碼?
這不是一個很認真的項目,但是我正在考慮與Capybara進行基准測試,因此如果有人向我展示一種使Capybara與before(:all)一起工作的方法,那將是很好的。
這兩個before
塊有明顯的不同。
before(:each)
每次測試之前評估before(:each)
。
before(:all)
運行測試之前,對before(:all)
進行評估。 一旦。
您可能應該使用before(:each)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.