Skip to content

Commit

Permalink
[ELITERT-1198] First commit for Github release
Browse files Browse the repository at this point in the history
Created from github-prep@0fbd4cb

Change-Id: Ib698face4ce8d680956fffeb18fce49fb56909e3
  • Loading branch information
Sergio Bobillier committed Oct 28, 2024
0 parents commit c128dca
Show file tree
Hide file tree
Showing 159 changed files with 12,554 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/.bundle/
/.yardoc
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/

# rspec failure tracking
.rspec_status

/Gemfile.lock
15 changes: 15 additions & 0 deletions .reek.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
### Generic smell configuration

detectors:
TooManyInstanceVariables:
max_instance_variables: 10
TooManyStatements:
max_statements: 10
DuplicateMethodCall:
max_calls: 3
NestedIterators:
max_allowed_nesting: 2
UncommunicativeVariableName:
accept: [_, e]
LongParameterList:
max_params: 5
3 changes: 3 additions & 0 deletions .rspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--format documentation
--color
--require spec_helper
13 changes: 13 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
AllCops:
Exclude:
- spec/spec_helper.rb
Metrics/BlockLength:
Exclude:
- spec/**/*
Metrics/LineLength:
Max: 120
Metrics/MethodLength:
Max: 15
Style/FrozenStringLiteralComment:
Exclude:
- bin/console
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.7
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
language: ruby
cache: bundler
rvm:
- 2.6.3
before_install: gem install bundler -v 2.1.4
176 changes: 176 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

Please mark backwards incompatible changes with an exclamation mark at the start.

## [Unreleased]

### Fixed
- Made the date/time format used for the `started_at` and `finished_at`
attributes in the exported JSON files stable.

## [5.2.0] - 2024-04-16

### Added
- The JSON file produced when the `-e` CLI switch is given now includes:
- The `started_at`, `finished_at` and `runtime` attributes under the
`verification_result` structure.
- A copy of the `started_at` and `finished_at` attributes directly in each of
the exported objects (This is being added temporarily for
backwards-compatibility reasons and will be removed later).

## [5.1.2] - 2023-12-11

### Fixed
- Fixed the rendering of array-type Test Record IDs in the HTML report. They are
no longer directly rendered with the extra characters added by Ruby's default
`#to_s` method.
- Fixed a `NoMethodError` that appeared after the release of ActiveSupport 7.1.

## [5.1.1] - 2023-07-14

### Fixed
- Fixed an issue that caused the validation to fail when the listed files or
glob patterns had a `/` at the beginning.

## [5.1.0] - 2023-07-13

### Added
- The `Explorer` class will now log all the found MTR files.

## [5.0.1] - 2023-06-05

### Fixed
- Fixed a bug where the validated and transformed meta-data did not get assigned
to the TestRecord. This, in turn, caused issues when rendering the HTML report
since it assumes that these attributes will be arrays.

## [5.0.0] - 2023-05-26

### Changed
- ! Updated `activesupport` from `~> 6` to `~> 7`
- ! Set the minimum Ruby version for the project to `2.7.0`

## [4.0.0] - 2023-05-24

### Changed
- The "Tester name" attribute will only be visible in the HTML report when the
MTR has a value in the `name` field.
- The `name` attribute of the MTRs will now be validated, only strings and
arrays of strings are allowed now.

### Added
- Added the `test_method` and `tc_derivation_method` fields to the JSON and
HTML exports.
- Added the `MetaDataFieldValidator` class.
- Added the `test_method` and `tc_derivation_method` attributes to the
`TestRecord` class.
- Added validation for the `test_method` and `tc_derivation_method` attributes
of the MTRs, they can only have strings or arrays of strings.

## [3.0.0] - 2023-04-05

### Added
- Added the `Exporters::IDGenerator` class.
- Added the `DescriptionValidator` class.

### Changed
- Changed the `JSONExporter` class. It now makes use of the `IDGenerator` class
to attach a unique ID to each of the exported MTRs.
- Added validation for the `descriptionn` field of the MTRs. Only Strings are
allowed now.

## [2.3.0] - 2023-03-31

### Added
- Added a `rescue` to the `software_branches` method in the `HTMLExporter` class
to keep it from crashing when it cannot read the branches from one of the
repositories.

## [2.2.0] - 2023-03-08

### Changed
- Moved the `repo_base` and `relative_to_repo` methods from the `HTMLExporter`
class to the `RepositoryHelper` module.
- Moved the `initialize` method from the `HTMLExporter` class down to the parent
`Exporter` class.
- Changed the `Exporter` class to allow it to export results to JSON format.

## [2.1.2] - 2023-01-12

### Fixed
- Fixed a bug that caused the verification to pass in multi-repo set-ups even
when there were changes in the listed files when `.` was given as a path to
the `check` command.

## [2.1.1] - 2022-12-22

### Fixed
- Fixed an issue with how the file names were being displayed in the HTML report
when the repository's path was the current working directory: (`.`).

## [2.1.0] - 2022-12-19

### Added
- Added the `--multi-repo` command line switch. This switch tells Dragnet that
it is running in a multi-repo environment and will prevent it from assuming
that the given path is a Git repository.
- Dragnet can now recognize and validate MTR files that include the `repos`
attribute (to reference files from multiple repositories).
- Added the `branches_with` and `branches_with_head` methods to the `Repository`
class.

## [2.0.0] - 2022-09-13

### Changed
- Updated `activesupport` to version 6.x
- Updated `jay_api` to version 15.x
- Changed the minimum Ruby version requirement for the gem to 2.5.0

## [1.0.0] - 2021-07-02

