README.rdoc in assert-0.6.0 vs README.rdoc in assert-0.7.0
- old
+ new
@@ -63,17 +63,22 @@
* Fail
* Error
* Skip
* Ignore
-Tests can have many results of varying types.
+Tests produce results as they are executed. Every assert statement produces a result. Some results, like Error and Skip, will halt execution. Pass and Ignore results do not halt execution. Fail results, by default, halt execution but there is an option to have them not halt execution. Therefore, tests can have many results of varying types.
=== Macro
Macros are procs that define sets of test code and make it available for easy reuse. Macros work nicely with the 'should' and 'test' context methods.
+== User Options and Helpers
+Assert provides ways for setting user-specfic options and helpers. When Assert is setting itself up, the last setup step is to look for and require the file ~/.assert/options.rb. This file is essentially a user level test helper file. Use it to set options, configure assert extensions, setup or define how to view test results, etc.
+
+
+
== Running Tests
Assert uses a Runner object to run tests. Any runner object should take the test suite and view as arguments and should provide a 'run' method that runs the tests and renders the view.
=== Default Runner
Assert provides a default Runner object for running test suites (https://github.com/teaminsight/assert/blob/master/lib/assert/runner.rb). The default provides methods for running the tests, randomizing test order, and benchmarking test run time. Feel free to extend this runner as you see fit.
@@ -82,10 +87,18 @@
The default Runner object runs tests in random order and the default Terminal view will display the seed value. If you want to run tests in a consistant order, set a 'runner_seed' environment variable. Here's an example running tests with rake:
$ rake test # run tests in random order
$ rake test runner_seed=1234 # run tests seeding with '1234'
+=== Failure Handling
+Assert, by default, will halt test execution when a test produces a Fail result. However, Assert provides an option to not halt when Fail results are produced. You can control how assert handles fails by either setting an option (in your user .assert/options.rb file) or by setting an env variable:
+
+ Assert::Test.options.halt_on_fail false # force not halting on fail results
+
+ $ rake test halt_on_fail=true # force halt on failure using an env var
+
+
=== Rake Tasks
Assert provides some rake task helpers that will scan your test folder and recursively generate rake tasks for each one of your test folders or files ending in '_test'. Use this as an alternative to running ruby on each one of your test files individually.
As an example, say your test folder has a file structure like so:
@@ -107,9 +120,13 @@
rake test # Run all tests
rake test:basic # Run tests for basic
rake test:complex # Run all tests for assertions
rake test:complex:fast # Run tests for assertions:assert_block
rake test:complex:slow # Run tests for assertions:assert_empty
+
+By default, the rake tasks do not show which test files are being loaded. If you want to see this output from the rake tasks, set a "show_loaded_files" environment variable at the rake command line:
+
+ $ rake test show_loaded_files=true # run the tests showing which files were loaded
=== IRB with your environment loaded
Assert provides a rake task for running irb with your test environment loaded. Create an irb.rb file in your test file directory and have it require 'assert/setup'. See https://github.com/teaminsight/assert/blob/master/test/irb.rb for an example. Here's how you could use it:
$ rake irb