spicasax-qa-util 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README +0 -0
  2. data/convert_csv_to_testlink.rb +80 -0
  3. metadata +54 -0
data/README ADDED
File without changes
@@ -0,0 +1,80 @@
1
+ # convert_csv_to_testlink.rb
2
+ #
3
+ # author: Cynthia Sadler
4
+ # usage: ruby convert_csv_to_testlink.rb infile.csv outfile.xml
5
+ #
6
+ # where infile.cvs is a comma-separated-value file with four fields:
7
+ # name, summary, steps, expected results
8
+ #
9
+ # The steps field and expected results field may have multiple steps. If
10
+ # multiple steps are used, use newlines to delimit the steps, and enclose
11
+ # entire field with quotes. E.g., here is a sample row with multiple steps:
12
+ #
13
+ # "Sample test case","Verify something.","0. PREREQ: delete previous stuff.
14
+ # 1. Do something.
15
+ # 2. Do another thing.","A. Verify this.
16
+ # B. Verify that."
17
+ #
18
+
19
+ require 'rubygems'
20
+ require 'csv'
21
+
22
+ $infile = ARGV[0]
23
+ $testlinkxml = ARGV[1]
24
+ $temp = Array.new
25
+ $testdata = Array.new
26
+
27
+ $beginning = '<?xml version="1.0" encoding="UTF-8"?><testcases> '
28
+ $end = "</testcases>"
29
+
30
+ File.open($testlinkxml, "w+") do |f|
31
+ f.puts $beginning
32
+ CSV::Reader.parse(File.open($infile)) do |row|
33
+ # skip the first row which is a header
34
+ next if row[0].data == 'name'
35
+
36
+ # testcase
37
+ f.puts '<testcase name="' + row[0] + '">'
38
+
39
+ # summary
40
+ f.puts ' <summary><![CDATA[' + row[1] + ']]></summary>'
41
+
42
+ # steps
43
+
44
+ if row[2] != nil then
45
+ f.puts ' <steps><![CDATA['
46
+ steps = row[2].split("\n")
47
+ $i = 0
48
+ while $i < steps.length
49
+ f.puts '<p>' + steps[$i] + '</p>'
50
+ $i += 1
51
+ end
52
+ f.puts ']]></steps>'
53
+ else
54
+ f.puts ' <steps><![CDATA[]]></steps>'
55
+ end
56
+
57
+
58
+ # expected results
59
+
60
+ if row[2] != nil then
61
+ f.puts ' <expectedresults><![CDATA['
62
+ steps = row[3].split("\n")
63
+ $i = 0
64
+ while $i < steps.length
65
+ f.puts '<p>' + steps[$i] + '</p>'
66
+ $i += 1
67
+ end
68
+ f.puts ']]></expectedresults>'
69
+ else
70
+ f.puts ' <expectedresults><![CDATA[]]></expectedresults>'
71
+ end
72
+
73
+
74
+ # close testcase tag
75
+ f.puts '</testcase>'
76
+ end
77
+ # closing document
78
+ f.puts $end
79
+ end
80
+
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spicasax-qa-util
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Cynthia Sadler
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-02-25 00:00:00 -08:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Useful scripts that I've written or enhanced.
17
+ email: spicasax@yahoo.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files: []
23
+
24
+ files:
25
+ - README
26
+ - convert_csv_to_testlink.rb
27
+ has_rdoc: false
28
+ homepage: http://geekythoughtbubbles.blogspot.com/
29
+ post_install_message:
30
+ rdoc_options: []
31
+
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: "0"
39
+ version:
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ version:
46
+ requirements: []
47
+
48
+ rubyforge_project:
49
+ rubygems_version: 1.2.0
50
+ signing_key:
51
+ specification_version: 2
52
+ summary: My qa toolbox
53
+ test_files: []
54
+