Coder Social home page Coder Social logo

simple_dependency_finder's Introduction

Introduction

First of all, simple_dependency_finder(sdf) is built to figure out what test suits to run.

Big Project has a lot of unit tests. It takes long time to run all of test suits.

Some possible solution for faster test execution is..

  1. Run chunk of test on multiple CPU
  2. Run chunk of test on different machine
  3. Make less IO by refactor test files
  4. Run test suits as little as possible

sdf helps to do 4. Run test suits as little as possible

Install

download executable for your platform from Github Release.

How it works

Graph

dependency_graph

Above graph show dependency graph.

Each Node represents main module unit of any Programing Language. For example, class for Ruby, function for JS, package for Go, etc.

Arrow Between Nodes represents Which module knows which module. For example, OrderItem knows both Order and Item directly, and knows User Indirectly through Order

Below table shows what to test or what is effected based on change on this dependency graph.

Basically, we need to test only effected modules.

diff what to test
User User, Order, OrderItem
Order Order, OrderItem
Item Item, OrderItem
OrderItem OrderItem
CircularA CircularA, CircularB
CircularC CircularC, CircularD, CircularE

Function

sdf is cli tool, which is like function below.

Outputed effected modules are what we need to test.

It's important to understand that feeding these input is your responsibility.

How to parse code is very different based on context like Programing Language. So sdf does not care about it by design.

sdf_func

cli parameters...

option name desc required default type
mpath path to json file which has modules info true NA string
rpath path to json file which has relation info true NA string
diffs file diffs comma separated true NA string
depth how deep you want to search false 0(unlimited) int

each json scheme will be found in testdata directory

example usage

sdf \
  -mpath testdata/modules.json \
  -rpath testdata/relations.json \
  -diffs order.rb

Example Usage

Case: Ruby project

sdf \
  -mpath testdata/modules.json \
  -rpath testdata/relations.json \
  -diffs $(git ls-files -omd --exclude-standard | sed "s,^,$PWD/,") \
  | jq -r '.[] | .name' > patterns.txt

grep -rl -f patterns.txt spec/ | xargs rspec
rm patterns.txt

simple_dependency_finder's People

Contributors

kohei909otsuka avatar

Stargazers

shy_azusa avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.