12 Replies Latest reply on Apr 12, 2016 5:06 AM by Matous Jobanek

    How to use CDI and before/after with UI tests?

    Christian Schulz Newbie



      I am wondering if there is a way to use CDI in UI tests to be able to generate and delete test data in corresponding test phases.


      I have tried following code. It makes no difference if I am using the @RunAsClient annotation on class or method level.


      Is the only method to autogenerate data a Startup Bean or similar?

      The injected bean is null if it is called in before/after.


      public class ListControllerUiTest {
        private WebDriver browser;
        private TestDataProvider dataProvider;
        public static WebArchive createDeployment() {
        public void insertData() {
          dataProvider.insertData(); // NPE
        public void clearData() {
          dataProvider.clearData(); // NPE
        public void showList(@InitialPage final ListPage page) {