正在寻找将用于FitNesse测试的Fit夹具转换为Slim的解决方案。
我得到了命令行Fit fixture。
由于我所有的Fitnesse测试系统都在Slim上运行,因此我需要以CommandLineFixture
作为Slim来执行测试中的bash脚本。
任何其他解决方法都应该对我有用。
我正在尝试执行FitNesse测试中的脚本,并且该脚本在运行我的Fitnesse服务器的服务器中的文件中写入了一些文本。
但是我正在用provided fixture观察其打开文件,并且没有在其中写入任何文本。
所以只想检查Fitnesse是否对执行写入文件的脚本有任何约束。
此外,我已将所有rwx
权限授予文本文件
下面是我修改过的脚本:
!define TEST_SYSTEM {slim}
!path ../fixtures/*.jar
|Import |
| nl.hsac.fitnesse.fixture.slim.ExecuteProgramTest |
|script |
|set |-c |as argument|0 |
|set |ls -l / |as argument|1 |
|execute|/bin/bash |
|check |exit code |0 |
|show |standard out |
|check |standard error|!--! |
执行上述测试未获得任何响应,结果为:
测试页:0正确,0错误,1被忽略,0例外
断言:0对,0错误,0被忽略,0个异常
(0.456秒)
我已经有一个辅助方法来在我的my fixture library中启动程序,但是我今天开始从事夹具的工作。 execute program test灯具适合您吗?
示例用法:
我们可以运行带有一些参数的程序,检查其退出代码并显示其输出。
|script |execute program test |
|set |-c |as argument|0|
|set |ls -l / |as argument|1|
|execute|/bin/bash |
|check |exit code |0 |
|show |standard out |
|check |standard error|!--! |
程序执行的默认超时为一分钟,但是我们可以设置自定义超时。此外,我们可以控制从中调用它的目录,使用列表设置所有参数,并使其输出为“未格式化”。
|script |execute program test |
|check |timeout |60000 |
|set timeout of |100 |milliseconds|
|set working directory|/ |
|set |-c, ls -l |as arguments|
|execute |/bin/bash |
|check |exit code |0 |
|show |raw standard out |
|check |raw standard error|!--! |
也可以以秒为单位设置超时,并传递环境变量(对进程的输出进行转义以确保其正确显示。)>
|script |execute program test |
|set timeout of|1 |seconds |
|set value |Hi <there> |for |BLA|
|set |-c |as argument|0 |
|set |!-echo ${BLA}-!|as argument|1 |
|execute |/bin/bash |
|check |exit code |0 |
|check |raw standard out |!-Hi <there>
-!|
|check|standard out|{{{Hi <there>
}}}|