Remember, the first thing to do is to GET YOUR GitLab account, and let me know immediately, so you can work on the assignment. If you haven't done so, you also need to do Machine Setup and, after I create your repo, Repo setup
Assignments are submitted by pull-request, to a repo I create for you. After you tell me your GitLab username, then I will send you an email with your repo, and instructions.
Video walkthroughs for it are below:
This assumes you have created a projects folder on your Documents folder, and cloned your repo to it. It also assumes you used our folder conventions; please make adjustments if you changed something.
I provide pretty detailed instructions, that should work, but, in some cases, there may be issues ; get used to reading the output of the commands you type, and look for any errors. If so, don't follow the rest of the instructions until you've fixed it :)
Open your git-bash console, and type:
cd ~/Documents/projects/cs5000
Then: cd a0 (to go to the a0 folder)
git checkout master
git pull
git checkout -b a0
After this, if you type git status you should see 'on branch a0' or something like that in the output :)
Notice after you have created the branch, you should do git checkout a0 without the -b. git status shows you which branch you are on, and git branch shows which branches are available.
I provide unit tests that check your assignment works; you will normally start by running these tests and seeing them fail, and continuosly implement pieces of functionality and running the tests again; if it all works, you should pass more tests each time.
You can run the tests two different ways; using gradle, an automated build system, or using IntelliJ, an Integrated Development Environment (or any other IDE you prefer).
To start, run ./gradlew test to run all unit tests. You will see a bunch of messages, including some about tests failing, and a nicer report gets stored in an html file (look at the message).
run ./gradlew idea, then import your project into .
Start IntelliJ, and open the a0 project. There is a folder src, with two subfolders, main and test. Open the following files:
- src/main/java/assignment/Assignment0.java
- src/main/test/features/add.feature
Look at the code for Assignment0.java; notice it tells you to make some changes.
Do not worry about the code for add.feature, but select it and run it. You will see it executes several scenarios (unit tests), and they will all be red (failing). We will now do changes and see how the tests pass.
Select Assignment0.java again and do the first modification; make add return a+b
public static int add(int a, int b){
// TODO - replace line below with return a+b; to pass tests
return a+b
}Then go to DetailedTests, and run again. Now two tests should pass.
Now go change Assignment0 again, and fix subtract; run tests again ... lather, rinse, repeat until all tests pass.
Notice that if you prefer to use a different editor rather than eclipse, you can always use ./gradlew test to run the tests.
Just to make sure, run the grader again; go back to git-bash and run ./gradlew test ; you should see all tests pass.
When all the tests pass, get ready for submit.
- Use
git statusto make sure you are in the right branch - then
git add src/main/java/assignment/Assignment0.javato add all your changes (you can use tab to autocomplete, so you make sure you're typing the right file). - then use
git commmit -m "assignment 0"to commit your changes
git push origin a0
And then follow instructions to send a merge request (which I call pull request :). Make sure to assign it to me
This assignment is for practice and will not be graded; however, you need to do this before attempting assignment 1.