MuseScore/mtest
2014-08-08 11:43:25 +02:00
..
biab fixing the regression test files in mtest 2014-05-12 18:54:52 +02:00
capella change slur implementation to handle slurs to/from grace notes 2014-07-05 12:05:43 +02:00
guitarpro update tests 2014-08-01 07:20:28 -06:00
importmidi Separate voice also if it is in the middle of the chord 2014-07-29 18:38:00 +04:00
libmscore update mtest 2014-08-08 11:43:25 +02:00
musicxml fix transposing instruments pitch on MusicXML export 2014-07-23 21:51:22 +02:00
omr removing "Platform" tag from all mscx files 2014-05-12 18:54:56 +02:00
build.xml Initial commit 2012-05-26 14:49:10 +02:00
cmake.inc Ability to compile and run tests on Mac OSX 2014-06-23 16:07:33 +02:00
CMakeLists.txt Fix indentation of CMakeLists files 2014-07-29 18:37:56 +04:00
config.h replace Q_WS_* by Q_OS_* for Qt5 compatibility 2013-05-16 16:12:22 +02:00
mscoreapi.h Initial commit 2012-05-26 14:49:10 +02:00
mtest.cpp fix test compilation 2014-07-18 08:08:29 +02:00
mtest.qrc add ability to translate instruments.xml 2014-08-07 10:28:13 +02:00
openscore.h Initial commit 2012-05-26 14:49:10 +02:00
README.md add make install to tests on windows 2014-07-21 13:30:51 +02:00
test.mscx removing "Platform" tag from all mscx files 2014-05-12 18:54:56 +02:00
testutils.cpp fix compilation errors in tests (3 and last) 2014-07-30 16:29:25 +02:00
testutils.h fix compilation errors in tests (3 and last) 2014-07-30 16:29:25 +02:00

Building the tests

Adapt for your own platform

make debug
make debug install
cd build.debug/mtest
make
(make install) on Windows

running them all

ctest

running only one for debug purpose

cd libmscore/join/
./tst_join

To see how the CI environment is doing it check .travis.yml and build/run_tests.sh

Note: You need to have diff in your path. For Windows, get a copy of diffutils for Windows.

Test case conventions

Tests are grouped in directories by feature (like libmscore or mxl). In these directories, each subdirectory represents a test suite for a particular sub feature.

The name of a test suite directory should be descriptive. The CPP file for the tests should use the same name as the directory, for example tst_foo.cpp in directory foo. It's good practice to include a README file in a test suite directory.

Test suite CPP files contain one slot per test case. Each file should be called foo-XX with XX being an incrementing count. If a test case uses a file and a ref file, they should be called foo-XX and foo-XX-ref, with the extension .mscx. A test case should not reuse a file from another test case.

To create reference or original files, MuseScore can be run with the -t command line argument and it will save all the files in the session in test mode. Such files do not contain platform or version information and do contain extra data for tracing (for example, they contains pixel level position for beams).

How to write a test case

Import test

  • Open a short file containing an individual case in one of the formats supported by MuseScore
  • Save in MuseScore format
  • Compare with reference file

At first the test will fail because there is no reference file. Open the file created by the test case in MuseScore and try to edit it to be sure it's valid. If the file is valid, save it (without version number) as a reference file.

Object read write

Create a test case for all elements and all properties in each element. See libmscore/note

  • Create an object
  • Set a property
  • Write and read the object
  • Check if the property has the right value

Action tests

See libmscore/join or libmscore/split for example

  • Read a score file
  • Apply an action
  • Write the file
  • Compare with a reference
  • (Undo the action)
  • (Compare with original file)

Compatibility tests

Most of them are in mtest/libmscore/compat

  • Read a score file from an older version of MuseScore
  • Write the file
  • Compare with a reference file