spec_tracker 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +7 -0
  4. data/CHANGELOG.md +48 -0
  5. data/CODE_OF_CONDUCT.md +76 -0
  6. data/Gemfile +6 -0
  7. data/Gemfile.lock +79 -0
  8. data/LICENSE +24 -0
  9. data/README.md +84 -0
  10. data/Rakefile +10 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/exe/spec_tracker +5 -0
  14. data/lib/spec_tracker.rb +50 -0
  15. data/lib/spec_tracker/cli.rb +24 -0
  16. data/lib/spec_tracker/config/configuration.rb +23 -0
  17. data/lib/spec_tracker/config/en.yml +8 -0
  18. data/lib/spec_tracker/config/fr.yml +8 -0
  19. data/lib/spec_tracker/report_task.rb +26 -0
  20. data/lib/spec_tracker/reporter/base_reporter.rb +24 -0
  21. data/lib/spec_tracker/reporter/base_ui_mapper.rb +25 -0
  22. data/lib/spec_tracker/reporter/report.rb +17 -0
  23. data/lib/spec_tracker/reporter/report_datum.rb +13 -0
  24. data/lib/spec_tracker/reporter/report_mapper.rb +19 -0
  25. data/lib/spec_tracker/reporter/status_ui.rb +8 -0
  26. data/lib/spec_tracker/reporter/terminal/reporter.rb +28 -0
  27. data/lib/spec_tracker/reporter/terminal/ui_mapper.rb +13 -0
  28. data/lib/spec_tracker/spec_parser/base_parser.rb +36 -0
  29. data/lib/spec_tracker/spec_parser/csv_parser.rb +24 -0
  30. data/lib/spec_tracker/spec_parser/gherkin_parser.rb +27 -0
  31. data/lib/spec_tracker/spec_parser/scenario.rb +12 -0
  32. data/lib/spec_tracker/spec_parser/specification.rb +12 -0
  33. data/lib/spec_tracker/test_report_parser/base_mapper.rb +52 -0
  34. data/lib/spec_tracker/test_report_parser/base_parser.rb +43 -0
  35. data/lib/spec_tracker/test_report_parser/j_unit/mapper.rb +25 -0
  36. data/lib/spec_tracker/test_report_parser/j_unit/parser.rb +31 -0
  37. data/lib/spec_tracker/test_report_parser/test_result.rb +12 -0
  38. data/lib/spec_tracker/test_status.rb +46 -0
  39. data/lib/spec_tracker/version.rb +3 -0
  40. data/spec_tracker.gemspec +39 -0
  41. data/specifications/Spec Fonctionnelles SpecTracker - Configuration.csv +11 -0
  42. data/specifications/Spec Fonctionnelles SpecTracker - Parse specifications.csv +20 -0
  43. data/specifications/configuration.feature +11 -0
  44. data/specifications/parse_csv_specifications.feature +11 -0
  45. data/specifications/parse_gherkin_specifications.feature +11 -0
  46. metadata +249 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 42ee99ae0c565daf509758ee4f166d7fc0cb0ecd2e8916029563d8ed6b2daef8
