我正在尝试设置谷歌应用程序脚本的单元测试,我发现了两个项目:
https://code.google.com/p/gas-unit/ https://code.google.com/p/gasunit/
所以我很困惑使用哪个:-)
我刚接触了unhyphenated gasunit,似乎期望脚本嵌入在电子表格中,我对如何做有点不清楚......我要测试的脚本是基于Web的脚本而不是电子表格那些
我有更多的运气测试连字符气体单元,它设法向我发送测试的电子邮件输出并在我的谷歌网站生成结果页面:
https://sites.google.com/site/testappscript2/TestResults
所以我现在打算加油机,但我真的很想看到一些由谷歌合并的官方测试框架.特别是我想找到一些方法让这些脚本以某种频率运行,以便向我发送结果.我也很想得到一些BDD; 看到我的其他帖子:
如何让Cucumber/Capybara/Mechanize对抗外部非rails网站 如何使用capybara has_text
来吧谷歌,你所有的浴室都有"测试岩石,调试糟透了"吗?如何更好地测试对Google Apps脚本的支持?
这是我的设置,基于这个建议:如何让Cucumber/Capybara/Mechanize对抗外部非铁轨站点
它一直有效,直到我向URL添加参数.有关解决此问题的任何建议吗?
require 'rspec'
require 'capybara/rspec'
require 'capybara/dsl'
@test_url = "test"
RSpec.configure do |config|
config.include Capybara::DSL
end
Capybara.configure do |config|
config.run_server = false
config.current_driver = :selenium
config.app = "fake app name"
config.app_host = "http://site.com/#{@test_url}"
end
Run Code Online (Sandbox Code Playgroud)
这很好用:
describe "the page, without URL parameters" do
it "shows the regular form" do
visit "/registration.aspx"
page.should have_content "YES"
end
end
Run Code Online (Sandbox Code Playgroud)
但是这个:
describe "the page, when not fully pre-filled" do
it "shows the regular form if only passed the attendance" do
visit "/registration.aspx?r=y"
page.should …Run Code Online (Sandbox Code Playgroud) 我用黄瓜做很多事情.我非常喜欢它作为BDD环境.
所以我想将它作为外部工具来测试API.我想做的事情如下:
Scenario: Hit api /info path and get info back
When I visit the API path '/info'
Then I should see the following text "Here's info on the API"
Run Code Online (Sandbox Code Playgroud)
或类似的东西.我主要想将API视为黑盒子,只测试输入和输出.我不打算检查API中的任何内容.
我看过的与Cucumber(例如Capybara)合作的大多数库似乎都是围绕基于Rack的应用程序设计的.我想要类似的东西,但不依赖于Rack.
存在哪些没有机架依赖性的宝石(如果有的话).或者有没有办法使用Capybara来测试远程服务器上的API?