随着我们的应用程序接近生产准备,我们已经编写了大量的规范测试。最初我们使用bundle exec rspec spec/myspec_spec.rb
来运行单个文件。当我尝试origen specs
命令时,它没有像我预期的那样重新识别命令。
peologin02:ppekit $ origen specs
Error: Command not recognized: specs
Usage: origen COMMAND [ARGS]
The core origen commands are:
environment Display or set the environment (short-cut alias: "e")
target Display or set the target (short-cut alias: "t")
mode Display or set the mode (short-cut alias: "m")
plugin Display or set the plugin (short-cut alias: "pl")
generate Generate a test pattern (short-cut alias: "g")
program Generate a test program (short-cut alias: "p")
interactive Start an interactive Origen console (short-cut alias: "i")
compile Compile a template file or directory (short-cut alias: "c")
exec Execute any Ruby file with access to your app environment
rc Revision control commands, see -h for details
save Save the new or changed files from the last run or a given log file
lsf Monitor and manage LSF jobs (short-cut alias: "l")
web Web page tools, see -h for details
time Tools for test time analysis and forecasting
lint Lint and style check (and correct) your application code
我在main website没有看到任何关于规范测试的内容。
THX
答案 0 :(得分:1)
origen_specs
的实现包含在新的应用模板中,但已被注释掉。
查看您应用的config/commands.rb
文件,希望这只是取消评论所需行的问题。
你看到的Origen应用程序和插件中常用的origen specs
命令几乎没有什么魔力 - 它只是包含你在Origen命令启动器中已经在做的事情。
该过程是按照指南在此处添加特定于应用程序的命令:http://origen-sdk.org/origen/guides/misc/commands/
然后specs
命令的内容就是:
# Run the unit tests
when "specs"
require "rspec"
exit RSpec::Core::Runner.run(['spec'])
上面只是以编程方式在应用程序的spec目录上调用RSpec,并将退出代码(即通过/失败)从RSpec分配给origen
命令的结果。