CSC/ECE 517 Spring 2013/using fixtures with expertiza
Using Fixtures with Expertiza
Fixtures are a means with Rails to provide test data. Since Expertiza has several different types of ActiveRecord database objects, Fixtures can be a useful way to accomplish testing.
What is a Fixture?
The term "fixture" comes from the engineering world (see this definition [1]) and represents some device which can be used to test a system without having to use the system extensively. For example consider how one might test a car tire. Instead of driving a car with the tire thousands of miles, an engineer would create a test fixture which spins the tire over various simulated roads thus providing an easier means of comprehensive testing.
A software test fixture is the same concept - how can we set up a test that would normally be complex in a fixed way.
Fixtures in the context of Ruby on Rails represent test database entries. Once the test database is populated, either manual or automated testing can be done with the resultant database. Fixtures allow the tester to create the same data every time which allows for easier reproduction of bugs and quick regression testing.
How do fixtures compare to other test tools?
When is it appropriate to use fixtures?
How to use fixtures in Expertiza.
YAML language
YAML originally stood for “Yet Another Markup Language,” the authors now claim that it stands for “YAML Ain’t Markup Language.” The YAML specification can be found here. [link]
Basic YAML rules.
A pound / hash sign (‘#’) is used to begin a comment line. Only spaces, never tabs, may be used to indent YAML files. While this may seem annoying, it’s done to ensure compatibility between different environments which treat tabs in different ways.
An ActiveRecord object is defined with YAML in the following manner: objectName:
Attribute1: value Attribute2: value
…
Attributen: value