test-abc2svg-lib
This repository provides an environment to to regression tests for abc2svg (https://github.com/moinejf/abc2svg)
- it is implemented this using ruby / rake / spec
- it uses abcnode to create process a bunch of inputfiles. It captures HTML from stdout and log from stderr
- it uses rspec as unit test framework to compare the results with a reference and to examine if the generated html contains "*** Abort“
- it collects the test cases from a source directory
- it stores the test-evaluation in a file based on abc2svg
git describe
- It can process all test cases or selected ones
prerequisites
- ruby 2.4.1
- bundler
- abc2svg
- node
installation
-
clone this repository to
{wherever}/test-abc2svg-lib
-
cd to
{wherever}/test-abc2svg-lib
-
install the required ruby gems
bundle install
-
install pixelmatch (https://github.com/mapbox/pixelmatch)
npm install -g pixelmatch
-
create a folder for your testdata, e.g.
{wherever}/test-abc2svg
-
cd to
{wherever}/test-abc2svg
-
create
{wherever}/test-abc2svg/rakefile.rb
require '../test-abc2svg-lib/rakefile.rb'
-
create
{wherever}/test-abc2svg/config.mft.rb
testfolder = "." $conf = { testoutputfolder: "#{testfolder}/test-output", testreferencefolder: "#{testfolder}/test-reference", testresultfolder: "#{testfolder}/test-results", testdifffolder: "#{testfolder}/test-diff", testsourcefolder: "#{testfolder}/test-source", sourcefiles: Dir["../**/*.abc"].uniq {|f| File.basename(f)}, chrome: '/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome', abc2svghome: "../abc2svg" }
Be sure to enter a proper glob patten for
sourcefiles:
The entry
chrome:
is optional. It should point to the executeable for headless chromee. If it is given we get visual diffs in testdifffolder. -
initialize
rake init
-
list available tasks
rake
-
collect the sources
rake buildsources
-
create first reference
rake rspec rake buildreference
-
commit this to git if you wish
usage
list the rake tasks by
rake
Hints
- the very first rspec run will flag all examples to fail since there is no reference
- if you take all your available abc files, there might be dupliate
filenames in diffent folders. The example configuration avoids this
by
uniq {|f| File.basename(f)}
- you need to investigate failing results in
test-output
License
This stuff is proviced under the same conditions as abc2svg:
// abc2svg-core is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// abc2svg-core is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.