Background: I am using jUnit to run Selenium tests. I am trying to set my tests to run with Jenkins nightly. I am able to pull my test/source files nightly and I can build and install my product. I am trying to build the java test files using the "Execute Shell" option in Jenkins on a linux vm.
I have a Java project that consists of a shared Utility project, selenium jars, and my source and test files. I can run the selenium tests in NetBeans without a problem.
The layout of the code is something like:
Utilities project:
src
-> utilities
-> UtilityFunctions.java
-> Logger.java
My project
misc
-> XmlConfigFileForTest.xml
-> PasswordFileForTest.txt
src
-> objects
-> User.java
-> ConfigFile.java
test
-> coreTest
-> coreTest1.java
-> coreTest2.java
-> setupTest
-> setupTest1.java
-> setupTest2.java
-> testSuites
-> runAllSetupTests.java
I cannot figure out how to run javac such that it will generate a jar that I can use to run my tests.
What I have tried:
Using How to set environment variables for javac to be able to find imported packages? I was able to include my selenium jars.
Once my code is compiled, I believe I can run the tests like How to run JUnit test cases from the command line.
My latest javac is:
javac -classpath selenium-java.jar:selenium-server-standalone.jar -sourcepath code -d build/classes code/test/testSuites/runAllSetupTests.java
This is currently failing because it cannot find the package 'objects'. My very limited understanding is that attempting to javac a file should cause it to pull in all included files.
Question 1: is there a way to just point javac (or another standard program) at a structured project like this and just get the jar out of it? Question 2: is there a better way to do this? I am doing this strictly to run my selenium tests nightly with jenkins. I am not married to the idea of using javac to compile it.
Edit:
Currently trying to use Ant instead of javac directly. Added tag for additional input.