Class: WatirTestlinkFramework::TestLinkPlan

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

Class Method Summary collapse

Class Method Details

.casesbyplan(tl, plan) ⇒ Object



28
29
30
31
# File 'lib/watir_testlink_framework.rb', line 28

def self.casesbyplan(tl,plan)
  plan_id = tl.test_plan_by_name($config['testlink']['project'], plan)
  return tl.test_cases_for_test_plan(plan_id[0][:id])
end

.execute_cases(tl, envstr, spectask, test_cases, dryrun) ⇒ Object



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/watir_testlink_framework.rb', line 56

def self.execute_cases(tl, envstr,spectask, test_cases,dryrun)
  test_cases.each do |tc|

    tc_customfield = tl.test_case_custom_field_design_value(tl.project_id($config['testlink']['project']),
                                                            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
  end
end

.make_env_string(envarr) ⇒ Object



73
74
75
76
77
78
79
# File 'lib/watir_testlink_framework.rb', line 73

def self.make_env_string(envarr)
  envstr=''
  envarr.each do | varname,varvalue|
    envstr+= "#{varname.upcase}='#{varvalue}' "
  end
  return envstr
end

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

plans_string comma seperated string with plans



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/watir_testlink_framework.rb', line 34

def self.run_plan_cases(plans_string, spectask='spec', dryrun=false)

  tl = self.testlinkplanconnection

  plans = plans_string.split(';')

  plans.each do | plan |
    test_cases = self.casesbyplan(tl,plan.strip)
    if $config['testlink'].has_key?("multi_env") && $config['testlink']['multi_env'] != 0
      $config['testlink']['testplans'][plan.strip].each do | envname, envarr |
        envstr = make_env_string(envarr)
        self.execute_cases(tl, envstr,spectask,test_cases,dryrun)
      end
    else
      envstr = make_env_string($config['testlink']['testplans'][plan.strip])
      self.execute_cases(tl, envstr,spectask, test_cases,dryrun)
    end

  end

end

.testlinkplanconnectionObject



22
23
24
25
26
# File 'lib/watir_testlink_framework.rb', line 22

def self.testlinkplanconnection
  server = $config['testlink']['xmlrpc_url']
  dev_key = $config['testlink']['apikey']
  return TestLinker.new(server, dev_key)
end