function(add_oscap_test test_script)
	add_test(${CMAKE_CURRENT_SOURCE_DIR}/${test_script} ${CMAKE_CURRENT_SOURCE_DIR}/${test_script})
	set_tests_properties(${CMAKE_CURRENT_SOURCE_DIR}/${test_script}
		PROPERTIES
			SKIP_RETURN_CODE 255
			ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR};top_srcdir=${CMAKE_SOURCE_DIR};builddir=${CMAKE_BINARY_DIR}"
	)
endfunction()

configure_file("test_common.sh.in" "test_common.sh" @ONLY)

add_subdirectory("API")
add_subdirectory("bz2")
add_subdirectory("codestyle")
add_subdirectory("CPE")
add_subdirectory("DS")
add_subdirectory("mitre")
add_subdirectory("nist")
add_subdirectory("oscap_string")
add_subdirectory("oval_details")
add_subdirectory("probes")

function(add_oscap_test test_script)
	add_test(NAME ${CMAKE_CURRENT_SOURCE_DIR}/${test_script}
		COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${test_script}
	)
	set_tests_properties(${CMAKE_CURRENT_SOURCE_DIR}/${test_script}
		PROPERTIES
			SKIP_RETURN_CODE 255
			ENVIRONMENT "srcdir=${CMAKE_CURRENT_SOURCE_DIR};top_srcdir=${CMAKE_SOURCE_DIR};builddir=${CMAKE_BINARY_DIR}"
	)
endfunction()

configure_file("test_common.sh.in" "test_common.sh" @ONLY)

add_subdirectory("API")
add_subdirectory("bz2")
add_subdirectory("codestyle")
add_subdirectory("CPE")
add_subdirectory("DS")
add_subdirectory("mitre")
add_subdirectory("nist")
add_subdirectory("oscap_string")
add_subdirectory("oval_details")
add_subdirectory("probes")

Use add_test(NAME .... COMMAND ...) in add_oscap_test
Use add_test(NAME .... COMMAND ...) in add_oscap_test

It makes it way more readable.
