For the first assignment you will need to first follow the instruction on your Git and GitHub intro.

Step 1: GitHub Classroom

Using the link provided by your instructor, you first need to accept the assignment. This will create a repository for your assignment on GitHub. Go to your repository page and copy the SSH link to clone the repository. You can find it by clicking on the “Code” green button. Example:

git@github.com:ECE495-F24-handbook/ar694-graph.git

Step 2: Cloning the Repository

Now you should have a page that says your project was created, and states that the repository is empty. There should be a blue “Clone” button. If you click it, you should get a drop down. We’ll use the ssh one (assuming you have setup SSH keys already, this is easiest). Copy the link, and go to your command prompt and type git clone then paste the URL you copied in after that.

git clone git@github.com:ECE495-F24-handbook/ar694-graph.git

You should now have an (empty) directory named the same as your assignment. That directory is the root of your assignment, and we’ll do everything in there. cd into it.

Step 3: Setting up the Project

Run gradle init to setup a project. Your answers to the questions should be:

  • “Select type of project to generate:” 2: application
  • “Select implementation language:” 3: Java
  • “Split functionality across multiple subprojects?:” 1: no - only one application project
  • “Select build script DSL:” 1: Groovy
  • “Generate build using new APIs and behavior (…)?” no
  • “Select test framework:” 4: JUnit Jupiter
  • “Project name (default: ar694-graph):” (just enter for the default)
  • “Source package (default: ar694.graph):” edu.duke.ece495.YOURNETID.graph

    Note: replace YOURNETID with your actual netid. For me, this was edu.duke.ece495.ar694.graph

Step 4: Adding Code Coverage

Code coverage tools let you analyze which lines of code were executed during a particular run. It helps determine the share of code covered by tests and identify areas that lack sufficient test coverage. We will use JaCoCo plugin for that reason. It provides code coverage metrics for Java code via integration with JaCoCo.

Edit build.gradle to add the following to the plugins section: id 'jacoco

Then run gradle build just to make sure there are no problems in your build.gradle before you proceed. Gradle will try to find the required dependencies and re-build the project.

You can execute the jacoco task to generate test coverage by executing the following command: gradle jacocoTestReport. This will generate a report in the build directory. You can check the result at, build/reports/jacoco/test/html/index.html.

Back to Assignment Overview Page