Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-3575

Support jUnit 4 in info.magnolia.test.TestUtil#getCurrentTestMethodName

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Won't Fix
    • Minor
    • None
    • None
    • testing
    • Yes

    Description

      Here's a patch that should allow this (pending classloader issues - to be validated with tests running in forked mode)

      The method - before and after patch - can appear a little unnecessary. In a regular junit3 test, one can simply do getName() to get the test method name. In Junit4, one can add the following to her test class

          @Rule
          public final TestName testName = new TestName();

      and consequently do testName.getMethodName() when necessary.

      However the util method allows to know the current test method in "external" classes (i.e where we'd have additional assertFoo() type of methods).

      Additionally, the patch provides a desc() method, which can be used to provide a default assertion description (assertTrue(desc(), some.boolean())), thus avoiding unnecessary typing/test description duplication.

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              dlipp Daniel Lipp
              gjoseph Magnolia International
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Task DoD