Sha256: 995e94d7b93a07afff1e0538c3d62fd25124da7b0878cf9aa77b7f1f6032ecdc

Contents?: true

Size: 1.63 KB

Versions: 1

Compression:

Stored size: 1.63 KB

Contents

require_relative './test_xml_generator'

class TestCucumberPublisher < Test::Unit::TestCase
  def test_postbuild_cucumber_json_publisher
    file_location = 'cucumber/results.json'
    ignore_bad_results = 'false'

    builder = JenkinsJob::Builder.new

    builder.freestyle 'foo' do
      postbuild do
        cucumber_json_publisher do
          test_results file_location
          ignore_bad_tests ignore_bad_results
        end
      end
    end

    actual = builder.config_as_xml_node('foo')

    {
      'testResults' => file_location,
      'ignoreBadSteps' => ignore_bad_results,
    }.each do |k, v|
      path = ['./project/publishers/org.jenkinsci.plugins.cucumber.',
              "jsontestsupport.CucumberTestResultArchiver/#{k}"].join('')
      assert_equal v, actual.xpath(path).text
    end
  end

  def test_selenium_job

    builder = JenkinsJob::Builder.new

    builder.freestyle 'foo' do
      node 'master'

      parameter 'TEST_ENV' do
        description 'The environment that the cucumber tests will be run against'
        default 'PreRelease'
      end
   
      git do
        url 'git@github.com:ServiceFrame/webtests.git'
        basedir 'webtests'
        branches 'master'
      end
   
      pollscm 'H/30 * * * *'
   
      xvfb do
        install_name 'Xvfb'
      end
   
      shell 'cd webtests && cucumber'

      postbuild do
        cucumber_json_publisher do
          test_results 'cucumber/results.json'
          ignore_bad_tests false
        end
      end
  
    end

    actual = builder.config_as_xml_node('foo')

    puts actual
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyjobbuilderdsl-0.0.2 test/test_cucumber_json_publisher.rb