Skip to content

IOTransformDCMTK: Improve tests (migrated from ITKIOTransformDCMTK#5) #6308

@hjmjohnson

Description

@hjmjohnson

Migrated from InsightSoftwareConsortium/ITK#6358 (originally opened by @jhlegarreta) following the in-tree ingest of IOTransformDCMTK into Modules/IO/IOTransformDCMTK/.

The existing tests under Modules/IO/IOTransformDCMTK/test/ should be improved:

  • ITK testing conventions on the naming of the test files should be applied.
  • The ITK testing macros should be used consistently (e.g. ITK_TRY_EXPECT_NO_EXCEPTION, ITK_EXERCISE_BASIC_OBJECT_METHODS, etc.) to avoid boilerplate code.
  • The tests should run as long as possible and return the status code at the end (use a testStatus and update it as individual checks fail rather than early-returning).
  • The coding style should conform to the ITK coding style (Appendix Three).

Current state (post-ingest)

  • test/itkDCMTKTransformIOTest.cxx already uses ITK_EXERCISE_BASIC_OBJECT_METHODS, ITK_TRY_EXPECT_NO_EXCEPTION, ITK_TRY_EXPECT_EXCEPTION, ITK_TEST_EXPECT_TRUE, and ITK_TEST_EXPECT_EQUAL, but still return EXIT_FAILURE; on the first nullptr dynamic_cast rather than accumulating a status.
  • test/ReadDicomTransformAndResampleExample.cxx is structured as an example-style driver: it uses raw try / catch blocks and per-step return EXIT_FAILURE instead of the ITK testing macros, has no ITK_EXERCISE_BASIC_OBJECT_METHODS coverage, and contains commented-out DCMTKImageIO/DCMTKSeriesFileNames paths (selected over GDCM because "DCMTKImageIO does not populate the MetaDataDictionary yet").

Suggested follow-up scope

  1. Convert ReadDicomTransformAndResampleExample.cxx to a proper test driver using ITK testing macros and a testStatus accumulator.
  2. Reduce per-test early-returns in itkDCMTKTransformIOTest.cxx to status-accumulating checks where it does not change the test's logical contract.
  3. Drop the commented-out DCMTKImageIO/DCMTKSeriesFileNames code blocks, or open a tracking issue for the missing MetaDataDictionary population if that work is still desired.
  4. Audit file naming against ITK conventions (itk<Module><Subject>Test.cxx).

Tagging @jhlegarreta as the original reporter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:TestingEnsure that the purpose of a class is met/the results on a wide set of test cases are correct

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions