-1

We are writing serverspec ruby scripts.

We are writing multiple scripts as each script validates certain portion of the application.

how to run all the scripts together and get one final report?

Samselvaprabu
  • 16,830
  • 32
  • 144
  • 230

2 Answers2

0

According to the documentation you can use -m and -j [NUMBER] parameters for the rake task to execute tests in parallel.

Maciej Małecki
  • 2,725
  • 19
  • 29
0

You can modify the Rakefile that you use to execute the serverspec tests so that the scripts are run together. In your Rakefile, you should see the task being generated in a block of code like this:

RSpec::Core::RakeTask.new(symbol)

The symbol is probably the fqdn, but you may have changed it something else. Inside of there, you should see something like:

task.pattern = 'spec/{file_pattern}'

You can adjust the file pattern to capture all of your ruby scripts in that task. For example, if you have app_validate_1_spec.rb, app_validate_2_spec.rb, and app_validate_3_spec.rb all inside your spec directory:

task.pattern = 'spec/{app_validate_1_spec.rb,app_validate_2_spec.rb,app_validate_3_spec.rb}'

would do it for you. You could also do:

task.pattern = 'spec/app_validate_{1,2,3}_spec.rb'

or

task.pattern = 'spec/*_spec.rb'

Just make sure that the pattern matches everything you want to run for the task that executes serverspec on the server. You can also get creative with requires. You could have a app_validate_spec.rb with:

require_relative 'app_validate_1_spec.rb'
require_relative 'app_validate_2_spec.rb'
require_relative 'app_validate_3_spec.rb'

and then

task.pattern = 'spec/app_validate_spec.rb'
Matthew Schuchard
  • 25,172
  • 3
  • 47
  • 67