0
I have the following lines:
import static org.junit.Assert.*;
import org.openqa.selenium.WebElement;
public class ClasseTeste extends Navegadores {
public static void verificarTitulo() {
abrirChrome();
String titulo = driver.getTitle();
assertTrue(titulo.contains("google"));
fecharNavegador();
}
}
So how much I run the main:
public static void main( String[] args ) {
verificarTitulo();
}
This occurs:
Exception in thread "main" java.lang.NoClassDefFoundError: org/junit/Assert
at teste.NovoProjeto.ClasseTeste.verificarTitulo(ClasseTeste.java:11)
at teste.NovoProjeto.Main.main(Main.java:8)
Caused by: java.lang.ClassNotFoundException: org.junit.Assert
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
Can someone help me with this?
NoClassDefFoundError
indicates that Junit is not in the classpath of your project. You are sure that it is there?– Juliano Alves
How are you importing Junit? Via Maven or jar import? Please explain how your project is structured. At.
– banneddude
It’s a Maven project, all classes are in the main package. To import I just added these lines in the pom: <dependency> <groupid>junit</groupid> <artifactId>junit</artifactId> <version>4.10</version> <Scope>test</Scope> </dependency>
– andrepm