Project

cascadence

0.0
No commit activity in last 3 years
No release in over 3 years
Organizational helper for writing serializations for use with threading. The biggest use case of this would be in selenium / capybara based integration testing as this allows you to run flows in parallel.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8.0
>= 0
~> 2.13.0
~> 0.7.0

Runtime

>= 0.18.1
 Project Readme

cascadence

Helper for organizing flow-based specs for such things as writing integration tests with rspec-capybara

Example Usage

Suppose you have the files:

  flows
  |- spam
  |   |- spam_flow.rb
  |   |- hard_spam_flow.rb
  |- spam.rb
  |- flow_helper.rb
  1. spam_flow.rb
  module Spam
    class SpamFlow < Cascadence::Flow

      cascading_order :step1, :step2, :step3

      def initialize(zero_state)
        self.state = zero_state
      end

      def step1
        self.state += 1
      end

      def step2
        _modifiy_state_in_some_way
      end

      def step3
        # more state modification
      end

      private

      def _modify_state_in_some_way
        # do stuff with self.state
      end
    end
  end

1.5. hard_spam_flow.rb

  module Spam
    class HardSpamFlow < SpamFlow
      fork_after :step1
      merge_before :step2
      cascading_order :step1point25, :step1point5

      def step1point25
        # modify state
      end

      def step1point5
        # modify state
      end
    end
  end
  1. flow_helper.rb
  require 'cascadence'
  require 'spam'
  require 'capybara'

  Cascadence.config do |config|
    config.parallel = true # or false
    config.max_thread_count = 4
    config.zero_state_generator = lambda { Capybara::Session.new :selenium }
  end
  1. spam.rb
  require 'spam/spam_flow.rb'
  require 'spam/hard_spam_flow.rb'

How to run

  $ cascadence flows/ # runs all flows
  $ cascadence flows/spam # runs all flows in the spam folder
  $ cascadence flows/spam/spam_flow.rb # runs the spam_flow.rb flow

Notes

You (I guess that would be me) need to fix how cascadence order is read, right now, the dependence on recursion is extremely resource heavy and definitely a bad idea (if not a target for memory leaks)

Update: version 0.2.1 out and still not fixed. You (that would be me) are a major faggot.

Contributing to cascadence

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
  • Fork the project.
  • Start a feature/bugfix branch.
  • Commit and push until you are happy with your contribution.
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2013 Thomas Chen. See LICENSE.txt for further details.