All Projects β†’ fixrb β†’ brutal

fixrb / brutal

Licence: MIT License
A code-first approach to automate the writing of unit tests.

Programming Languages

ruby
36898 projects - #4 most used programming language
HTML
75241 projects
shell
77523 projects

Projects that are alternatives of or similar to brutal

drevops
πŸ’§ + 🐳 + βœ“βœ“βœ“ + πŸ€– + ❀️ Build, Test, Deploy scripts for Drupal using Docker and CI/CD
Stars: ✭ 55 (+1.85%)
Mutual labels:  test, scaffold
tfstage
TFStage: TensorFlow Project Scaffolding
Stars: ✭ 64 (+18.52%)
Mutual labels:  scaffold
Wasmite
Now WebAssembly has proper testing, unit-testing and debugging πŸ€—
Stars: ✭ 20 (-62.96%)
Mutual labels:  test
rasa-train-test-gha
A GitHub action to run easily rasa train and rasa test in the CIs.
Stars: ✭ 26 (-51.85%)
Mutual labels:  test
carina-demo
Carina demo project.
Stars: ✭ 40 (-25.93%)
Mutual labels:  test
debug.js
Debugger of JavaScript, by JavaScript, for JavaScript
Stars: ✭ 19 (-64.81%)
Mutual labels:  test
Selenium-Document
a document with regard to selenium
Stars: ✭ 285 (+427.78%)
Mutual labels:  test
reph
Phoenix/React application starter kit
Stars: ✭ 15 (-72.22%)
Mutual labels:  scaffold
cargo-testify
Watches changes in a rust project, runs test and shows friendly notification
Stars: ✭ 76 (+40.74%)
Mutual labels:  test
fastify-example
Example webapp with Fastify
Stars: ✭ 18 (-66.67%)
Mutual labels:  test
koa2-rest-scaffold
Koa2 RESTful API θ„šζ‰‹ζžΆγ€‚
Stars: ✭ 27 (-50%)
Mutual labels:  scaffold
ansible-role-test-vms
DEPRECATED - A Vagrant configuration to test Ansible roles against a variety of Linux distributions.
Stars: ✭ 42 (-22.22%)
Mutual labels:  test
cypress-angularjs-unit-test
Unit test Angularjs code using Cypress.io test runner
Stars: ✭ 23 (-57.41%)
Mutual labels:  test
golang-example
⚑ Golang Clean Boilerplate
Stars: ✭ 15 (-72.22%)
Mutual labels:  test
google-datastore-emulator
Google Datastore Emulator wrapper to nodejs
Stars: ✭ 17 (-68.52%)
Mutual labels:  test
slush-vertx
No description or website provided.
Stars: ✭ 36 (-33.33%)
Mutual labels:  scaffold
expectest
Crate provides matchers and matcher functions for unit testing.
Stars: ✭ 25 (-53.7%)
Mutual labels:  test
system-checks
βš™ Checks and shows Linux system info - Distro name, IP, running processes and etc. Official site - system-checks.org
Stars: ✭ 35 (-35.19%)
Mutual labels:  test
twilio mock
Mock Twilio gem for Ruby
Stars: ✭ 26 (-51.85%)
Mutual labels:  test
pytest-coverage-comment
Comments a pull request with the pytest code coverage badge and full report
Stars: ✭ 32 (-40.74%)
Mutual labels:  test

Brutal πŸ’ŽπŸ”¨

Version Yard documentation CI RuboCop License

A code-first approach to automate the writing of unit tests.

Intro

I Hate Tests

I don't like tests. It's not DRY. -- Matz

Overview

Let Brutal craft for you in no time a (potentially huge) framework-less vanilla Ruby file describing the actual behavior of your code across as many context combinations as necessary.

By delegating to Brutal the repetitive (and redundant) task of writing tests, you will be able to focus on your core business: the code itself.

Brutal-Driven Development

Warning

The Brutal-Driven Development process does not prevent bugs from appearing in the code.

A generated test suite acts as a picture of the code's behavior. Therefore, if the code is wrong, the picture of the code's behavior will also be wrong.

The mere fact that all expectations are true does not mean that the code behaves as it should.

It is therefore the responsibility of the developer to analyze the generated behavioral pictures to ensure that the code reacts as it is supposed to according to the contexts in which it is evaluated.

Installation

Add this line to your application's Gemfile:

gem "brutal"

And then execute:

bundle install

Or install it yourself as:

gem install brutal

Quick Start

Just type brutal in a Ruby project's folder and watch the magic happen.

Usage

The brutal.yml file is a manifest you can use to define your Brutal meta-spec. It has 4 top-level sections:

  • header - Specifies the code to execute before generating the test suite.
  • subject - Specifies the template of the code to be declined across contexts.
  • contexts - Specifies a list of variables to populate the subject's template.
  • actuals - Specifies templates to challenge evaluated subjects & get results.

Getting started

  1. Create a brutal.yml file in your application's root directory. The following example brutal.yml defines the shape of a Hello test suite:
---
subject: |
  "Hello " + "%{string}"

contexts:
  string:
    - Alice
    - Bob

actuals:
  - "%{subject}.to_s"
  - "%{subject}.length"
  1. Run the brutal command from the same directory.

  2. Read the generated test.rb file in the same directory:

# Brutal test suite

# ------------------------------------------------------------------------------

actual = begin
  "Hello " + "Alice"
end

raise if actual.to_s != "Hello Alice"
raise if actual.length != 11

# ------------------------------------------------------------------------------

actual = begin
  "Hello " + "Bob"
end

raise if actual.to_s != "Hello Bob"
raise if actual.length != 9

More examples

https://github.com/fixrb/brutal/raw/main/examples/

Rake integration example

A generated test.rb file could be matched as follows:

Rake::TestTask.new do |t|
  t.pattern = "test.rb"
end

Test suite

Brutal's test set is brutally self-generated here: ./test.rb

Contact

Versioning

Brutal follows Semantic Versioning 2.0.

License

The gem is available as open source under the terms of the MIT License.


This project is sponsored by:
Sashite

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].