Module: Magnesium::TestUI

Included in:
Testcase
Defined in:
lib/magnesium/factor/test_ui.rb

Instance Method Summary collapse

Instance Method Details

#generate_UI(prefix, caseno) ⇒ Object



13
14
15
16
17
18
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
49
50
51
52
53
# File 'lib/magnesium/factor/test_ui.rb', line 13

def generate_UI(prefix,caseno)
  @hash = Hash.new

  yaml = YAML.load(File.open("#{Config.config["temp"]}#{TestLink.find_path(prefix,caseno)}"))
  yaml["web"].collect do |row|
    row.each do |k,v|
      if k == 'ui'
        v.collect do |row|
          @hash_element = Hash.new
          @hash_locate = Hash.new
          @hash_value = Hash.new
          @hash_action = Hash.new
          @hash_box = Hash.new

          @cont = Container.new
          @cont.container_mark = row["page"]["mark"]
          @cont.container_type = row["page"]["type"]
          @cont.container_title = row["page"]["title"]
          row["page"]["container"].collect do |c|
            @hash_element[c["element"]] = c["name"]
            @hash_locate[c["element"]] = c["locate"]
            @hash_value[c["element"]] = c["value"]
            @hash_action[c["element"]] = c["action"]
            unless c["box"].nil?
              @hash_box[c["element"]] = c["box"]
            end
          end

          @cont.hash_element = @hash_element
          @cont.hash_locate = @hash_locate
          @cont.hash_value = @hash_value
          @cont.hash_action = @hash_action
          @cont.hash_box = @hash_box

          @hash[row["page"]["mark"]] = @cont
        end
      end
    end
  end
  return @hash
end