Java 8 JDK
To install Java, download the JDK installer from: http://www.oracle.com/technetwork/java/javase/downloads/index.html
On Ubuntu to install Java (OpenJDK) run:
sudo apt update
sudo apt install default-jdk
If you'd rather run Oracle Java, run:
sudo add-apt-repository ppa:webupd8team/java
sudo apt update
sudo apt install oracle-java8-installer
To install eclipse, visit https://www.eclipse.org/downloads/ and download the installer. This is the most reliable method to get the latest version of eclipse.
Currently, Java 9 is not supported for this project. Please install Java 8 and update your JAVA_HOME
environment variable to point to your Java 8 JDK. Gradle will throw an exception if you try to use any other version of Java.
Alternatively, if you intend to run everything from command-line and you have multiple versions of Java installed, you can execute ./gradlew build -Dorg.gradle.java=<PATH_TO_JAVA_HOME>
or the similar Windows command to avoid updating your JAVA_HOME
variable. Note, however, that PATH_TO_JAVA_HOME
cannot include spaces in it, even if the path is quoted.
On some systems, eclipse may have issues when run with Java 9 (when the JAVA_HOME
variable points to the Java 9 directory). Set the JAVA_HOME
system/shell varible to point to Java 8.
Instructions for building the project Java Plugging based.
To import the project:
- Go to File > Import.
- In the Import window, expand the "Gradle" folder and select "Existing Gradle Project". Click "Next".
- If you encounter the Welcome screen (a screen describing how to "experience the best Gradle integration"), click "Next.
- On the "Import Gradle Project" screen, enter the "Project root directory" (the directory containing this README) or click "Browse..." and navigate to it. Once the root directory is entered, click "Finish".
To build the project, you will need the "Gradle Tasks" view (normally it is a tab in the bottom frame next to "Problems", "Javadoc", "Console", etc.). If you don't have it, go to Window > Show View > Other and from the Gradle folder, double click on "Gradle Tasks".
In the "Gradle Tasks" view, expand the project folder then expand "build". Double click on "build". You will be taken to the "Gradle Executions" view where you will see the results of running each step in the gradle build script. The project should build successfully (at least before you make any changes). To view what was printed to the screen by the build, open the "Console" view.
If you need to clean the project (delete all compiled files), double click on the "clean" target in the "Gradle Tasks" view in build under the project folder.
To compile from command-line, execute ./gradlew build
(on Linux\UNIX; including macOS) or gradlew.bat build
. This will download gradle and all required libraries (on the first run only). Then, it will compile the code, execute the Cucumber tests. The test results are emitted as a report to build/reports/tests/test/index.html
.
To open a report in a browser, append "file://" before the full path to the file (on Windows, change the "/" to ""), or navigate to the directory and open the file with the browser. For example, file:///\<pathToExpandedProject\>/build/reports/tests/test/index.html
, opens the JUnit test report on my system once I replace pathToExpandedProject
with the actual path.
If you need to clean the project (delete all compiled files), execute ./gradlew clean
(Linux/UNIX/MacOS) or gradlew.bat build
(Windows).
You can run this project within any Gradle-capable IDE (e.g., InteliJ IDEA, NetBeans with the Gradle plugin). Consult your IDE's instructions for how to set this up.
build.gradle
-- the build file that will help you build the SUT and tests as well as execute the tests and measure coveragegradlew
-- script to run gradle from a Linux/UNIX system (including MacOS).gradlew.bat
-- script to run gradle from Windowssrc/main/java
-- contains the system under test (SUT; in this case,Demo.java
). Do not modify this code.src/test/java
-- the JUnit test code that you develop. We provided an emptyDemoTest.java
file to get you started.build/reports
-- contains the different reports generated by the build. NOTE: This directory will only exist once a gradle build has been run!tests/test/index.html
-- the JUnit test report (describing which tests passed and which failed); this file is only created if the unit tests are executed.