ruby - Automate testing of process flows in Rails -


i building educational service, , rather process heavy application. have lot of user actions triggering various actions, present, future.

for example, when student completes lesson day, following should happen:

  • updating progress count user-module record
  • checking if has completed particular module , progressing him next 1 (which in turn triggers more actions)
  • triggering current emails other users
  • triggering future emails himself (ongoing lesson plans)
  • creating range of other objects (grading todos teachers)
  • any other special case events

all these triggers built observers of various objects, , execution delayed using sidekiq.

what killing me testing, , paranoia might breaking whenever push something. in past, lot of assertion , validations checks, , sufficient. project, think not enough, given elevated complexity.

as such, implement testing framework, after reading through various options (rspec, cucumber), not clear should investing effort into, given rather specific needs, observers , scheduled events.

any advice , tips on approach , framework appropriate? save ass in near future ;)

not matters, using rails 3.2 / mongoid. happy upgrade if works.

testing can subjective topic, different approaches depending on problems @ hand.

i given primary need testing end-to-end processes (often referred acceptance testing), should checkout cucumber or steak. both allow drive headless browser , run through processes. kind of testing catch big show stoppers , allow modify system , notified of breaks caused changes.

unit testing, although important, , should used in parallel acceptance tests, isn't doing end-to-end testing, testing output of specific methods in isolation

a common pattern use called test driven development (tdd). in this, write acceptance tests first, in "outer" test loop, , code app unit tests part of "inner" test loop. idea being, when you've finished code in inner loop, outer loop should pass, , should have built enough test coverage have confidence future changes code either pass/fail test depending on if original requirements still met.

and lastly, test suite should grow , change app does. may find whole sections of test suite can (and maybe should) rewritten depending on how requirements of system change.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -