TestBench Trial

Hello all, I am trying to evaluate TestBench and running into issues with missing classes. My test class is as follows:

public class LoginTest extends UIUnit4Test
{
	@Test
	public void setUp()
	{
		final LoginView loginView = navigate( LoginView.class );
		
		test( loginView.getUsernameTextField() ).getComponent().setValue( "myuser" );
		assert ( StringUtils.equalsIgnoreCase( "myuser", test( loginView.getUsernameTextField() ).getComponent().getValue() ) );
	}
}

However, I am getting

[ERROR] path\to\code\LoginTest.java:[15,2] error: cannot access SideNav
[ERROR]   class file for com.vaadin.flow.component.sidenav.SideNav not found
[ERROR] path\to\code\LoginTest.java:[16,48] error: cannot access NativeLabel
[ERROR]   class file for com.vaadin.flow.component.html.NativeLabel not found

What I’ve tried/confirmed:

  • When running mvn clean install it opened a browser to confirm my trial license
  • I made sure to import com.vaadin:vaadin instead of com.vaadin:vaadin-core
  • I’m still unable to import either of these classes in my IDE, but I am able to import GridPro
  • I am using Vaadin version 23.3.35 and com.vaadin:vaadin-testbench-unit version 9.2.4

Small update, I tried using com.vaadin:vaadin-testbench instead of “-unit” version 23.3.35, and I’m able to build the project but when the tests run I get the following:

java.lang.NoSuchMethodError: 'io.github.classgraph.ClassGraph io.github.classgraph.ClassGraph.acceptPackages(java.lang.String[])'
        at com.vaadin.testbench.unit.BaseUIUnitTest.scanForTesters(BaseUIUnitTest.java:87)
        at com.vaadin.testbench.unit.BaseUIUnitTest.<clinit>(BaseUIUnitTest.java:69)

What am I doing wrong here?

You are using incompatible versions. Vaadin 23 requires test bench 8.x. please use the Vaadin BOM to manage your versions

Also note that SideNav has been introduced in Vaadin 24.

EDIT: but this is a side effect of using the incompatible Testbench version, as reported by Knoobie