veromary / divinum-officium

Automatically exported from code.google.com/p/divinum-officium
0 stars 0 forks source link

Test using Test::* #30

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I suggest using the Test::* packages from CPAN (Test::More, Test::HTML::Lint, 
TAP::Harness) to build a test suite for this project.

I found this presentation a useful introduction to the Test::* packages: 
http://petdance.com/perl/automated-testing/

You can see my initial work here:
  https://github.com/fiapps/officiumprog/tree/master/t

I built a simple Perl object (Test::Officium in TestOfficium.pl) that takes 
named parameters specifying an office and gives access to the HTML and plain 
text for the office.

Individual test files (*.t) use this functionality to fetch a particular office 
(let's call it $off), and can then:
 * validate the HTML with html_ok($off->html())
 * check for the presence of particular strings with like($off->text(), $regex, $comment)
 * check for the absence of something with unlike($off->text(), $regex, $comment)

Individual test files can be run directly with Perl (useful for debugging), but 
to run the whole suite we would use a simple script based on TAP::Harness to 
run all the .t files and summarize the results.

Checking for a regex is sufficient to do a whole host of tests:
 * is the alleluia absent from a particular office when it occurs after Septuagesima and present when it occurs (in a different year) before Septuagesima?
 * Is the correct hymn selected for a virgin martyr and a non-virgin martyr?
 * Is Psalm 50 said at lauds and not at matins when feria IV falls during the quattor tempora?

Original issue reported on code.google.com by a...@liturgiaetmusica.com on 5 Oct 2011 at 9:08

GoogleCodeExporter commented 9 years ago
As regards my Test::Officium object, I forgot to mention that I intended it to 
be a generic interface capable of getting the HTML for an office either by 
running a Perl script (e.g., Pofficium.pl) or by downloading a URL. In this 
way, the same test suite could run against a local copy of the divinum-officium 
program, a version installed on localhost, or even the live site.

Original comment by a...@liturgiaetmusica.com on 5 Oct 2011 at 9:11

GoogleCodeExporter commented 9 years ago
Thanks.  We are doing it a different way for now.  But every little bit helps.

Original comment by a...@malton.name on 5 Oct 2011 at 11:44

GoogleCodeExporter commented 9 years ago
Do you care to explain how? I don't want to build an independent test suite, 
but I do need to have a way to verify that new releases are improvements over 
old releases.

Original comment by a...@liturgiaetmusica.com on 5 Oct 2011 at 12:21