lucid_report 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: aa9d8e9b26a342c29d64109680a749b2c86e223f
4
+ data.tar.gz: 893596e437c5f5ba9540f80b7dd36457efa58f35
5
+ SHA512:
6
+ metadata.gz: 09cd4d00781c9e2ecb162a55c099d8179c4b7133263b16f9ea2defc432d7bc975d054411a287b546361b65130e732cd1ee147139590784a1079b8ede9d064151
7
+ data.tar.gz: 85513632312f555ad2208d527e8672768dd5fff1d7d28946ebde44fec410482a7198cf5d92d0f0ae3dc799b584a88809e5979ade83c7da60bebed24d1bec600b
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ # rspec failure tracking
12
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.3.1
5
+ before_install: gem install bundler -v 1.14.4
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at jeff.nyman@sproutsocial.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in lucid_report.gemspec
4
+ gemspec
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Jeff Nyman
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,199 @@
1
+ # LucidReport
2
+
3
+ Lucid Report allows you to merge Cucumber JSON reports in order to build a unified execution report. This works with Cucumber versions of 2.x and up with results generated in the JSON format.
4
+
5
+ ## Installation
6
+
7
+ To get the latest stable release, add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'lucid_report'
11
+ ```
12
+
13
+ To get the latest code:
14
+
15
+ ```ruby
16
+ gem 'lucid_report', git: 'https://github.com/jeffnyman/lucid_report'
17
+ ```
18
+
19
+ After doing one of the above, execute the following command:
20
+
21
+ $ bundle
22
+
23
+ You can also install Lucid Report just as you would any other gem:
24
+
25
+ $ gem install lucid_report
26
+
27
+ ## Usage
28
+
29
+ You can configure Lucid Report directly from an instance of the class.
30
+
31
+ ```ruby
32
+ require 'report_builder'
33
+
34
+ LucidReport.configure do |config|
35
+ config.json_path = 'results'
36
+ config.report_path = 'execution'
37
+ config.report_types = [:json, :html]
38
+ config.report_tabs = [:overview, :features, :scenarios, :errors]
39
+ config.report_title = 'Test Execution Rport'
40
+ config.compress_images = true
41
+ config.additional_info = {browser: 'chrome', environment: 'staging'}
42
+ end
43
+
44
+ LucidReport.build_report
45
+ ```
46
+
47
+ You can also create your own options hash and pass that in to Lucid Report:
48
+
49
+ ```ruby
50
+ options = {
51
+ json_path: 'results',
52
+ report_path: 'execution',
53
+ report_types: ['json', 'html'],
54
+ report_tabs: [ 'overview', 'features', 'scenarios', 'errors'],
55
+ report_title: 'Test Execution Report',
56
+ compress_images: true,
57
+ additional_info: {'browser' => 'chrome', 'environment' => 'staging'}
58
+ }
59
+
60
+ LucidReport.build_report(options)
61
+ ```
62
+
63
+ ### Rake Task
64
+
65
+ This is an experimental part of Lucid Report. You can add in a Rake task that Lucid Report provides:
66
+
67
+
68
+ ```ruby
69
+ require 'lucid_report'
70
+
71
+ load 'lucid_report.rake'
72
+ ```
73
+
74
+ Then run rake task `lucid_report` as in these examples:
75
+
76
+ ```bash
77
+ rake lucid_report
78
+ rake lucid_report['results']
79
+ rake lucid_report['results', 'lucid-report']
80
+ ```
81
+
82
+ The first command would use all of the default options. The second command provides the location where the JSON files are. The third command provides the JSON location as well as the file name of the report you want to generate.
83
+
84
+ ### Options
85
+
86
+ There are a few options you can use to configure the execution of Lucid Report. To see these at the command line, just do this:
87
+
88
+ ```bash
89
+ lucid_report -h
90
+ ```
91
+
92
+ #### Parsing JSON
93
+
94
+ Lucid Report is designed to take JSON output from Cucumber. Thus it needs to know where to find those files. You can do this by using the `-s` (or `source`) switch to provide a directory where the JSON files are. The default will be the current directory. For example:
95
+
96
+ ```bash
97
+ lucid_report -s 'results'
98
+ ```
99
+
100
+ This would look for any JSON files in the `results` directory. If you wanted to run Lucid Report from within the `results` directory, you could just do this:
101
+
102
+ ```bash
103
+ lucid_report
104
+ ```
105
+
106
+ Within Lucid Report, the value of the source location is referred to as `json_path` and is either a string or an array. This means you can provide multiple locations or multiple files for the JSON parsing.
107
+
108
+ #### Output
109
+
110
+ You can specify where you want the output to be generated. You do this by using the `-o` (or `--out`) switch to provide a file path and a name. Note that the file name you provide should not have an extension.
111
+
112
+ ```bash
113
+ lucid_report -s 'results' -o execution-results
114
+ ```
115
+
116
+ This command would look for JSON files in a `results` directory and then write its output in whatever the current directory is and call the file `execution-results.html`.
117
+
118
+ If you don't specify a path or file, a default of `lucid-report.html` will be generated.
119
+
120
+ Within Lucid Report, the value of the output location is referred to as `report_path` and is a string.
121
+
122
+ #### Report Format
123
+
124
+ You can specify the type of format that you want by using the `-f` (or `--format`). This lets you indicate the type of output file you want to build. The default is HTML but you can also specify JSON, which is currently the only other report type supported. You can also specify that you want both types generated.
125
+
126
+ ```bash
127
+ lucid_report -s 'results' -f json
128
+ ```
129
+
130
+ Within Lucid Report, the value of the report type is referred to as `report_types` and is an array holding the types to build. This can be an array of symbols ([:json, :html]) or an array of strings (['html', 'json']).
131
+
132
+ #### Report Tabs
133
+
134
+ You can specify the tabs you want to appear on your report by using the `-t` (or `--tabs`). By default Lucid Report will generate an overview tab and a features tab. You can specify others. The options are currently 'overview', 'features', 'scenarios', 'errors'.
135
+
136
+ ```bash
137
+ lucid_report -s 'results' -t overview,features,scenarios,errors
138
+ ```
139
+
140
+ Within Lucid Report, the value of the report tabs is referred to as `report_tabs` and is an array that holds the tab names you want generated. This acn be an array of symbols ([:overview, :features, :scenarios, :errors]) or an array of strings (['overview', 'features', 'scenarios', 'errors']).
141
+
142
+ #### Image Compression
143
+
144
+ Since test executions can include embedded images, you can specify whether those images should be compressed by using the `-c` (or `--compress`) switch.
145
+
146
+ ```bash
147
+ lucid_report -s 'results' -c true
148
+ ```
149
+
150
+ You set this value to true to reduce the size of HTML report by compressing any embedded images. Within Lucid Report, this value is referred to as `compress_images` and is a boolean.
151
+
152
+ #### Report Title
153
+
154
+ You can specify the title of the report using the `-T` (or `--title`) switch. By default this title will be "Lucid Results".
155
+
156
+ ```bash
157
+ lucid_report -s 'results' -T 'Test Report'
158
+ ```
159
+
160
+ Within Lucid Report, the value of the title is referred to as `report_title` and is a string.
161
+
162
+ #### Additional Report Information
163
+
164
+ You can specify additional information that you want generated as part of the report. You can do this using the `-I` (or `--info`) switch. This must be a key, value bit of information and you can include multiple such key, value pairs.
165
+
166
+ ```bash
167
+ lucid_report -s 'results' -I "browser: 'chrome', environment: 'staging"
168
+ ```
169
+
170
+ Within Lucid Report, the value of the additional information is stored in `additional_info` and is a hash.
171
+
172
+ ## Development
173
+
174
+ After checking out the repo, run `bin/setup` to install dependencies.
175
+
176
+ To install this gem onto your local machine, run `bundle exec rake install`.
177
+
178
+ ## Contributing
179
+
180
+ Bug reports and pull requests are welcome on GitHub at [https://github.com/jeffnyman/lucid_report](https://github.com/jeffnyman/lucid_report). The testing ecosystem of Ruby is very large and this project is intended to be a welcoming arena for collaboration on yet another test-supporting tool. As such, contributors are very much welcome but are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
181
+
182
+ The Lucid Report gem follows [semantic versioning](http://semver.org).
183
+
184
+ To contribute to Lucid Report:
185
+
186
+ 1. [Fork the project](http://gun.io/blog/how-to-github-fork-branch-and-pull-request/).
187
+ 2. Create your feature branch. (`git checkout -b my-new-feature`)
188
+ 3. Commit your changes. (`git commit -am 'new feature'`)
189
+ 4. Push the branch. (`git push origin my-new-feature`)
190
+ 5. Create a new [pull request](https://help.github.com/articles/using-pull-requests).
191
+
192
+ ## Author
193
+
194
+ * [Jeff Nyman](http://testerstories.com)
195
+
196
+ ## License
197
+
198
+ Lucid Report is distributed under the [MIT](http://www.opensource.org/licenses/MIT) license.
199
+ See the [LICENSE](https://github.com/jeffnyman/lucid_report/blob/master/LICENSE.md) file for details.
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "lucid_report"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ require "pry"
10
+ Pry.start
11
+
12
+ # require "irb"
13
+ # IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/lucid_report ADDED
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "optparse"
4
+ require "lucid_report"
5
+
6
+ options = {
7
+ :json_path => nil,
8
+ :report_path => 'lucid-report',
9
+ :report_types => [:html],
10
+ :report_tabs => [:overview, :features],
11
+ :report_title => 'Lucid Results',
12
+ :compress_images => false,
13
+ :additional_info => {}
14
+ }
15
+
16
+ opt_parser = OptionParser.new do |opts|
17
+ opts.banner = "Usage: \n lucid_report [options]"
18
+ opts.separator 'Configuration options:'
19
+
20
+ opts.on('-s','--source x,y,z', Array, 'List of json path or files') do |list|
21
+ options[:json_path] = list
22
+ end
23
+
24
+ opts.on('-o', '--out [PATH]NAME', String, 'Report path with name without extension') do |report_path|
25
+ options[:report_path] = report_path
26
+ end
27
+
28
+ opts.on('-f','--format x,y,z', Array, 'List of report format - html,json') do |list|
29
+ options[:report_types] = list
30
+ end
31
+
32
+ opts.on('-t','--tabs x,y,z', Array, 'List of report tabs - overview,features,scenarios,errors') do |list|
33
+ options[:report_tabs] = list
34
+ end
35
+
36
+ opts.on('-c', '--compress', 'Reduce report size if embedding images') do |compress|
37
+ options[:compress_images] = compress
38
+ end
39
+
40
+ opts.on('-T', '--title TITLE', String, 'Report title') do |report_title|
41
+ options[:report_title] = report_title
42
+ end
43
+
44
+ opts.on('-I','--info a:x,b:y,c:z', Array, 'List of additional info') do |list|
45
+ list.each do |i|
46
+ key, value = i.split(':')
47
+ options[:additional_info][key] = value
48
+ end
49
+ end
50
+
51
+ opts.separator 'Common options:'
52
+
53
+ opts.on_tail('-h', '--help', 'Show help') do
54
+ puts opts
55
+ exit
56
+ end
57
+
58
+ opts.on_tail('-v','--version', 'Show version') do
59
+ puts 'LucidReport v' + Gem.loaded_specs['lucid_report'].version.to_s rescue puts "Something want wrong. \nUse 'gem list lucid_report'"
60
+ exit
61
+ end
62
+ end
63
+
64
+ opt_parser.parse!(ARGV)
65
+
66
+ LucidReport.build_report(options)
@@ -0,0 +1,6 @@
1
+ desc 'Rake task to build a lucid report'
2
+ task :lucid_report, [:json_path, :report_path] do |t, args|
3
+ args.with_defaults(:json_path => nil, :report_path => 'lucid-report')
4
+ options = {:json_path => args.json_path, :report_path => args.report_path}
5
+ LucidReport.build_report(options)
6
+ end