All Projects → refIekt → Reflekt

refIekt / Reflekt

Licence: mpl-2.0
Reflective testing.

Programming Languages

ruby
36898 projects - #4 most used programming language
reflection
70 projects

Projects that are alternatives of or similar to Reflekt

Fracture
generative algorithm
Stars: ✭ 99 (-22.66%)
Mutual labels:  generative
Gini
A fast SAT solver
Stars: ✭ 112 (-12.5%)
Mutual labels:  fuzzing
Aflplusplus
The fuzzer afl++ is afl with community patches, qemu 5.1 upgrade, collision-free coverage, enhanced laf-intel & redqueen, AFLfast++ power schedules, MOpt mutators, unicorn_mode, and a lot more!
Stars: ✭ 2,319 (+1711.72%)
Mutual labels:  fuzzing
Awesome Cryptocurrency Security
😎 Curated list about cryptocurrency security (reverse / exploit / fuzz..)
Stars: ✭ 102 (-20.31%)
Mutual labels:  fuzzing
Clusterfuzz Tools
Bugs are inevitable. Suffering is optional.
Stars: ✭ 111 (-13.28%)
Mutual labels:  fuzzing
Websocket Fuzzer
HTML5 WebSocket message fuzzer
Stars: ✭ 115 (-10.16%)
Mutual labels:  fuzzing
Octo
A fuzzing library in JavaScript. ✨
Stars: ✭ 96 (-25%)
Mutual labels:  fuzzing
Triangle
Convert images to computer generated art using delaunay triangulation.
Stars: ✭ 1,838 (+1335.94%)
Mutual labels:  generative
Wooyun
wooyun public information backup
Stars: ✭ 112 (-12.5%)
Mutual labels:  fuzzing
Rest Api Fuzz Testing
REST API Fuzz Testing (RAFT): Source code for self-hosted service developed for Azure, including the API, orchestration engine, and default set of security tools (including MSR's RESTler), that enables developers to embed security tooling into their CI/CD workflows
Stars: ✭ 119 (-7.03%)
Mutual labels:  fuzzing
Ansvif
A Not So Very Intelligent Fuzzer: An advanced fuzzing framework designed to find vulnerabilities in C/C++ code.
Stars: ✭ 107 (-16.41%)
Mutual labels:  fuzzing
Fisy Fuzz
This is the full file system fuzzing framework that I presented at the Hack in the Box 2020 Lockdown Edition conference in April.
Stars: ✭ 110 (-14.06%)
Mutual labels:  fuzzing
Fuzzing Survey
The Art, Science, and Engineering of Fuzzing: A Survey
Stars: ✭ 116 (-9.37%)
Mutual labels:  fuzzing
Hackvault
A container repository for my public web hacks!
Stars: ✭ 1,364 (+965.63%)
Mutual labels:  fuzzing
Snodge
Randomly mutate JSON, XML, HTML forms, text and binary data for fuzz testing
Stars: ✭ 121 (-5.47%)
Mutual labels:  fuzzing
Afl Snapshot Lkm
A Linux Kernel Module that implements a fast snapshot mechanism for fuzzing.
Stars: ✭ 97 (-24.22%)
Mutual labels:  fuzzing
Generative art
A collection of my generative artwork, mostly with Processing in Python mode
Stars: ✭ 1,477 (+1053.91%)
Mutual labels:  generative
Musical Creativity
Models of Musical Creativity (in Clojure)
Stars: ✭ 125 (-2.34%)
Mutual labels:  generative
Cramer Gan
Tensorflow Implementation on "The Cramer Distance as a Solution to Biased Wasserstein Gradients" (https://arxiv.org/pdf/1705.10743.pdf)
Stars: ✭ 123 (-3.91%)
Mutual labels:  generative
Formatfuzzer
FormatFuzzer is a framework for high-efficiency, high-quality generation and parsing of binary inputs.
Stars: ✭ 117 (-8.59%)
Mutual labels:  fuzzing

Reflekt

Gem Version GitHub code size in bytes

Reflective testing.

Traditional testing is fine but it's not perfect. Tests often check for a golden path that works, when errors actually happen when the code or user does something unexpected. And with automated testing humans still have to write the tests.

Reflekt writes the tests for you, and tests in the negative for situations that you wouldn't have noticed. It works out of the box with no extra coding required. Because Reflekt tests your objects as they are used in the normal flow of the application, you get real world test results.

Usage

Add prepend Reflekt inside a class:

require 'reflekt'

class ExampleClass
  prepend Reflekt

Use the application as usual and test results will start showing up in the reflections folder:

Installation

In Gemfile add:

gem "reflekt"

In terminal run:

bundle install

Or:

gem install reflekt

Configuration

Reflekt.configure do |config|

  # Reflekt is enabled by default and should be disabled on production.
  config.enabled = true

  # The amount of reflections to create per method call.
  config.reflect_amount = 5

end

See Config.rb for more configuration options.

Skipping actions

You can configure Reflekt to skip "no undo" methods like deletion and sending email:

class ExampleClass
  reflekt_skip :method_name

Use reflekt_skip on the method that saves to the database to avoid persisting test data. If you still want to save test data to the database then use dependency injection to connect to a dummy database.

Skipping render

Use reflekt_skip on methods that do the final render to the UI to avoid a visual mess of duplicated elements. Separate the final output from the rendering logic so that Reflekt can track changes in output.

Don't do:

def show(product)
  # Business logic.
  product.title = "Showing #{product.name}"

  # Rendering logic.
  puts product
end

Do:

reflekt_skip :render

# Business logic.
def show(product)
  product.title = "Showing #{product.name}"  
  render(product)
end

# Rendering logic.
def render(product)
  puts product
end

How it works

When a method is called in the usual flow of an application, Reflekt runs multiple simulations with different values on that method to see if it can break things, before handing back control to the method to perform its usual task.

Control-Experiment loop

Reflekt builds itself as you build your application.

Terminology:

  • Control - A shapshot of real data (a subclass of Reflection)
  • Experiment - A shapshot of random data (a subclass of Reflection)

The loop:

  1. You write code and run it
  2. A Control reflection is created per method call, tracking input and output
  3. A set of rules are created from each Control on how the program works
  4. Many Experiment reflections are created per method call, containing random input and output
  5. Each Experiment is tested to pass or fail the set of rules previously defined by each Control
  6. Results are saved to the /reflections directory
  7. Your application returns its usual output

This feedback loop creates better results the more you develop and use your application.

Comparison

Conceptual differences between testing methodologies:

Traditional testing Generative testing Reflective testing
Automation ❌ Defined manually ❎ Defined semi-automatically ✅ Defined automatically
Granularity ✅ Tests PASS or FAIL ✅ Tests PASS or FAIL ✅ Tests PASS or FAIL
Replication ❌ Tests run externally ❌ Tests run externally ✅ Tests run internally
Feedback ❌ Tests run periodically ❌ Tests run periodically ✅ Tests run in real time

Tests run internally
Tests run alongside the normal execution of the program using the exact same code. There is no duplicate code in different files/environments calling the same APIs.

Tests run in real time
Multiple simulations run as you develop and use your application.

Consider this logic:

  1. Tests often check that things work (in the positive)
  2. Errors happen when things break (in the negative)
  3. Tests should check more often for the negative
  4. This can be automated

Philosophy

To keep coding fun. There are too many layers these days. It doesn't just make coding less fun, it makes it harder for new programmers to learn programming.

To stop duplicate code. RIP DRY. You use to hear “Don’t Repeat Yourself” a lot but not anymore. Traditional tests are just duplicate code, we don't need them.

To test code better. By completly automating testing we get 100% coverage and test for situations we never thought possible.

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].