MuseScore/mtest
2016-03-30 20:18:18 +02:00
..
biab fix mtest 2015-04-28 10:34:36 +00:00
bww/io update reference files for commit 389d24541d 2015-01-12 21:38:05 +01:00
capella fix mtest 2015-04-28 10:34:36 +00:00
guitarpro fix mtest, gp6 replace long if/else list by a map 2016-02-18 17:07:32 +04:00
importmidi Change orchestral percussion instruments to use orchestral percussion sounds 2016-02-15 14:36:01 -05:00
libmscore fix #96631 Expose TextStyleTypes to QML + test case 2016-03-30 20:18:18 +02:00
musicxml Merge pull request #2371 from lvinken/musicxml-iotest2 2016-02-15 15:13:14 +04:00
omr removing "Platform" tag from all mscx files 2014-05-12 18:54:56 +02:00
scripting add fret diagram write property tests 2015-11-04 13:22:33 +01:00
testoves fix mtest 2015-06-11 22:46:46 +02:00
build.xml Initial commit 2012-05-26 14:49:10 +02:00
cmake.inc fix compilation on mac 2015-11-16 18:21:01 +01:00
CMakeLists.txt add -Wno-inconsistent-missing-override on Mac to fix thousands of warnings from clang 2016-02-12 09:37:23 +04:00
config.h add tests for scripting interface 2015-04-03 18:24:12 +02:00
mscoreapi.h Initial commit 2012-05-26 14:49:10 +02:00
mtest.cpp fix #90811: allow dots in filenames 2015-12-16 10:24:34 +01:00
mtest.qrc fix mtest 2015-02-28 12:33:06 +00:00
openscore.h Initial commit 2012-05-26 14:49:10 +02:00
README.md fixed make test directions for linux, osx, win 2016-03-17 06:37:29 -04:00
test.mscx removing "Platform" tag from all mscx files 2014-05-12 18:54:56 +02:00
testutils.cpp make DPI=72 constant 2015-11-16 14:24:47 +01:00
testutils.h fix compilation errors in tests (3 and last) 2014-07-30 16:29:25 +02:00

Building & running the tests

To build all tests:

Linux OSX Windows
make debug
sudo make installdebug
cd build.debug/mtest
make
make -f Makefile.osx debug
make -f Makefile.osx installdebug
cd build.debug/mtest
make -f Makefile.osx
mingw32-make -f Makefile.mingw debug
mingw32-make -f Makefile.mingw installdebug
cd build.debug\mtest
mingw32-make -f Makefile.mingw

To run all tests:

ctest

To run only one test (for debugging purposes):

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