0

I am running serverspec in windows machine and i am creating output in html format.

rspec 'C:\Ruby Scripts\Test.rb' --format html --out 'C:\Ruby Scripts\Test.html'

But the output html contains huge list of powershell functions in it if there are failed test case. how to omit that powershell function and get only summary?

The script is as below.

require 'spec_helper'
set :backend, :cmd
set :os, :family => 'windows'


# check the msi is installed or not
describe package('Orca') do
  it { should be_installed }
end

#
describe windows_registry_key('HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MyProductName') do
  it { should exist }
end

describe windows_registry_key('HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MyProductName') do
  it { should have_property('AppServer') }
end

describe windows_registry_key('HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MyProductName') do
  it { should have_property('DBServer') }
end

describe windows_registry_key('HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MyProductName') do
  it { should have_property('WebServer') }
end

The result is having Powershell function as given in below image. How to omit this Powershell functions from result html. enter image description here

Samselvaprabu
  • 16,830
  • 32
  • 144
  • 230
  • Sounds like lack of error handling in the rspec script. Show us `Test.rb` – Mathias R. Jessen Aug 12 '16 at 13:45
  • Can you give an example of what you want omitted and what you want retained? – Matthew Schuchard Aug 12 '16 at 19:37
  • @Matt Schuchard it shows PowerShell functions (which would be running in back) and summary result. I can make another PowerShell function to edit the html but if rspec command itself omits it would be great. – Samselvaprabu Aug 13 '16 at 08:09
  • There are three outputs from a failed test in serverspec: during the verbose output, the failed exact command from specinfra at the end, and then the rspec failure message at the very end. What are you trying to omit? Again, an example would help greatly. – Matthew Schuchard Aug 13 '16 at 12:25
  • @MattSchuchard I have added the image for an example. – Samselvaprabu Aug 16 '16 at 05:34
  • When you execute `serverspec-init`, it places a hidden `.rspec` file that contains `--format documentation`. Try removing that file and see what happens, since it enables more verbose output. – Matthew Schuchard Aug 16 '16 at 11:57

0 Answers0