### Changed
- Two new entity objects were introduced `Dragnet::TestRecord` and
`Dragnet::VerificationResult` these will be used instead of the previously
used Hashes. This allows the logic of validation and value evaluation to be
centralized.
- The validation code for the Test Records was moved from
`Dragnet::Validators::DataValidator` to the
`Dragnet::Validators::Entities::TestRecordValidator` class and to a series of
field validation classes inside the `Dragnet::Validators::Fields` module.

### Added
- Introduced the `Dragnet::Exporter` class which handles exporting the results
of the verification process to different formats (for the moment only HTML is
available, via `Dragnet::Exporters::HTMLExporter`)
- Changed the CLI to receive the `--export` option. (Which can be given
multiple times).
- Added the `Repository` class. A thin wrapper around the Git class. It just
houses some utilitarian methods.

## [0.1.1] - 2021-06-10

### Removed
- Removed a stray "require 'pry'" from a file.

### Added
- Added "require 'colorize'" for validator and verifier classes.

## [0.1.0] - 2021-05-27

### Added
- Basic structure of the gem
- Added the basic classes for the Gem's CLI
- Added the `Explorer` class. The class searches for Manual Test Record files
on a given path with a set of glob patterns.
- Added the `check` command to the CLI.
- Implemented the `Validator` class.
- Added `jay_api` to the development dependencies in order to be able to use
the `TestDataCollector` class.
- Adds configuration for the `TestDataCollector` class.
- Enables the collection of Test Data for releases.
- Added the `Verifier` class. The class verifies the actual test records and
checks if there have been any changes since the commit specified in the MTR.
15 changes: 15 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# frozen_string_literal: true

source 'https://rubygems.org'

# Specify your gem's dependencies in dragnet.gemspec
gemspec

gem 'pry', '~>0'
gem 'rake', '~> 12.0'
gem 'reek', '~> 6'
gem 'rspec', '~> 3.0'
gem 'rubocop', '~> 1'
gem 'rubocop-rspec', '2'
gem 'simplecov', '~> 0.17.0'
gem 'yard', '~> 0'
119 changes: 119 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# Dragnet

A gem to verify, validate and analyze MTR (Manual Test Record) files.

Provides a command line tool to perform different types of validations
on MTR files. These files are YAML files that contain information about
the performed test and the revision (commit) for which the test was
performed.

## Why and how?

When testing software you strive to automate as much as you can. However not
everything can be tested with automated tests. Sometimes there is no way to
automate the test, in other cases the effort required to automate the test
vastly exceeds the benefits, or the automated test has a very narrow scope.

In these cases manual tests are a good alternative. But, how do you know when
you need to execute manual tests again? Do you execute them for every release?
That is certainly possible but probably not very efficient. This is where
Dragnet can help.

This is how it works:

1. You create a Manual Test Record (MTR). In it you describe what needs to be
tested and how.
2. You list the source files that are involved in the feature the MTR refers to.
(You can list individual files or use glob patterns).
3. You state the SHA1 of the revision you used to perform your test last time.

*Whenever there are changes to these files Dragnet will detect them and*
*remind you that the manual test needs to be performed again.*

4. You perform the manual test again and update the SHA1 in the MTR.

> 💡 Dragnet finishes with specific exit codes allowing you to integrate it in
> your CI pipelines.
## Dragnet needs very little to work

Dragnet only needs Ruby and Git to work. Git is probably already part of your
toolchain and Ruby is a very flexible language. You can install it easily in
any platform or use one of the official Docker images.

## Requirements

* Ruby >= 2.7.0 (MRI)
* Bundler >= 2.4.0
* Git >= 2.0.0

## Setup

Clone the repository and install the dependencies by running:

```shell
bundle install
```

## Running Tests

You can run the tests just by executing RSpec.

```shell
bundle exec rspec
```

To generate a Coverage report:

```shell
export COVERAGE=true
rspec
```

*The coverage report will be written to the `/coverage` path*

## Generating Documentation

```shell
bundle exec yard
```

*The documentation will be generated in the `/doc` path*

## Contributing

* This project uses [Semantic Versioning](https://semver.org/)
* This project uses a `CHANGELOG.md` file to keep track of the changes.

1. Add your feature.
2. While editing your code keep an eye out for Rubocop and Reek suggestions
try to keep both linters happy. 😉
3. Write unit and integration *(desirably but not required)* tests for it.
4. Run the tests with the coverage report generation enabled (Check the *Running
Tests section)*.
5. Make sure your Unit Test coverage is at least 90%
6. Run the `yard` command to generate documentation and make sure your
documentation coverage is 100% (everything should be documented)
7. Add your features to the `CHANGELOG.md` file under the *Unreleased* section.
(Check the `CHANGELOG.md`) file for info on how to properly add the changes
there.
8. Push your changes for code review

### Releases

After your changes have been reviewed, approved and merged to master you need to
create a Release Pull Request

1. Decide which type of version increase is the right one for the changes listed
in the *Unreleased* section of the `CHANGELOG.md` file. (Not only your
changes but all the changes listed there). Use the criteria outlined in the
[Semantic Versioning](https://semver.org/) documentation.
2. Increase the version accordingly in the `lib/dragnet/version.rb` file.
3. Create a new section in the `CHANGELOG.md` file for the version and move
the changes on the *Unreleased* section there.
4. Create a new Pull Request for the release. Make sure to follow the following
convention for the commit message.

```
[RELEASE] Version x.y.z
```
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task default: :spec
14 changes: 14 additions & 0 deletions bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env ruby

require 'bundler/setup'
require 'dragnet'

# You can add fixtures and/or initialization code here to make experimenting
# with your gem easier. You can also use a different console, if you like.

# (If you use this, don't forget to add pry to your Gemfile!)
# require "pry"
# Pry.start

require 'pry'
Pry.start
Loading

0 comments on commit c128dca

Please sign in to comment.