Tag: 自动测试

无效选项: – autospec

/usr/local/bin/ruby -rrubygems -e “require ‘redgreen'” /usr/local/lib/ruby/gems/1.8/gems/rspec-1.3.0/bin/spec –autospec -O spec/spec.opts invalid option: –autospec Test::Unit automatic runner. Usage: -e [options] [– untouched arguments] which spec says “/usr/local/bin/spec” which autospec says “/usr/local/bin/autospec” /usr/local/bin/spec –help includes –autospec option in the list. 我在这里想念的是什么?

未在Windows上从自动测试接收Growl消息

我正在关注Ruby on Rails教程(http://ruby.railstutorial.org)。 在第3章中,作者介绍了测试。 一切似乎都按照说明工作,但在启动自动测试后我没有收到Growl通知(绿色或红色)。 另外,在Growl中,它说“没有应用程序已经注册”。 参考文献: 我尝试了autotest-growl自述文件中提到的两个gem安装 我盲目地装载了gemkarl-autotest-growl,尽管描述它的博客虽然写得很清楚,但有点过时了 ph7spot有一个相当[详细的walkthough] [4]来设置linux,windows和xos的自动测试(http://ph7spot.com/musings/getting-started-with-autotest) 我的设置: Windows 7 64位 Growl v2.0.6(build 2.0.6.1) c:\ Sites.autotest文件内容: require ‘autotest/growl’ require ‘autotest/fsevent’ require ‘redgreen/autotest’ require “test_notifier/autotest” gemfile内容: source ‘http://rubygems.org’ gem ‘rails’, ‘3.0.7’ gem ‘sqlite3-ruby’, ‘1.3.2’, :require => ‘sqlite3’ group :development do gem ‘rspec-rails’, ‘2.5.0’ end group :test do gem ‘rspec’, ‘2.5.0’ gem ‘webrat’, […]

在一切都变绿之后,如何让autospec / test不运行完整的测试套件?

与twitter中的 waloeiii相同的问题: 在一切都变绿之后,如何让autospec / test不运行完整的测试套件? 我写的下一个测试将是红色的! 我宁愿手动运行完整的测试套件。 顺便说一句,我尝试添加一个失败的规范: it “should flunk” do flunk end 但是当感觉它时,autospec似乎忽略了它。

如何使用selenium ruby​​点击IE 11上的打开/保存/取消按钮

尝试使用Selenium和Ruby选择和/或按IE 11中的保存按钮 我试过这段代码: “ driver.action..send_keys(“${KEY_ALT}S”).perform ”和“ RAutomation ” 没有成功,虽然我相信其中任何一个都可行。 我确信在使用这些方法之前必须完成这项工作。 作为最后的手段,我将使用Autoit,虽然我宁愿不。 如果有人可以使用“RAutomation”或“driver.action。+一个或多个上述操作+ .perform”给我一个解决方案,那将非常感谢 IE 11下载文件提示

使用javascript executor为selenium webdriver ruby​​绑定脚本启用禁用字段

我正在编写Selenium Webdriver脚本中的Ruby代码,以通过Javascript执行器在UI上启用禁用字段。 browser.execute_script(“browser.find_element(:xpath,’/html/body/div[5]/div/div[3]/div[2]/div[2]/div/div/div/div/div/div/input’.disabled = false”) 但面对, `handleEvaluateEvent’:语法错误(Selenium :: WebDriver :: Error :: JavascriptError) 我的语法有什么问题? 任何帮助将不胜感激。 谢谢! 阿布舍克

如何使用Watir 6.0下载文件

我正在尝试使用新的Watir 6.0下载CSV文件。 我找到了Firefox的配置文件设置: profile = Selenium::WebDriver::Firefox::Profile.new profile[‘browser.download.folderList’] = 2 profile[‘browser.download.dir’] = path_to_download profile[‘browser.helperApps.neverAsk.saveToDisk’] = “text/csv” browser = Watir::Browser.new :firefox, :profile => profile 但Firefox 50.0不支持加载配置文件设置。 我收到此错误消息: /var/lib/gems/2.3.0/gems/selenium-webdriver-3.0.0/lib/selenium/webdriver/remote/w3c_bridge.rb:80:in `initialize’: unknown option: {:profile=>#<Selenium::WebDriver::Firefox::Profile 我还尝试了Chrome的配置文件设置: profile = Selenium::WebDriver::Chrome::Profile.new profile[‘download.prompt_for_download’] = false profile[‘download.default_directory’] = path_to_download browser = Watir::Browser.new :chrome, :profile => Profile 但文件将不会保存,文件保存对话框也不会关闭。 所以两者都不适用于新的Watir。 有没有人知道用Watir下载文件的方法?

如何动态地将部分添加到SitePrism页面对象?

我正在使用SitePrism来测试我的Web应用程序。 我有许多扩展SitePrism::Page的类,许多经常使用的HTML片段由扩展SitePrism::Section匹配类表示 class Login < SitePrism::Section element :username, "#username" element :password, "#password" element :sign_in, "button" end class Home < SitePrism::Page section :login, Login, "div.login" end 问题是,我正在处理的应用程序基于CMS,其中可以通过基于预定义内容选择模板然后将任意数量的可用组件拖放到页面上来组装页面。 初始开发人员创建了一个页面对象来镜像每个可用的模板 。 只要测试数量很少并且我们不得不在我们的function文件中测试的页面变体太多,这就没问题了。 随着多个测试用例的增加,页面对象开始以惊人的速度增长。 虽然我们可以通过为CMS中可用的每个组件定义Sections并在页面对象中重用它们来轻松减轻代码重复,但是很多属性很少被使用。 class BlogPost < SitePrism::Page section :logo, MySite::Components::Logo, '.logo' section :navigation, MySite::Components::Navigation, '.primary-navigation' section :header, MySite::Components::BlogHeader, '.header' section :introduction, MySite::Components::Text, '.text .intro' # and so […]

rspec中的相关测试

我写了function测试,我需要做的测试取决于之前测试的通过。 假设我有一个按钮,可以打开一个有function的窗口。 也就是说,为了检查这个function,我需要先检查按钮的正确操作(即打开窗口或不起作用)。 所以,我需要这样做,如果按钮点击测试失败,测试没有运行以检查function窗口。 单独编写测试 – 对我来说不是一种选择。 我想看到这样的事情: describe “some tests” do open_result = nil it “should check work button” do click_to_button() open_result = window_opened? open_result.should == true end if open_result describe “Check some functional” do it “should check first functional” it “should check second functional” end end end 我知道这种方法对rspec不起作用。 这只是我想要看到的简单描述。 使用rspec可以实现吗? 如果没有,还有其他方式(gem等)

数组测试自动化的示例

请问我可以获得ruby数组的帮助以获取所有文本………….请找到附件 # 例如: ary = @browser.p(class:”sv ng-binding ng-scope”) ary = Array.new p ary.length ary.each do |myRole| puts “User role: #{myRole.text}” end #但它不起作用

如何使用selenium-webdriver(ruby)使用相同的浏览器窗口进行自动测试?

我正在使用selenium-webdriver和ruby中的黄瓜自动化网站的测试用例。 我需要每个function以特定顺序运行并使用相同的浏览器窗口。 每个function都会创建一个新窗口来运行测试。虽然在某些测试用例中需要这种行为 – 但在许多情况下并非如此。 从我的研究到目前为止,似乎有关于是否可以在整个测试用例中使用selenium驱动相同浏览器窗口的混合答案。 我遇到的大多数答案都是针对其他语言的,并且是针对浏览器特定的解决方案(我在测试IE时开发我的测试,但预计会在其他浏览器中运行这些测试)。 我在Ruby工作,从我读过的内容看起来似乎我必须为该页面创建一个类? 我很困惑为什么我必须这样做或如何帮助。 我的env.rb文件: require ‘selenium-webdriver’ require ‘rubygems’ require ‘nokogiri’ require ‘rspec/expectations’ Before do @driver ||= Selenium::WebDriver.for :ie @accept_next_alert = true @driver.manage.timeouts.implicit_wait = 30 @driver.manage.timeouts.script_timeout = 30 @verification_errors = [] end After do #@driver.quit #@verification_errors.should == [] end 到目前为止,我收集了一些有类似问题的人提供的信息: https : //code.google.com/p/selenium/issues/detail? id = 18 有没有办法将已运行的浏览器附加到java中的selenium webdriver ? 如果我的问题有任何不清楚的地方,请问我问题。 […]