charter 0.0.7 → 0.0.8

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: a085bd115b8f668232dee0033a4176e4e1a284f3
4
- data.tar.gz: 202b620213f13ba5268144a409c0fe21cea6cb26
3
+ metadata.gz: e1c3c8a659fec87f6007ed0b5effb44796e5974c
4
+ data.tar.gz: d221a1bb32c56179c733dc5ac9f9b4df3d93c822
5
5
  SHA512:
6
- metadata.gz: 5bcb0d03e7e0d2484f4b136b9f48e545e8f5d2d962ee043cc98732367eb07c96b8f5fd033b43986044ebf88d6fe4405acecd90e5e27ece86a39cc51be9fa13e4
7
- data.tar.gz: a21a2ff6486a299dd7f09a92745496fe3bd0b238db99d1895cbb235b8e07b9b335ced0f6f780989496cca561e6818ea20102db95e775a407f263ecee42bf8a43
6
+ metadata.gz: d73ab94b12da179ccb525a5ef2063c68dd2822597610d776a66b2e0f89797e99e6df277b633f79fb43427ce9a065ab78b7bea8534c654569ba985205a005d00f
7
+ data.tar.gz: 9a4e7277979fe9511f23ecbccb912e2d84e0ea08b2aac6671f9269d306e5d6a1df966b142cbe3c6d9814a3fe85ce43ebb78d46360cbbd3035d4effdd94729ab7
data/README.md CHANGED
@@ -1,76 +1,25 @@
1
- Charter
2
- =======
3
-
4
- Command line interface for creating a test charter exported in markdown.
5
-
6
- #Installation
7
- [sudo] gem install charter
1
+ ##Installation
2
+ Charter was created as a Ruby gem and is available through Rubygems.org. Installation is as simple as:
3
+ <code>[sudo] gem install charter</code>
8
4
 
9
5
  After installing the gem, create a ~/.charterrc file and add the following:
10
-
11
- ---
12
- session_folder: "/Where/The/Charters/Will/Save/To"
13
- tester: Your Name Here
14
- #Usage
6
+ {% codeblock lang:yaml %}
7
+ ---
8
+ session_folder: "/Where/The/Charters/Will/Save/To"
9
+ tester: Your Name Here
10
+ {% endcodeblock %}
11
+ ##Usage
15
12
  charter [global options] command [command options] [arguments...]
16
- ###Creating a new charter
17
- charter start "Charter Name"
18
-
19
- This will create a new charter in the specified folder specified in your ~/.charterrc file
20
-
21
- ###Adding environment details
22
- charter env "Windows 7, IE 10, point at QA"
23
- ###Adding a purpose for the charter
24
- charter purpose "I will be testing the login page"
25
- ###Adding a scenario
26
- charter scenario "Leave both fields blank and click login"
27
-
28
- or
29
-
30
- charter s "Leave both fields blank and click login"
31
- ###Adding a defect
32
- charter bug "User able to login without inputting password"
33
- ###Finishing the charter
34
- charter finish
35
-
36
- This will removing any remaining place holders and fill in the end time
37
-
38
- ####Known Issues
39
- -Currently, Charter only works on OS X/Linux
40
- -Bug screenshot option only works on OS X
41
-
42
- ####TODO:
43
- - Refine code structure
44
- - <del>Release to RubyGems.org</del>
45
- - Add more fields to charter
46
- - Add optional fields
47
-
48
-
49
- ##The finished charter will look something like this:
50
-
51
- #Exploratory Test Charter
52
-
53
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
54
-
55
- ##Environment
56
-
57
- OS X, Chrome
58
-
59
- ##Length
60
- Start Time: 03/31/2014 21:20
61
-
62
- End Time: 03/31/2014 21:22
63
-
64
- ##Tester
65
- Mark Grossman
66
-
67
- ##Scenarios:
68
- 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
69
- 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
70
13
 
14
+ Creating a new charter is as easy as <code>charter start "My charter title here"</code>. This will create a new charter in the folder specified in your ~/.charterrc file.
71
15
 
72
- ##Defects Found
73
- 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
74
- 1. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
16
+ <code>charter purpose "This is my purpose!"</code> : What do you hope to accomplish with this charter
17
+ <code>charter env "Windows 7"</code> : Add a environment description
18
+ <code>charter scenario "Scenario goes here"</code> or <code>charter s "Scenario goes here"</code> : Add a scenario
19
+ <code>charter bug "This is my bug"</code> or <code>charter bug -s "My bug"</code> : Add a bug with or without a screenshot
20
+ <code>charter note</code> : Add a note
21
+ <code>charter tag "Login"</code> : Add a tag to the charter
22
+ <code>charter finish</code> or <code>charter finish -e</code> : Remove any remaining placeholders and optionally export the charter in HTML
23
+ <code>charter find Login</code> : Find all charters with a given tag
75
24
 
