我有这个规范文件,它试图运行将运行dotnet程序的脚本:
require 'spec_helper'
RSpec.describe 'Integration test', type: :aruba do
let(:command) { run "dotnet-test" }
it "test" do
command.write("test\n")
stop_all_commands
expect(command.output).to end_with("success\n")
end
enddotnet-test脚本:
dotnet run --project ../SomeProject/src/SomeProject.Console/SomeProject.Console.csproj -- $1但我知道错误是:
Failure/Error: expect(command.output).to end_with("success\n")
expected "MSBUILD : error MSB1009: Project file does not exist.\nSwitch: ../SomeProject/src/SomeProject.Console/SomeProject.Console.csproj\n\nThe build failed. Please fix the build errors and run again.\n" to end with "success\n"但是如果我从那个目录运行脚本,那么程序就能正常运行。不知道两者之间有什么区别。我们真的很感激你的帮助。
发布于 2018-11-10 12:44:50
听起来,您要运行的脚本依赖于相对路径才能正确执行。在这种情况下,您可能需要在您的规范中使用cd。
请参阅https://relishapp.com/cucumber/aruba/docs/filesystem/change-current-working-directory
尝试使用文件的绝对路径,而不是
../SomeProject/src/SomeProject.Console/SomeProject.Console.csproj你能把整条路都放进去吗,比如:
/Users/yourusername/pathtosomeproject/SomeProject/src/SomeProject.Console/SomeProject.Console.csproj显然,您需要将pathtosomeproject替换为它的实际位置。
https://stackoverflow.com/questions/53238950
复制相似问题