MuseScore/mtest
2017-08-26 16:29:43 +02:00
..
biab change PageFormat to simple style values 2017-01-23 21:53:51 +01:00
bww/io update reference files for commit 389d24541d 2015-01-12 21:38:05 +01:00
capella update for keysig 2017-06-23 13:53:45 +02:00
guitarpro Several fixes for GP6 import, see #247361. Tuplets in voice > 1, freetext not duplicated, barre in multiple voices, better freetime support 2017-08-26 16:29:43 +02:00
importmidi update for keysig 2017-06-23 13:53:45 +02:00
libmscore fix regression: wrong stem direction 2017-08-10 14:35:18 +02:00
musicxml fix #239826 by ignoring lyrics on grace notes 2017-08-15 07:19:30 +02:00
omr update BarLine, mtests 2016-12-28 16:36:59 +01:00
scripting scripting update 2017-06-29 10:13:55 +02:00
testoves update BarLine, mtests 2016-12-28 16:36:59 +01:00
zerberus fix compilation of tests under Windows 2016-10-10 14:16:13 +02:00
build.xml
cmake.inc fix compilation of tests under Windows 2016-10-10 14:16:13 +02:00
CMakeLists.txt update scripting interface 2017-06-22 12:42:14 +02:00
config.h Fix #110306: Enable and improve OMR module 2016-05-17 11:48:38 -04:00
mscoreapi.h
mtest.cpp Basic Tests for Q, W, Shift+Q, Shift+W 2017-03-24 02:12:40 -04:00
mtest.qrc add MuseJazz score font and rename 2.0 MuseJazz to MuseJazzText 2016-10-11 15:26:49 +02:00
openscore.h
README.md fixed make test directions for linux, osx, win 2016-03-17 06:37:29 -04:00
test.mscx better bw. compatibility 2017-01-25 15:55:04 +01:00
testutils.cpp fix for foto mode 2017-06-20 09:57:18 +02:00
testutils.h update undo/redo infrastructure for text editing 2017-04-11 11:34:47 +02:00
updateReferences.sh fix #74921: implement pauses for MIDI files (hack) 2017-07-06 23:11:51 +01: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