76
- ---
25
+ See an example charter [here](http://testwith.me/charter-example/)
data/bin/charter CHANGED
@@ -13,24 +13,24 @@ version Charter::VERSION
13
13
  desc 'Starts a new session charter'
14
14
  arg_name 'SessionName'
15
15
  command :start do |c|
16
- c.action do |global_options,options,args|
17
- doc.create_charter(args * " ")
16
+ c.action do |global_options, options, args|
17
+ doc.create_charter(args * ' ')
18
18
  end
19
19
  end
20
20
 
21
21
  desc 'What are you testing'
22
- arg_name 'What is the purpose of this session'
22
+ arg_name 'purpose'
23
23
  command :purpose, :p do |c|
24
- c.action do |global_options,options,args|
25
- doc.set_purpose(args * " ")
24
+ c.action do |global_options, options, args|
25
+ doc.set_purpose(args * ' ')
26
26
  end
27
27
  end
28
28
 
29
29
  desc 'Add an item to describe system under test'
30
30
  arg_name 'List your environment'
31
31
  command :env do |c|
32
- c.action do |global_options,options,args|
33
- doc.set_env(args * " ")
32
+ c.action do |global_options, options, args|
33
+ doc.set_env(args * ' ')
34
34
  end
35
35
  end
36
36
 
@@ -38,24 +38,51 @@ desc 'Add a bug found during testing'
38
38
  arg_name 'Add a bug to the current session'
39
39
  command :bug do |c|
40
40
  c.switch :s
41
- c.action do |global_options,options,args|
42
- doc.add_bug(args * " ", options[:s])
41
+ c.action do |global_options, options, args|
42
+ doc.add_bug(args * ' ')
43
+ doc.take_screenshot(args * ' ') if options[:s]
43
44
  end
44
45
  end
45
46
 
46
47
  desc 'Describe a scenario here'
47
48
  arg_name 'Add a scenario to the current session'
48
49
  command :scenario, :s do |c|
49
- c.action do |global_options,options,args|
50
- doc.add_scenario(args * " ")
50
+ c.action do |global_options, options, args|
51
+ doc.add_scenario(args * ' ')
51
52
  end
52
53
  end
53
54
 
54
55
  desc 'Add a note'
55
56
  arg_name 'Add a note to the current session'
56
57
  command :note, :n do |c|
57
- c.action do |global_options,options,args|
58
- doc.add_note(args * " ")
58
+ c.action do |global_options, options, args|
59
+ doc.add_note(args * ' ')
60
+ end
61
+ end
62
+
63
+ desc 'Add a tag to your charter'
64
+ arg_name 'tag'
65
+ command :tag do |c|
66
+ c.action do |global_options, options, args|
67
+ args.each do |tag|
68
+ doc.add_tag(tag)
69
+ end
70
+ end
71
+ end
72
+
73
+ desc 'Find charters with tag'
74
+ arg_name 'find'
75
+ command :find do |c|
76
+ c.action do |global_options, options, args|
77
+ doc.find_files_with_tags(args * ' ')
78
+ end
79
+ end
80
+
81
+ desc 'Show all charters'
82
+ arg_name 'all'
83
+ command :all do |c|
84
+ c.action do |global_options, options, args|
85
+ doc.show_all_charters
59
86
  end
60
87
  end
61
88
 
@@ -63,15 +90,14 @@ desc 'Final formatting to charter'
63
90
  arg_name 'Type of export'
64
91
  command :finish do |c|
65
92
  c.switch :e
66
- c.action do |global_options,options,args|
93
+ c.action do |global_options, options, args|
67
94
  doc.finish_charter
68
- if options[:e]
69
- doc.export_charter
70
- end
95
+ doc.export_charter if options[:e]
96
+
71
97
  end
72
98
  end
73
99
 
74
- pre do |global,command,options,args|
100
+ pre do |global, command, options, args|
75
101
  # Pre logic here
76
102
  # Return true to proceed; false to abort and not call the
77
103
  # chosen command
@@ -80,7 +106,7 @@ pre do |global,command,options,args|
80
106
  true
81
107
  end
82
108
 
83
- post do |global,command,options,args|
109
+ post do |global, command, options, args|
84
110
  # Post logic here
85
111
  # Use skips_post before a command to skip this
86
112
  # block on that command only
@@ -20,3 +20,6 @@ Elapsed: <elapsed>
20
20
 
21
21
  ##Notes:
22
22
  <notes>
23
+
24
+ ###Tags:
25
+ <tags>
data/lib/charter/doc.rb CHANGED
@@ -2,120 +2,140 @@
2
2
 
3
3
  class Doc
4
4
 
5
- def initialize(input=nil)
6
- @config = read_config
7
- end
8
-
9
- def create_charter(name)
10
- template = File.read(File.dirname(__FILE__) + '/charter_template.md')
11
- charter = File.new("#{@config['session_folder']}/#{name}.md", "w+")
12
- charter.write(template)
13
- charter.close
14
-
15
- @config['session_name'] = name
16
- @config['current_session'] = "#{@config['session_folder']}/#{name}.md"
17
- @config['start_time'] = Time.now.strftime("%l:%M %P")
18
- @config['defects'] = "false"
19
- @config['notes'] = "false"
20
- @config['scenarios'] = "false"
21
-
22
- replace_text('<start_time>', @config['start_time'] + " ")
23
- replace_text('<tester>', @config['tester'])
24
-
25
- write_config
26
- end
27
-
28
- def add_bug(text, screenshot)
29
- replace_text('<defects>', "1. #{text} \r\n<defects>")
30
- @config['defects'] = "true"
31
- if screenshot
32
- %x(screencapture -s "#{@config['session_folder']}/#{text}".jpg)
33
- replace_text('<defects>', " * ![Alt text](#{@config['session_folder']}/#{text}.jpg) \r\n<defects>")
34
- end
35
- write_config
36
- end
37
-
38
- def add_scenario(text)
39
- replace_text('<scenarios>', "1. #{text} \r\n<scenarios>")
40
- @config['scenarios'] = 'true'
41
- write_config
42
- end
43
-
44
- def set_env(text)
45
- replace_text('<environment>', "* #{text} \r\n<environment>")
46
- end
47
-
48
- def set_purpose(text)
49
- replace_text('<purpose>', text)
50
- end
51
-
52
- def add_note(text)
53
- replace_text('<notes>', "1. #{text} \r\n<notes>")
54
- @config['notes'] = 'true'
55
- write_config
56
- end
57
-
58
- def finish_charter
59
- set_default_text
60
-
61
- set_end_time
62
-
63
- remove_placeholders
64
- end
65
-
66
- def export_charter
67
- renderer = Redcarpet::Render::HTML.new(render_options = {})
68
- markdown = Redcarpet::Markdown.new(renderer, extensions = {})
69
- text = File.read(@config['current_session'])
70
- html_file = File.new("#{@config['session_folder']}/#{@config['session_name'].gsub(" ", "-")}.html", "w+")
71
- html_text = markdown.render(text)
72
- html_file.write(html_text)
73
- end
74
-
75
- private
76
- def replace_text(find,replace)
77
- aString = File.read(@config['current_session'])
78
- aString.gsub!(find, replace)
79
- file = File.open(@config['current_session'], "w")
80
- file.puts aString
81
- file.close
82
- end
83
-
84
- def set_default_text
85
- @config['defects'] == 'false' ? replace_text('<defects>', 'No defects found during this session') : nil
86
-
87
- @config['notes'] == 'false' ? replace_text('<notes>', 'No notes for this session') : nil
88
-
89
- @config['scenarios'] == 'false' ? replace_text('<scenarios>', 'No scenarios for this session') : nil
90
- end
91
-
92
- def set_end_time
93
- @config['end_time'] = Time.now.strftime("%l:%M %P")
94
-
95
- replace_text('<end_time>', @config['end_time'] + " ")
96
-
97
- elapsed_time = (Time.parse(@config['end_time']) - Time.parse(@config['start_time']))/60
98
-
99
- replace_text('<elapsed>',elapsed_time.to_i.to_s + ' minutes')
100
- end
101
-
102
- def remove_placeholders
103
- aString = File.read(@config['current_session'])
104
- aString.gsub!(/\<(.*?)\>/, "")
105
- file = File.open(@config['current_session'], "w")
106
- file.puts aString
107
- file.close
108
- end
109
-
110
- def read_config
111
- if File.exists? File.expand_path(SESSION_CONFIG)
112
- return YAML.load_file(File.expand_path(SESSION_CONFIG))
113
- else
114
- return {}
115
- end
5
+ def initialize(input = nil)
6
+ @config = read_config
7
+ end
8
+
9
+ def create_charter(name)
10
+ template = File.read(File.dirname(__FILE__) + '/charter_template.md')
11
+ charter = File.new("#{@config['session_folder']}/#{name}.md", 'w+')
12
+ charter.write(template)
13
+ charter.close
14
+
15
+ @config['session_name'] = name
16
+ @config['current_session'] = "#{@config['session_folder']}/#{name}.md"
17
+ @config['start_time'] = Time.now.strftime('%l:%M %P')
18
+ @config['defects'] = 'false'
19
+ @config['notes'] = 'false'
20
+ @config['scenarios'] = 'false'
21
+
22
+ replace_text('<start_time>', @config['start_time'] + ' ')
23
+ replace_text('<tester>', @config['tester'])
24
+
25
+ write_config
26
+ end
27
+
28
+ def add_bug(text)
29
+ replace_text('<defects>', "1. #{text} \r\n<defects>")
30
+ @config['defects'] = 'true'
31
+ write_config
32
+ end
33
+
34
+ def take_screenshot(text)
35
+ %x(screencapture -s "#{@config['session_folder']}/#{text}".jpg)
36
+ replace_text('<defects>', " * ![Alt text](#{@config['session_folder']}/#{text}.jpg) \r\n<defects>")
37
+ end
38
+
39
+ def add_scenario(text)
40
+ replace_text('<scenarios>', "1. #{text} \r\n<scenarios>")
41
+ @config['scenarios'] = 'true'
42
+ write_config
43
+ end
44
+
45
+ def set_env(text)
46
+ replace_text('<environment>', "* #{text} \r\n<environment>")
47
+ end
48
+
49
+ def set_purpose(text)
50
+ replace_text('<purpose>', text)
51
+ end
52
+
53
+ def add_note(text)
54
+ replace_text('<notes>', "1. #{text} \r\n<notes>")
55
+ @config['notes'] = 'true'
56
+ write_config
57
+ end
58
+
59
+ def add_tag(text)
60
+ replace_text('<tags>', "@#{text} <tags>")
61
+ end
62
+
63
+ def finish_charter
64
+ set_default_text
65
+
66
+ set_end_time
67
+
68
+ remove_placeholders
69
+ end
70
+
71
+ def export_charter
72
+ renderer = Redcarpet::Render::HTML.new(render_options = {})
73
+ markdown = Redcarpet::Markdown.new(renderer, extensions = {})
74
+ markdown_text = File.read(@config['current_session'])
75
+ html_file = File.new("#{@config['session_folder']}/#{@config['session_name'].gsub(' ', '-')}.html", 'w+')
76
+ html_text = markdown.render(markdown_text)
77
+ html_file.write(html_text)
78
+ end
79
+
80
+ def find_files_with_tags(tag)
81
+ files = %x(grep -rnw -l --include=*.md #{@config['session_folder']} -e '@#{tag}').split('\n')
82
+ files.each do |file|
83
+ puts file.split('/')[-1]
116
84
  end
85
+ end
117
86
 
118
- def write_config
119
- File.open(File.expand_path(SESSION_CONFIG), 'w') { |yf| YAML::dump(@config, yf) }
120
- end
87
+ def show_all_charters
88
+ files = Dir["#{@config['session_folder']}/*.md"]
89
+ files.each do |file|
90
+ puts file.split('/')[-1]
91
+ end
92
+ end
93
+
94
+ private
95
+
96
+ def replace_text(find, replace)
97
+ file_text = File.read(@config['current_session'])
98
+ file_text.gsub!(find, replace)
99
+ file = File.open(@config['current_session'], 'w')
100
+ file.puts file_text
101
+ file.close
102
+ end
103
+
104
+ def set_default_text
105
+ @config['defects'] == 'false' ? replace_text('<defects>', 'No defects found during this session') : nil
106
+
107
+ @config['notes'] == 'false' ? replace_text('<notes>', 'No notes for this session') : nil
108
+
109
+ @config['scenarios'] == 'false' ? replace_text('<scenarios>', 'No scenarios for this session') : nil
110
+ end
111
+
112
+ def set_end_time
113
+ @config['end_time'] = Time.now.strftime('%l:%M %P')
114
+
115
+ replace_text('<end_time>', @config['end_time'] + ' ')
116
+
117
+ elapsed_time = (Time.parse(@config['end_time']) - Time.parse(@config['start_time'])) / 60
118
+
119
+ replace_text('<elapsed>', elapsed_time.to_i.to_s + ' minutes')
120
+ end
121
+
122
+ def remove_placeholders
123
+ file_text = File.read(@config['current_session'])
124
+ file_text.gsub!(/\<(.*?)\>/, '')
125
+ file = File.open(@config['current_session'], 'w')
126
+ file.puts file_text
127
+ file.close
128
+ end
129
+
130
+ def read_config
131
+ if File.exist? File.expand_path(SESSION_CONFIG)
132
+ return YAML.load_file(File.expand_path(SESSION_CONFIG))
133
+ else
134
+ return {}
135
+ end
136
+ end
137
+
138
+ def write_config
139
+ File.open(File.expand_path(SESSION_CONFIG), 'w') { |yf| YAML.dump(@config, yf) }
140
+ end
121
141
  end
@@ -1,3 +1,3 @@
1
1
  module Charter
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: charter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Grossman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2014-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake