-5

I try to test a code and got the Exception below:

The component(s) below failed to render. Possible reasons could be that: 1) you have added a component in code but forgot to reference it in the markup (thus the component will never be rendered), 2) if your components were added in a parent container then make sure the markup for the child container includes them in .

I don't know what to do now.

Dean James
  • 21
  • 6

1 Answers1

0

This error means that you have added a component in your Java code, e.g.:

add(new Label("someId", "Some text"));

but you forgot to add wicket:id="someId" to the corresponding HTML template.

So, Wicket says: I have a component in the Java component tree that I have no idea where and how to render.

martin-g
  • 17,243
  • 2
  • 23
  • 35
  • Thank You! But now now it says: Unable to find component with id 'create' in [Page class = de.econsuite.wartung.webapp.pages.fragenanworten.FragenAntwortenDetailsPage, id = 1, render count = 1] Expected: ':create'. Found with similar names: '' What Can I do now? – Dean James May 27 '19 at 14:30
  • ´´´´package de.econsuite.wartung.webapp.components.fragenantworten; import de.econsuite.wartung.webapp.WebTestBase; import de.econsuite.wartung.webapp.pages.fragenanworten.FragenAntwortenDetailsPage; import org.junit.Test; public class FragenAntwortenDatatableOptionsPanelTest extends WebTestBase { @Test public void FragenAntwortenDatatableOptionsPanelRendering() { FragenAntwortenDetailsPage page = new FragenAntwortenDetailsPage(); tester.startPage(page); tester.assertRenderedPage(FragenAntwortenDetailsPage.class); }} ´´´´ – Dean James May 28 '19 at 10:35
  • 2
    I see that you are new to StackOverflow. You can edit your question and add the code there, as you did in your following questions. Your comment mentions `id="create"` but there is no such component in the Java code you pasted so it won't be easy for us to help you. We will also need the HTML to see how `wicket:id="create"` is declared there. – martin-g May 29 '19 at 10:53