How to build and run tests (mtest) in Visual Studio?

• Jan 27, 2019 - 12:46

I've followed the very thorough instructions at https://musescore.org/en/handbook/developers-handbook/compilation/compi… and I can successfully build and run the mscore project.

However, I'm not able to build the tests (mtest folder). When I open the folder I get

CMake Error at C:...MuseScore\mtest\CMakeLists.txt:30 (QT5_ADD_RESOURCES):
Unknown CMake command "QT5_ADD_RESOURCES"

even though I do have the Qt install in my path as instructed: C:\Qt\5.9.7\msvc2017_64\bin

I have experimented with adding other Qt folders to the PATH, and other environment variables related to CMake, such as CMAKE_PREFIX_PATH, and also tried running CMake on the command line in Developer Command Prompt, but haven't found the magic combination.

It would be great if someone who has mtest working successfully in Visual Studio could append the instructions to https://musescore.org/en/handbook/developers-handbook/compilation/compi…

The mtest README.md at https://github.com/musescore/MuseScore/tree/master/mtest is very old and only refers to mingw32, so perhaps that should be updated as well.

Thank you,
Julian

Windows 10
Visual Studio Community Edition 2017 (15.9.6)
Qt Visual Studio Tools 2.3.1
Qt 5.9.7 installed to default location C:\Qt\5.9.7 (msvc2017_64 only, not mingw32)


Comments

I am having the same problem.
It would be great to be able to write test easily, but I tried yesterday for a few hours without success to build and run the tests.
I was able to build the mtest.exe executable by manually launching MSBuild.exe with argument mtest.vcxproj. The working directory was %{buildDir}/mtest
However, the mtest executable only runs all the test executables, and I could not manage to build these.

I would like to help porting the tests to msvc if someone can point the right right direction.

Do you still have an unanswered question? Please log in first to post your question.