RCor OverviewHere are details about the commands available, default variables, conventions, usage and reporting. System DetailsRCor operates on instrumented HTML files according to the following pseudo-grammar: - '<' TAG 'concordion:' COMMAND '="' STATEMENT '">' TAG_CONTENT '</' TAG '>'
- TAG is an HTML tag: e.g. p, th, span, etc.
- STATEMENT is the phrase to be interpreted by RCOR: e.g. "#variable", "method()"
- TAG_CONTENT refers to any text in the tag.
So by that grammar the following html snippet: <p concordion:assertEquals="getGreeting()">Hello World!</p> can be decomposed thusly: - TAG => p
- COMMAND => assertEquals
- STATEMENT => getGreeting()
- TAG_CONTENT => Hello World!
Here are the COMMANDs available in RCor: - set : used to set variables in the RCor machine.
- assertequals : used to compare an RCor variable to a value provided by the spec: specifically TAG_CONTENT.
- verifyrows : used to automate instrumentation of assertequals.
- execute : used to invoke the system under test through the fixture.
RCor behavior: - default variable #TEXT : the string inside a tag instrumented with concordion, TAG_CONTENT.
- lookahead : looking ahead in the spec to reference variables before they are bound. More precisely, a variable in STATEMENT may be bound in TAG_CONTENT.
RCor provides a base class for fixtures: - ConcordionTestCase : used as a base class for fixtures, adds test method to the fixture to make it behave like a test case.
- a convention by which specifications can be found from a fixture name.
UsageRCor generally requires two input files to produce each output report: - (Input) foo_test.rb : containing a fixture class FooTest subclassing ConcordionTestCase
- (Input) foo.html : an HTML file describing the specifications of 'Foo'.
- (Output) foo_test_output.html : a decorated HTML containing all successes and failures of the specification 'Foo' as exhibited by the system under test through the fixture FooTest.
RCor is generally invoked as part of an automated build, typically with Rake: - RCOR_OUTPUT_DIR : environment variable directing the output directory for test reports created by RCor.
- build integration : because RCor tests mimic ruby unit tests, it is simply a matter of adding the RCor tests to the suite of unit tests already being invoked.
# example build environment that will run RCor specs along with regular unit tests
require 'test/unit'
require 'rcor'
Dir['*_test.rb'].each do |test| # find all the tests matching a certain naming convention
require test # this adds the test to the suite
end
|