CSC/ECE 517 Fall 2012/ch2a 2w33 pv

From Expertiza_Wiki
Revision as of 07:22, 23 October 2012 by Pgjalisa (talk | contribs)
Jump to navigation Jump to search

SaaS - 5.5 - Fixtures and Factories

Introduction to Testing

Fixtures

Fixtures are sample data on which all the tests run. There can be 3 types of fixtures<ref>http://ar.rubyonrails.org/classes/Fixtures.html</ref>:

1. YAML fixtures
2. CSV fixtures
3. Single-file fixtures

YAML Fixtures

YAML is a recursive acronym for "YAML Ain't Markup Language".<ref>http://en.wikipedia.org/wiki/YAML</ref> YAML is a file format which describes data structures in a non-verbose, human-readable format. This file ends with the .yml extension.

The following shows the format of a YAML file:

post_one:
  title: one
  description: post_one_desc
  category: category_one
  user: user_one

CSV fixtures

Comma Separated Value format can be used to store sample data. The files end with ".csv" extension. The following show the format of a CSV file.

one, post_one_desc, category_one, user_one 

Single-file fixtures

Factories

Also see

References

<references />