Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Testing Vaadin via Maven
We have the usual setup - JUnit unit tests that execute when we build our product via Maven. So I want to do the following:
1.) When compiling the source using Maven, I also want to compile the HTML Vaadin TestBench scripts from the src/test/resources folder into Java JUnit tests to the src/test/java package.
2.) When Maven gets to its test phase, I want it to execute the generated tests from step 1 above along with all our other JUnit tests.
Is this possible? My problems are:
1.) I am unsuccessful in trying to modify our existing pom to get the HTML scripts compiled into Java during the normal "mvn clean install" execution.
2.) I am unsure where to specify the external TestBench hub/rc connection details where the Vaadin generated Java Junit tests need to connect to in order to run the Vaadin tests successfully.
I have read The Book Of Vaadin chapter 13.9 about testing, but this is not really very clear to me. Firstly, it does not tell me how to automate the compilation of my HTML scripts into Java tests from Maven. Secondly, we do not use the Failsafe plugin and I fail to see exactly what the advantage is of using it.
Thank you in advance.
To reply to my own post, I have managed to get our HTML scripts compiled to Java using the Maven exec plugin to execute the Vaadin TestBench class com.vaadin.testbench.util.DirectoryTestConverter.
Now only to find a way to provide the TestBench test runner its arguments to connect to the Vaadin TestBench hub and rc running on our test enviornment.
You might want to see how we automate testing our TouchKit Add-on (using maven and TestBench):
Thank you for your answer. This worked perfectly for me and all seems to be working now.