MuseScore/mtest
2013-08-24 02:12:49 +04:00
..
biab update biab test reference 2013-06-30 23:40:05 -06:00
capella allow ties to connect to note in same or different voice 2013-08-21 12:00:12 +02:00
guitarpro allow ties to connect to note in same or different voice 2013-08-21 12:00:12 +02:00
importmidi Explicit ReducedFraction constructor 2013-08-24 02:12:49 +04:00
libmscore allow ties to connect to note in same or different voice 2013-08-21 12:00:12 +02:00
musicxml fix #20855: [MusicXML] Export of chordnames not over a ChordRest doesn't work 2013-08-09 23:28:45 +02:00
omr fix regression test 2013-07-31 11:54:16 +02:00
build.xml Initial commit 2012-05-26 14:49:10 +02:00
cmake.inc fix test build on windows 2013-08-09 18:37:41 +02:00
CMakeLists.txt Fix int overflow (new class ReducedFraction) 2013-08-24 02:12:48 +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 Initial commit 2012-05-26 14:49:10 +02:00
mtest.qrc more styling for ottava 2013-08-12 10:38:06 +02:00
openscore.h Initial commit 2012-05-26 14:49:10 +02:00
README.md update README file for mtest, diff needs to be in the PATH 2013-02-11 11:38:29 +01:00
test.mscx add unit test for element 2012-09-14 10:09:40 +02:00
testutils.cpp add guitar pro test 2013-08-01 08:17:21 +02:00
testutils.h fix regression tests 2013-05-13 20:24:19 +02:00

Building the tests

Adapt for your own platform

make debug
make debug install
cd build.debug/mtest
make

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 cases convention

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

A test suite directory for a test suite should be descriptive. The CPP file for the tests should use the same name than the directory tst_foo.cpp. It's good practise to include a README file in a test suite directory.

A test suite CPP files contains a signal per test case. Each signal should be called fooXX with XX being incremental. If a test case refers to a file and ref file, they should be call fooXX.mscx and foo-ref.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 specific information, version information, and can be instrumented (for example, they contains pixel level position for beams)

How to write a test case

Import test

  • Open a short file in one of the format supported by MuseScore and containing a special case
  • Save in MuseSCore format
  • Compare with reference file

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 sane. If the file is sane, save it (without your edition) 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 (currently only 1.2)
  • Write the file
  • Compare with a reference file