Class: Crab::TestCase

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

Constant Summary collapse

PRIORITIES =
%w{useful important critical}
RISKS =
%w{low medium high}
METHODS =
%w{automated manual}
TYPES =
%w{acceptance functional non-functional performance regression usability}

Instance Method Summary collapse

Constructor Details

#initialize(rally_test_case, dry_run) ⇒ TestCase

Returns a new instance of TestCase.



10
11
12
13
# File 'lib/crab/testcase.rb', line 10

def initialize(rally_test_case, dry_run)
  @rally_test_case = rally_test_case
  @dry_run
end

Instance Method Details

#deleteObject



47
48
49
50
51
52
53
# File 'lib/crab/testcase.rb', line 47

def delete
  if @dry_run
    puts "Would delete test case #{formatted_id}"
  else
    @rally_test_case.delete
  end
end

#formatted_idObject



15
16
17
# File 'lib/crab/testcase.rb', line 15

def formatted_id
  @rally_test_case.formatted_i_d
end

#nameObject



19
20
21
# File 'lib/crab/testcase.rb', line 19

def name
  @rally_test_case.name
end

#priorityObject



27
28
29
# File 'lib/crab/testcase.rb', line 27

def priority
  @rally_test_case.priority
end

#riskObject



31
32
33
# File 'lib/crab/testcase.rb', line 31

def risk
  @rally_test_case.risk
end

#stepsObject



63
64
65
# File 'lib/crab/testcase.rb', line 63

def steps
  Array(@rally_test_case.steps).map {|step| step.input }
end

#storyObject



43
44
45
# File 'lib/crab/testcase.rb', line 43

def story
  Crab::Story.new(@rally_test_case.work_product, @dry_run)
end

#tagsObject



23
24
25
# File 'lib/crab/testcase.rb', line 23

def tags
  [priority, risk, test_method, test_type].map &:parameterize
end

#test_methodObject



35
36
37
# File 'lib/crab/testcase.rb', line 35

def test_method
  @rally_test_case.elements[:method]
end

#test_typeObject



39
40
41
# File 'lib/crab/testcase.rb', line 39

def test_type
  @rally_test_case.elements[:type]
end

#update(options) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/crab/testcase.rb', line 55

def update(options)
  if @dry_run
    puts "Would update test case #{formatted_id} with #{options.inspect}"
  else
    @rally_test_case.update options
  end
end