Class: WatirTestlinkFramework::TestLinkPlan

Inherits:
Object
  • Object
show all
Defined in:
lib/watir_testlink_framework.rb

Class Method Summary collapse

Class Method Details

.run_plan_cases(plan, spectask = 'spec', dryrun = false) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/watir_testlink_framework.rb', line 19

def self.run_plan_cases(plan, spectask='spec', dryrun=false)
  #TODO TL BuildPrefixName
  #TODO report back
  server = $config['testlink']['xmlrpc_url']
  dev_key = $config['testlink']['apikey']
  tl_project = $config['testlink']['project']

  tl = TestLinker.new(server, dev_key)

  project_id = tl.project_id tl_project
  plan_id = tl.test_plan_by_name(tl_project, plan)

  envstr=''
  $config['testlink']['testplans'][plan].each do | varname, varvalue |
      envstr+= "#{varname.upcase}='#{varvalue}' "
  end

  test_cases = tl.test_cases_for_test_plan(plan_id[0][:id])
  test_cases.each do |tc|
    tc_customfield = tl.test_case_custom_field_design_value(project_id, tc[1][0]['full_external_id'], tc[1][0]['version'].to_i, 'RSPEC CASE ID',{:details=>''})

    exec_string = "#{envstr}bundle exec rake testlink:#{spectask} SPEC_OPTS=\"-e #{tc_customfield}\""
    if dryrun
      puts exec_string
    else
      system exec_string
    end
    #TODO exit 1 when failing
  end
end