如何从黄瓜/ aruba捕获shell脚本程序输出?(How to capture shell script program output from cucumber/aruba?)
我想从黄瓜功能文件中捕获我正在运行的输出。
我创建了一个shell脚本程序并将其放在/ usr / local / bin /中,因此可以从系统中的任何位置访问它。
abc_qa.sh -
arg=$1 if [[ $arg = 1 ]] then echo $(date) fi
黄瓜项目结构 -
阿鲁巴 -
。
├──功能
│├──支持
││└──env.rb
│└──use_aruba_cucumber.feature
├──Gemfile
Gemfile -
source 'https://rubygems.org' gem 'aruba', '~> 0.14.2'
env.rb -
require 'aruba/cucumber'
use_aruba_cucumber.feature -
Feature: Cucumber Scenario: First Run When I run `bash abc_qa.sh 1`
我想在黄瓜本身捕获这个abc_qa.sh程序输出,并通过使用任何类型的简单测试来比较这个日期是对还是错,并将此测试作为通过。
I want to capture output which I'm running from the cucumber feature file.
I created one shell script program and placed it in /usr/local/bin/ so it can be accessible from anywhere in system.
abc_qa.sh -
arg=$1 if [[ $arg = 1 ]] then echo $(date) fi
project structure of cucumber -
aruba -
.
├── features
│ ├── support
│ │ └── env.rb
│ └── use_aruba_cucumber.feature
├── Gemfile
Gemfile -
source 'https://rubygems.org' gem 'aruba', '~> 0.14.2'
env.rb -
require 'aruba/cucumber'
use_aruba_cucumber.feature -
Feature: Cucumber Scenario: First Run When I run `bash abc_qa.sh 1`
I want to capture this abc_qa.sh program output in the cucumber itself and compare this date is right or wrong by using any kind of simple test and make this test as a pass.
原文:https://stackoverflow.com/questions/40436944
最满意答案
不幸的是,你不能用Selenium IDE做到这一点。 IDE并不是设计用来做这样的事情,因为Selenium Rc允许你做IDE可以做的事情以及更多,因为你使用你喜欢的语言与代理说话,然后使用该语言的能力写入的东西磁盘。
IDE旨在帮助您使用记录功能获取测试用例的框架,然后进行调整,重播以查看其工作情况,然后导出为您喜欢的语言
Unfortunately you can not do this with Selenium IDE. The IDE has not been designed to do things like this since there is Selenium Rc that allows you to do what the IDE can do and more since you use your favourite language to speak to a proxy and then use that language's ability to write things to the disk.
The IDE is designed to help you get the skeleton of a test case with the record function, you then tweak it, replay to see it works and then export to your favourite language
相关问答
更多-
您应该能够使用getUserWindow而不是getCurrentWindow获取变量。 看下面的例子: assertEval | this.browserbot.getUserWindow().myVar | Hello World! You should be able to get variables using the getUserWindow rather than getCurrentWindow. See the following example: assertEval | this.b ...
-
不,您无法在Selenium IDE中捕获异常。 您需要使用Selenium RC来捕获和处理异常。 No, you cannot catch exceptions in Selenium IDE. You would need to use Selenium RC to catch and handle exceptions.
-
链接中提到的代码 - 它是纯Java。 如果要在窗口之间切换,则无需对站点JavaScript进行任何修改。 您可以使用WebDriver库执行任何测试自动化。 browser是WebDriver类的一个实例,它有switchTo()方法。 在其他绑定语言(C#,Ruby,Python)中,出于相同的目的,有类似的方法。 The code that is mentioned in the link - it's pure Java. You don't need to do any modification ...
-
您可以使用Selenium IDE的Flow控件插件获得循环。 但是,这里开始使用Selenium IDE的问题。 该工具实际上仅用于基本交互 - 录制,播放,导出。 如果你试图结合一些复杂的逻辑,它将是非常困难,不可维护,而且经常是hacky。 如果你想要合并......那么...... 任何形式的逻辑,你将不得不使用Selenium Webdriver所需的任何真正的编程语言。 这将使您能够做任何事情 - 编程语言的全部功能以及完整的浏览器控制。 通常的做法是在IDE中记录基础知识,用您喜欢的语言将其导 ...
-
您没有变量集。 如果您设置了变量,则会看到以下错误消息:[error]找不到标签“x”的选项 而不是找不到标签'$ {varUserID}'的选项 你的第二个例子(使用javascript)我觉得无法正常工作,因为你试图将测试与javascript结合起来,这样可行:javascript {'label ='+ storedVars ['variable']} You do not have the variable set. If your variable was set you'd see this ...
-
在IDE中,使用storeCookieByName函数提供cookie名称和您希望值存储cookie的变量名称。 In the IDE use the storeCookieByName function providing the cookie name and the variable name you want the value to store the cookie into.
-
只需将表[5]更改为表格即可。 完整的XPath将是: //div[@id='content-main']/form[2]/table/tbody/tr[td[1][contains(text(), 'Purchase')]]/td[2] Just change table[5] to table. The full XPath will then be: //div[@id='content-main']/form[2]/table/tbody/tr[td[1][contains(text(), ' ...
-
以下是步骤: Options->Format -> select format of your choice例如。 的junit / TestNG的/ isfw 转到“ Source tab 。 以特定格式导出测试用例 File->Export Test Case As -> select format Selenium IDE的一个有用功能是,它提供了设置剪贴板格式的选项,以便您可以从表格视图中复制命令并粘贴您选择的语言格式。 Options->Clipboard Format -> set forma ...
-
在selenium ide中存储变量的html源代码或内容?(Storing html source or contents of a variable in selenium ide?)[2022-02-16]
不幸的是,你不能用Selenium IDE做到这一点。 IDE并不是设计用来做这样的事情,因为Selenium Rc允许你做IDE可以做的事情以及更多,因为你使用你喜欢的语言与代理说话,然后使用该语言的能力写入的东西磁盘。 IDE旨在帮助您使用记录功能获取测试用例的框架,然后进行调整,重播以查看其工作情况,然后导出为您喜欢的语言 Unfortunately you can not do this with Selenium IDE. The IDE has not been designed to do t ... -
Selenium IDE和CKEditor(Selenium IDE and CKEditor)[2023-07-11]
加载页面后暂停一秒可以使其正常工作。 我想sekium是在ckeditor开始之前提交的。