-add_test(NAME "outline-beamer" COMMAND ${PERL_EXECUTABLE} ${CMAKE_BINARY_DIR}/lyx_batch.pl beamer_test)
-setmarkedtestlabel(outline-beamer "export")
+set(testlabel "batch")
+string(TOUPPER "${testlabel}_" testprefix)
+
+macro(add_batch_test testname testpar)
+ add_test(NAME "${testprefix}${testname}" COMMAND ${PERL_EXECUTABLE} ${CMAKE_BINARY_DIR}/lyx_batch.pl ${testpar})
+ setmarkedtestlabel(${testprefix}${testname} ${ARGN} "${testlabel}")
+endmacro()
+
+add_batch_test(outline-beamer beamer_test "export")