qaxqa 1.1.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b51c8cd17e3afd9219264b735614f0469dd8541
4
- data.tar.gz: 59b608f6c33b892151e6235619e557966398817e
3
+ metadata.gz: 409afbda05836886fdf360aad8b0ed9efa2d8d49
4
+ data.tar.gz: a2efffbf3a61e1818c65f6e543bec76bce0b31fe
5
5
  SHA512:
6
- metadata.gz: 2358fbe88c9ed619bd8c74cb0b7adc9bb75d311c55e22fe92eedc9c0bcd5821c577bb86d8cb6d261f822658fbfbb3b74519d29ed36c4c64a2bae38d0650fe742
7
- data.tar.gz: 18f022d9e370a70e2c641ffc80754e298483769937a06f1f301b75dabd5c3d6ff13b89f43d55782a5978249ec23c9790b45f6b9b8464afd7565e256e57b519bd
6
+ metadata.gz: d1ed8f65b873d33acbd190ed58e6acfa8185b56c6790d5c05e9a50154c95cef922d355f2181b83e4cff3181caade9b7d24549287eb9fc8840adb3d0604d6b5ac
7
+ data.tar.gz: 654aaf984f4aaad10f4f8fb7b4b2b839cfafdd21dfc2c67067ca892310f32704f0700e9f9afff5e8f614cf9f0ce48b727f35ff8147fc1865ec05659d10b5efb6
@@ -1,5 +1,7 @@
1
1
  require "qaxqa/testcase"
2
2
  require "qaxqa/testsuite"
3
+ require "qaxqa/step"
4
+
3
5
  module Qaxqa
4
6
 
5
7
  # Module class to set XML parsed attributes
@@ -18,9 +20,8 @@ module Qaxqa
18
20
  def fetch!(path)
19
21
  require 'nokogiri'
20
22
  @doc = Nokogiri::XML(File.open(path))
21
- @doc.xpath("//testsuite/testsuite/testsuite").each do |suite|
22
- @testsuites << Testsuite.new(suite)
23
- end
23
+
24
+ @testsuites = Testsuite.parse(@doc)
24
25
  end
25
26
 
26
27
  end
@@ -14,13 +14,31 @@ module Qaxqa
14
14
  private
15
15
 
16
16
  def to_hpqc(file)
17
- extract file
18
-
17
+ suites = extract file
19
18
  workbook = RubyXL::Workbook.new
20
19
  worksheet = workbook.worksheets[0]
21
20
  set_header worksheet
22
-
23
- workbook.write("spec/output.xlsx")
21
+ line = 0
22
+ suites.testsuites.each_with_index do |s|
23
+ line += 1
24
+ worksheet.add_cell(line, 0, s.subject)
25
+ worksheet.add_cell(line, 1, s.test_name)
26
+ worksheet.add_cell(line, 2, s.details)
27
+ s.testcases.each_with_index do |tc|
28
+ tc.steps.each_with_index do |step|
29
+ line +=1
30
+ worksheet.add_cell(line, 0, tc.subject)
31
+ worksheet.add_cell(line, 1, tc.test_name)
32
+ worksheet.add_cell(line, 2, tc.summary)
33
+ worksheet.add_cell(line, 3, tc.preconditions)
34
+ worksheet.add_cell(line, 4, step.step_number)
35
+ worksheet.add_cell(line, 5, step.actions)
36
+ worksheet.add_cell(line, 6, step.expectedresults)
37
+ worksheet.add_cell(line, 7, tc.test_type)
38
+ end
39
+ end
40
+ end
41
+ workbook.write("output.xlsx")
24
42
  end
25
43
 
26
44
  def extract(xml)
data/lib/qaxqa/step.rb ADDED
@@ -0,0 +1,10 @@
1
+ module Qaxqa
2
+
3
+ # Module class to set XML parsed attributes to a Step object
4
+ class Step
5
+
6
+ attr_accessor :step_number, :actions, :summary, :expectedresults
7
+
8
+ end
9
+
10
+ end
@@ -3,7 +3,7 @@ module Qaxqa
3
3
  # Module class to set XML parsed attributes to a testcase object
4
4
  class Testcase
5
5
 
6
- attr_accessor :name
6
+ attr_accessor :subject, :test_name, :summary, :preconditions, :steps, :test_type
7
7
 
8
8
  end
9
9
 
@@ -3,16 +3,44 @@ module Qaxqa
3
3
  # Module class to set XML parsed attributes to a suitecase object
4
4
  class Testsuite
5
5
 
6
- attr_accessor :subject, :test_name
6
+ attr_accessor :subject, :test_name, :details, :testcases
7
7
 
8
- def initialize(doc = nil)
9
- parse! doc unless doc.nil?
10
- end
11
-
12
- private
8
+ def self.parse(doc)
9
+ root = doc.xpath("//testsuite/testsuite")
10
+ main_subject = root.first.attributes["name"].value
11
+ suites = []
12
+ # Parse suites
13
+ root.each do |node|
14
+ unless node.attributes["name"].nil?
15
+ suite = Testsuite.new
16
+ suite.subject = main_subject
17
+ suite.test_name = node.attributes["name"].value
18
+ suite.details = node.xpath("./details").text
19
+ suite.testcases = []
20
+ # Parse testcases
21
+ node.children.xpath("./testcase").each do |tc|
22
+ testcase = Testcase.new
23
+ testcase.steps = []
24
+ testcase.subject = suite.subject
25
+ testcase.test_name = tc.attributes["name"].value
26
+ testcase.summary = tc.xpath("./summary").text
27
+ testcase.preconditions = tc.xpath("./preconditions").text
28
+ testcase.test_type = "Manual"
29
+ # Parse steps
30
+ tc.xpath("./steps/*").each do |step_node|
31
+ step = Step.new
32
+ step.step_number = step_node.xpath("./step_number").text
33
+ step.actions = step_node.xpath("./actions").text
34
+ step.expectedresults = step_node.xpath("./expectedresults").text
35
+ testcase.steps << step
36
+ end
13
37
 
14
- def parse!(doc)
15
- @subject = doc.xpath("//testsuite/testsuite").first.attributes["name"].value
38
+ suite.testcases << testcase
39
+ end
40
+ suites << suite
41
+ end
42
+ end
43
+ return suites
16
44
  end
17
45
 
18
46
  end
data/lib/qaxqa/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Qaxqa
2
- VERSION = "1.1.1"
2
+ VERSION = "1.3.0"
3
3
  end
data/output.xlsx CHANGED
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qaxqa
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ronaldo Possan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-03 00:00:00.000000000 Z
11
+ date: 2017-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -177,6 +177,7 @@ files:
177
177
  - lib/qaxqa/all_suite.rb
178
178
  - lib/qaxqa/cli.rb
179
179
  - lib/qaxqa/cli/migrate.rb
180
+ - lib/qaxqa/step.rb
180
181
  - lib/qaxqa/testcase.rb
181
182
  - lib/qaxqa/testsuite.rb
182
183
  - lib/qaxqa/version.rb