Skip to content
Branch: master
Find file History
Latest commit 4601a0e Aug 17, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
bww/io update reference files for commit 389d245 Jan 12, 2015
guitarpro Add style settings for articulations placement Jun 10, 2019
importmidi fix mtest Jun 24, 2019
libmscore fix #165621: Tremolo between 2 notes is copied even if unticked in se… Jul 30, 2019
musicxml fix #281591 - Mid-measure barlines are not exported to musicxml Aug 14, 2019
testoves remove RCS IDs from (almost) all files Nov 2, 2018
testscript Merge pull request #4884 from MarcSabatella/286616-mmrest-header-trailer Jun 15, 2019
zerberus remove RCS IDs from (almost) all files Nov 2, 2018
config.h Fix build without SCRIPT_INTERFACE on Qt 5.7 Jan 24, 2019
testutils.cpp Replacd integer midi tick values by fractions. Feb 18, 2019

Building & running the tests

To build all tests:

Linux OSX Windows
make debug
sudo make installdebug
cd build.debug/mtest
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:


To run only one test (for debugging purposes):

cd libmscore/join/

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

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
You can’t perform that action at this time.