4
+ data.tar.gz: 7c4f953579382b0f7f32d626951a389f3027da048c349984c634f87f8dd27908
5
+ SHA512:
6
+ metadata.gz: 1a6be4b413f8a5d3b725895a4dd18cdc625b6f3f758083256bc444372ff4b009ac5447aaecd7465c421fd769268ca20b75c01bbd7d3f7beaceb7335f8bf7c4bc
7
+ data.tar.gz: 93668917bb48db7f6ec84549d58c88d518bfecd6426edf04e41e0e96f8a4afc4036fa869061fa1d34b8ab2a2220127528607410072ca12759b2c6acd5becf598
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /test/reports/
8
+ /tmp/
9
+ .byebug_history
10
+ .idea
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.5.1
7
+ before_install: gem install bundler -v 1.17.0
data/CHANGELOG.md ADDED
@@ -0,0 +1,48 @@
1
+ # Changelog
2
+ All notable changes to this project will be documented in this file.
3
+
4
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [1.2.0] - 2019-02-13
8
+ ### Added
9
+ - dependency to cucumber
10
+ - Gherkin support for csv specifications
11
+ - Configuration parameter `spec_type` to select specification type. csv by default but gherkin is also accepted.
12
+
13
+ ### Changed
14
+ - Moved scenario_id_header and scenario_name_header in csv specification parser
15
+ - License is now MIT instead of Apache 2.0
16
+ - Fix random fail in configuration tests
17
+
18
+ ## [1.1.0] - 2019-01-27
19
+ ### Added
20
+ - dev dependency to active support to write rails-like test
21
+ - base class for test that extends the active support extension that defines test(name, &block)
22
+ - CSV specifications for project
23
+
24
+ ### Changed
25
+ - test syntax
26
+ - default header for scenario IDs is now Scenario ID
27
+ - default regexp ID must now be a ruby regex
28
+
29
+ ## [1.0.0] - 2019-01-25
30
+ ### Added
31
+ - Support multiple CSV specification files
32
+ - Support single JUnit report file
33
+ - Configuration parameters
34
+ - CLI with report command including options
35
+ - tests for CSV parser, JUnit mapper and spec_tracker
36
+ - minitest-reporters test dependency
37
+ - CHANGELOG
38
+
39
+
40
+ ### Changed
41
+ - Output title is the name of the corresponding CSV specification file
42
+ - Compatibility with Ruby ~> 2.3
43
+ - Usage instructions in README
44
+
45
+
46
+ ### Removed
47
+ - YAML configuration
48
+ - spec tracker script
@@ -0,0 +1,76 @@
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, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and 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 joanna.vigne@fabernovel.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 https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in spec_tracker.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,79 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ spec_tracker (1.1.0)
5
+ cucumber (~> 3.1)
6
+ gemoji (~> 3.0)
7
+ nokogiri (~> 1.10)
8
+ terminal-table (~> 1.8)
9
+ thor (~> 0.20)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ activesupport (5.2.2)
15
+ concurrent-ruby (~> 1.0, >= 1.0.2)
16
+ i18n (>= 0.7, < 2)
17
+ minitest (~> 5.1)
18
+ tzinfo (~> 1.1)
19
+ ansi (1.5.0)
20
+ backports (3.11.4)
21
+ builder (3.2.3)
22
+ byebug (9.1.0)
23
+ concurrent-ruby (1.1.4)
24
+ cucumber (3.1.2)
25
+ builder (>= 2.1.2)
26
+ cucumber-core (~> 3.2.0)
27
+ cucumber-expressions (~> 6.0.1)
28
+ cucumber-wire (~> 0.0.1)
29
+ diff-lcs (~> 1.3)
30
+ gherkin (~> 5.1.0)
31
+ multi_json (>= 1.7.5, < 2.0)
32
+ multi_test (>= 0.1.2)
33
+ cucumber-core (3.2.1)
34
+ backports (>= 3.8.0)
35
+ cucumber-tag_expressions (~> 1.1.0)
36
+ gherkin (~> 5.0)
37
+ cucumber-expressions (6.0.1)
38
+ cucumber-tag_expressions (1.1.1)
39
+ cucumber-wire (0.0.1)
40
+ diff-lcs (1.3)
41
+ gemoji (3.0.0)
42
+ gherkin (5.1.0)
43
+ i18n (1.5.3)
44
+ concurrent-ruby (~> 1.0)
45
+ mini_portile2 (2.4.0)
46
+ minitest (5.11.3)
47
+ minitest-reporters (1.3.5)
48
+ ansi
49
+ builder
50
+ minitest (>= 5.0)
51
+ ruby-progressbar
52
+ multi_json (1.13.1)
53
+ multi_test (0.1.2)
54
+ nokogiri (1.10.1)
55
+ mini_portile2 (~> 2.4.0)
56
+ rake (10.5.0)
57
+ ruby-progressbar (1.10.0)
58
+ terminal-table (1.8.0)
59
+ unicode-display_width (~> 1.1, >= 1.1.1)
60
+ thor (0.20.3)
61
+ thread_safe (0.3.6)
62
+ tzinfo (1.2.5)
63
+ thread_safe (~> 0.1)
64
+ unicode-display_width (1.4.1)
65
+
66
+ PLATFORMS
67
+ ruby
68
+
69
+ DEPENDENCIES
70
+ activesupport (>= 3.0, < 6.0)
71
+ bundler (~> 1.17)
72
+ byebug (~> 9.0)
73
+ minitest (~> 5.0)
74
+ minitest-reporters (~> 1.3)
75
+ rake (~> 10.0)
76
+ spec_tracker!
77
+
78
+ BUNDLED WITH
79
+ 1.17.1
data/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ * Copyright (c) 2012, Applidium
2
+ * All rights reserved.
3
+ * Redistribution and use in source and binary forms, with or without
4
+ * modification, are permitted provided that the following conditions are met:
5
+ *
6
+ * * Redistributions of source code must retain the above copyright
7
+ * notice, this list of conditions and the following disclaimer.
8
+ * * Redistributions in binary form must reproduce the above copyright
9
+ * notice, this list of conditions and the following disclaimer in the
10
+ * documentation and/or other materials provided with the distribution.
11
+ * * Neither the name of Applidium nor the names of its contributors may
12
+ * be used to endorse or promote products derived from this software
13
+ * without specific prior written permission.
14
+ *
15
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
16
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18
+ * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
19
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,84 @@
1
+ # SpecTracker
2
+
3
+ Parse CSV specifications, match them with JUnit reports and print the corresponding traceability matrix in the terminal.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'spec_tracker'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install spec_tracker
20
+
21
+ ## Usage
22
+
23
+ ### Configuration
24
+
25
+ | Parameter | Default value | Description |
26
+ | --------- | ----- | ------- |
27
+ | `spec_path` | 'specifications' | Path to the specification file(s). Expects a relative path to a file or a director |
28
+ | `spec_type` | 'csv' | Type of specification files. Available values : csv, gherkin |
29
+ | `scenario_id_header` | 'Scenario ID' | Header of the CSV column that contains the scenario names |
30
+ | `scenario_name_header` | 'Name/Rule' | Header of the CSV column that contains the scenario IDs |
31
+ | `scenario_id_regex` | `/\[([a-zA-Z\-]+)\]/` | Regexp to find scenario IDs in the test names. Default is kebab-case words |
32
+ | `test_report_path` | 'test/reports' | Path to the test reports. Expects a relative path to a file or a directory |
33
+ | `locale` | 'fr' | Locale for text output. Available values : fr, en |
34
+
35
+ ### Test result symbols
36
+
37
+ | Symbol | Meaning |
38
+ | ---------: | ------- |
39
+ | ✅ | There is a test for this scenario and it PASSES |
40
+ | 😶 | No tests were found for this scenario |
41
+ | ❌ | There is a test for this scenario and if FAILS |
42
+
43
+ ### CLI
44
+
45
+
46
+ $ spec_tracker report
47
+ +---------------------------+-------------------------------------+----------------+
48
+ | some_specification_file.csv | |
49
+ +---------------------------+-------------------------------------+----------------+
50
+ | Identifiant du scénario | Nom du scénario | Statut du test |
51
+ +---------------------------+-------------------------------------+----------------+
52
+ | sign-up | [MyProject] Scenario 4.1.1 | ✅ |
53
+ | login | [MyProject] Scenario 4.2.1 | ✅ |
54
+ | logout | [MyProject] Scenario 4.3.1 | 😶 |
55
+ | delete-account | [MyProject] Scenario 5.1.1 | ❌ |
56
+ | news-feed | [MyProject] Scenario 5.1.2 | ✅ |
57
+ | like-news | [MyProject] Scenario 5.1.3 | ✅ |
58
+ | unlike-news | [MyProject] Scenario 5.1.4 | ❌ |
59
+ | topics | [MyProject] Scenario 5.1.5 | 😶 |
60
+ | subscribe-topic | [MyProject] Scenario 5.1.6 | 😶 |
61
+ | unsubscribe-topic | [MyProject] Scenario 6.1.1 | 😶 |
62
+ | account-information | [MyProject] Scenario 6.1.2 | 😶 |
63
+ | reset-password | [MyProject] Scenario 6.1.3 | 😶 |
64
+ +---------------------------+-------------------------------------+----------------+
65
+ | Progression | | 33% |
66
+ +---------------------------+-------------------------------------+----------------+
67
+
68
+
69
+
70
+ Help to configure the report command :
71
+
72
+
73
+ $ spec_tracker help report
74
+
75
+
76
+ ## Development
77
+
78
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
79
+
80
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
81
+
82
+ ## Contributing
83
+
84
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jvigne/spec_tracker.
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "spec_tracker"
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
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ 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/spec_tracker ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'spec_tracker'
4
+
5
+ SpecTracker::CLI.start(ARGV)
@@ -0,0 +1,50 @@
1
+ require 'pathname'
2
+ require 'csv'
3
+ require 'yaml'
4
+ require 'nokogiri'
5
+ require 'terminal-table'
6
+ require 'gemoji'
7
+ require 'thor'
8
+ require 'gherkin/parser'
9
+
10
+ require 'spec_tracker/version'
11
+ require 'spec_tracker/config/configuration'
12
+ require 'spec_tracker/test_status'
13
+ require 'spec_tracker/cli'
14
+
15
+ require 'spec_tracker/spec_parser/scenario'
16
+ require 'spec_tracker/spec_parser/specification'
17
+ require 'spec_tracker/spec_parser/base_parser'
18
+ require 'spec_tracker/spec_parser/csv_parser'
19
+ require 'spec_tracker/spec_parser/gherkin_parser'
20
+
21
+ require 'spec_tracker/test_report_parser/test_result'
22
+ require 'spec_tracker/test_report_parser/base_mapper'
23
+ require 'spec_tracker/test_report_parser/base_parser'
24
+ require 'spec_tracker/test_report_parser/j_unit/mapper'
25
+ require 'spec_tracker/test_report_parser/j_unit/parser'
26
+
27
+ require 'spec_tracker/reporter/status_ui'
28
+ require 'spec_tracker/reporter/base_ui_mapper'
29
+ require 'spec_tracker/reporter/base_reporter'
30
+ require 'spec_tracker/reporter/terminal/ui_mapper'
31
+ require 'spec_tracker/reporter/terminal/reporter'
32
+
33
+ require 'spec_tracker/reporter/report_datum'
34
+ require 'spec_tracker/reporter/report'
35
+ require 'spec_tracker/reporter/report_mapper'
36
+
37
+ require 'spec_tracker/report_task'
38
+
39
+ module SpecTracker
40
+ class Error < StandardError; end
41
+
42
+ class << self
43
+ attr_accessor :configuration
44
+ end
45
+
46
+ def self.configure
47
+ self.configuration ||= Configuration.new
48
+ yield(configuration)
49
+ end
50
+ end