This is a two part question. I'm trying to use JUnit for a project I'm working on in Sublime Text 3. The file setup I have looks somewhat like this
Vulcan/
Vulcan.sublime-project
bin/
...
src/
core/
org/
vulcan/
geom/
Vector.java
... (other similar files in the same package)
tests/
org/
vulcan/
geom/
VectorTest.java
... (relevant test files to match core/org/vulcan/geom/)
At the top of Vector.java
and VectorTest.java
, I have the line package org.vulcan.geom
. Now, in my sublime-project
file, I have set the source folder to Vulcan/src/core/
, so that when I build it, Vector.java
is compiled to bin/org/vulcan/geom/Vector.class
, but what this means is that upon building the whole project, the tests/
folder gets ignored and is not built to bin/
.
I attempted to fix this by setting the source folder to Vulcan/src/
, but that causes a bunch of errors in org/vulcan/geom/
, saying that it cannot find any of the class names in that package (I assume the fix for this would be to change the package from org.vulcan.geom
to core.org.vulcan.geom
but that would be a tedious process).
Question 1: So how can I set up my project such that the tests/
get compiled along with the core/
when I build the whole project?
Question 2: With this file structure, how would I run the tests in tests/
with JUnit
(each .java
file in tests/
is a test class runnable by JUnit
)? I've read the tutorials and I see that I can either run them from the command line (which I'm not quite sure how to do), or I can create a class whose main
method runs all the tests. If I choose the latter option, where would I put the "runner" class? Would I put it in tests/org/vulcan/geom/
, or in tests/org/vulcan/
, or in tests/org/
? And how would I run it from Sublime Text 3?