How to run test in paraview and plugin

Dear Experts,
I noticed there are many seems benchmark files under folder: “paraview\Testing\Data” and also in the plugin folder, like “paraview\Plugins\BagPlotViewsAndFilters\Testing” there are both recorded playing testing file and benchmark file like “BagPlotMatrixView.png.sha512”…

My question are:

  • How to run these these test files?

  • The png is from save screen, then convert into sha512? How to run paraview to compare automatically?

  • Where can i found any related references?

Thanks and Best Regards,
Sharon

Hi Sharon,
All ParaView tests are driven with ‘ctest’. If you build ParaView, you can enable the CMake option PARAVIEW_BUILD_TESTING, and then run ctest in your build directory - it will run all the ParaView tests.

ctest has a bunch of options, you might try ctest -V -R BagPlot to run verbose, and just tests with ‘BagPlot’ in the name.

The test data is stored separately from Git, and uses those .sha512 files to retrieve the data from data.kitware.com (I think). It ends up in the .ExternalData folder you can specify when you run ./Utilities/SetupForDevelopment.sh in the source directory to start developing ParaView.

There’s more in the developer documentation.

HTH,

Aron

You can also find examples of testing for an external plugin in Examples/Plugins/ElevationFilter

Hi Aron,

Thank you very much for your kind help and all the references!

Thanks and Best Regards,
Sharon

Thank you Mathieu very much!
This is also helpful, i will have a look at it.

Hi Mathieu, after a quick look at this example, this is a simple filter, i did not find any test inside…maybe i did understand what you mean…?

Thanks and Best Regards,
Sharon

The tests are only present in ParaView master and 5.8 source, not in 5.7 source.

Hi Mathieu,
Yes, you are right, my local version is 5.7, this test is in version 5.8.

By the way, there are still some questions:

  1. There are both xml file and python script file are there, what’s the purpose of xml file, there is no event like “compare image” inside the xml file

  2. To run this test, i need build the test first, then run by ctest?

  3. What’s is the best way to add unit test inside paraview framework? i found some test only has xml file but some are just python script files

  4. How to run paraview testing data: ParaViewTestingData-v5.7.0\ParaView-v5.7.0.ExternalData\SHA512? there are only files with sha512 hash code, how to use these data?

Thanks and Best Regards!

Quick note : The example in 5.8 is not fully compatible with 5.7, especially in the CMake side of things. If you stay with 5.7, you will not been able to use at it as is.

You can find 5.7 tests in Plugin/LagrangianParticleTracker

There are both xml file and python script file are there, what’s the purpose of xml file, there is no event like “compare image” inside the xml file

They are two types of tests in ParaView, XML tests and Python Tests. There are almost completely unrelated in their usage.

there is no event like “compare image” inside the xml file

Unless specified in the CMakeLists.txt, there is an automatic visual test at the end of it.

To run this test, i need build the test first, then run by ctest?

You need to enable testing in your ParaView instalation, rebuild, then run ctest -R NameOfTest, but this is only if you want to run this specific test. You do not need to that if you want to run tests in your own plugins.

What’s is the best way to add unit test inside paraview framework?

XML or Python tests both works. I personnaly prefere XML tests as they can be generated using ParaView interface with Tools->Record/Play test.

How to run paraview testing data: ParaViewTestingData-v5.7.0\ParaView-v5.7.0.ExternalData\SHA512? there are only files with sha512 hash code, how to use these data?

These is related to our data management system. Just enable to test and the file will be downloaded in your build/ExternalData directory. In your own plugin, you should not use this system anyway.

1 Like

Thank you Mathieu very much for your detailed answers!

All the information is very helpful!

Thanks and Best Regards,
Sharon

1 Like