I am trying to launch a test from the windows command line using the following way described in many tutorials:
javac -cp .;"c:\full\path\to\junit-4.12.jar" test\java\ColorTest.java
but in the result I have compilation errors in each string:
public class ColorTest extends BaseTest{
^
symbol: class BaseTest
src\test\java\ColorTest.java:14: error: cannot find symbol
homePage.goToHomePage();
^
symbol: variable homePage
location: class ColorTest
src\test\java\ColorTest.java:15: error: cannot find symbol
homePage.moveToElement(HomePage.letterR, X_OFFSET, Y_OFFSET);
^
symbol: variable HomePage
location: class ColorTest
src\test\java\ColorTest.java:15: error: cannot find symbol
homePage.moveToElement(HomePage.letterR, X_OFFSET, Y_OFFSET);
^
When I add to command all my classes (BaseTest, HomeTest
...) or use *.java
in command - I am did get errors on each other class (WebDriver
, ArrayList
, etc).
Also try to joins all libraries from my local repo:
javac -cp .;"c:\full\path\to\.m2\repositories\*" test\java\ColorTest.java
But in this case javac
did not see even junit
package in first string.
src\test\java\ColorTest.java:1: error: package org.junit does not exist
import org.junit.Test;
^
src\test\java\ColorTest.java:2: error: package org.junit does not exist
import org.junit.Assert;
- Why
javac
not imports any classes? - How can I correctly compile the test classes from command line via
javac
and lzunch them viajava
?