jenkins_api_client icon indicating copy to clipboard operation
jenkins_api_client copied to clipboard

Write tests for command line interface

Open arangamani opened this issue 12 years ago • 6 comments

arangamani avatar Feb 11 '13 03:02 arangamani

I would like to extend the CLI to include the job copy command, and would develop some tests for that command. Do you have a preferred technology to use to develop command line application tests? Derek . . .

skidad avatar Jan 24 '14 05:01 skidad

Hi @skidad I was thinking about writing tests in cucumber as it is easy and simple. The berkshelf project has great examples. If you have other options, I would be glad to know.

arangamani avatar Jan 24 '14 06:01 arangamani

Cucumber looks perfect. I imagine I'll have a few questions before I am ready to submit a pull request. Thanks.

skidad avatar Jan 26 '14 06:01 skidad

No problem, anytime.

arangamani avatar Jan 26 '14 06:01 arangamani

I've got a single cucumber test written that repro's a problem that I've identified with running jenkinscli job list : (helper.rb crashes do to lack of require 'yaml'. on Windows, Ruby 1.9 anyway) This test requires there to be a running jenkins at localhost. I'd like to not have to require a running jenkins, as is done in the spec tests, but don't understand how its done. I see the spec tests using '@client = double' to initialize the client, but can't find a definition of double. . . . I need a hint.

skidad avatar Jan 28 '14 07:01 skidad

Correct, double is an rspec mock object. It looks like cucumber has a way to use rspec mock objects in it. Here is more information.

arangamani avatar Jan 28 '14 08:01 arangamani