Uploaded image for project: 'Product Technical Learning'
  1. Product Technical Learning
  2. PTL-2101

DO378-53: Ch7 GE1: Bogus native test and incorrect description of native testing process

XMLWordPrintable

    • ILT, ROLE, VT
    • en-US (English)

      URL:
      Reporter RHNID:
      Section: -
      Language: en-US (English)||
      Workaround: Copy, rather than extend ExpenseCreationTest, then remove all offending code and rely on manual control of the database (can't really use QuarkusTestResource in native tests).
      (see comments below for detailed solution)

      Description: At the end of the exercise, in step 11, the native test is never executed because its name is NativeExpensesCreation*IT*, which puts it into the verify lifecycle stage, and the student guide instructs students to execute the test goal.

      Additionally, were someone to figure that out and actually execute mvn -Pnative verify, they would first have to wait for the native image to be rebuilt (so that step in the exercise is unnecessary), and then observe the test failing, because it uses @Inject annotation which is not supported in NativeImageTest classes:

      [INFO] -------------------------------------------------------
      [INFO] T E S T S
      [INFO] -------------------------------------------------------
      [INFO] Running org.acme.rest.json.NativeExpensesCreationIT
      [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.011 s <<< FAILURE! - in org.acme.rest.json.NativeExpensesCreationIT
      [ERROR] org.acme.rest.json.NativeExpensesCreationIT Time elapsed: 0.011 s <<< ERROR!
      org.junit.platform.commons.JUnitException: @Inject is not supported in NativeImageTest tests. Offending field is org.acme.rest.json.ExpensesCreationTest.entityManager

      {{[INFO] }}
      [INFO] Results:
      {{[INFO] }}
      {{[ERROR] Errors: }}
      [ERROR] NativeExpensesCreationIT ยป JUnit @Inject is not supported in NativeImageTest t...
      {{[INFO] }}
      [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

            rht-eramirez Eduardo Ramirez
            gregab@p0f.net Grega Bremec
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: