Skip to content

Commit

Permalink
docs: refactor out DeveloperGuide into separate file
Browse files Browse the repository at this point in the history
Do this for consistency with the other AddressBook levels.
  • Loading branch information
pyokagan committed Jul 4, 2018
1 parent 62a5ba0 commit 1e7a58d
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 72 deletions.
76 changes: 4 additions & 72 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
= AddressBook (Level 1)
ifdef::env-github,env-browser[:relfileprefix: docs/]
:toc:
:toc-title:
:toc-placement: preamble
Expand All @@ -18,7 +19,7 @@ running into the complications of OOP or GUI programmings.
== User Guide

This product is not meant for end-users and therefore there is no user-friendly installer.
Please refer to the <<setting-up>> section to learn how to set up the project.
Please refer to the <<DeveloperGuide#SettingUp, Setting up>> section to learn how to set up the project.

=== Starting the program

Expand Down Expand Up @@ -149,75 +150,6 @@ When running the program inside IntelliJ, there is a way to set command line par
before running the program.
====

'''''

== Developer Guide

=== Setting up

*Prerequisites*

* JDK 8 or later
* IntelliJ IDE

*Importing the project into IntelliJ*

. Open IntelliJ (if you are not in the welcome screen, click `File` > `Close Project` to close the existing project dialog first)
. Set up the correct JDK version
.. Click `Configure` > `Project Defaults` > `Project Structure`
.. If JDK 8 is listed in the drop down, select it. If it is not, click `New...` and select the directory where you installed JDK 8.
.. Click `OK`.
. Click `Import Project`
. Locate the project directory and click `OK`
. Select `Create project from existing sources` and click `Next`
. Rename the project if you want. Click `Next`
. Ensure that your src folder is checked. Keep clicking `Next`
. Click `Finish`

=== Design

AddressBook saves data in a plain text file, one line for each person, in the format `NAME p/PHONE e/EMAIL`.
Here is an example:

....
John Doe p/98765432 e/[email protected]
Jane Doe p/12346758 e/[email protected]
....

All person data are loaded to memory at start up and written to the file after any command that mutates data.
In-memory data are held in a `ArrayList<String[]>` where each `String[]` object represents a person.

=== Testing

*Windows*

. Open a DOS window in the `test` folder
. Run the `runtests.bat` script
. If the script reports that there is no difference between `actual.txt` and `expected.txt`,
the test has passed.

*Mac/Unix/Linux*

. Open a terminal window in the `test` folder
. Run the `runtests.sh` script
. If the script reports that there is no difference between `actual.txt` and `expected.txt`,
the test has passed.

*Troubleshooting test failures*

* Problem: How do I examine the exact differences between `actual.txt` and `expected.txt`? +
Solution: You can use a diff/merge tool with a GUI e.g. WinMerge (on Windows)

* Problem: The two files look exactly the same, but the test script reports they are different. +
Solution: This can happen because the line endings used by Windows is different from Unix-based
OSes. Convert the `actual.txt` to the format used by your OS using some https://kb.iu.edu/d/acux[utility].

* Problem: Test fails during the very first time. +
Solution: The output of the very first test run could be slightly different because the program
creates a new storage file. Tests should pass from the 2nd run onwards.

'''''

== Learning Outcomes

_Learning Outcomes_ are the things you should be able to do after studying this code and completing the
Expand All @@ -238,7 +170,7 @@ Part B:
* Download the source code for this project: Click on the `clone or download` link above and either,
. download as a zip file and unzip content.
. clone the repo (if you know how to use Git) to your Computer.
* <<setting-up, Set up>> the project in IntelliJ.
* <<DeveloperGuide#SettingUp, Set up>> the project in IntelliJ.
* <<starting-the-program, Run the program>> from within IntelliJ, and try the features described in
the <<user-guide>> section.

Expand Down Expand Up @@ -278,7 +210,7 @@ Learn https://se-edu.github.io/se-book/testing/testAutomation/testingTextUis/[ho

==== Exercise: Practice automated CLI testing

* Run the tests as explained in the <<testing>> section.
* Run the tests as explained in the <<DeveloperGuide#Testing, Testing>> section.
* Examine the test script to understand how the script works.
* Add a few more tests to the `input.txt`. Run the tests. It should fail.
Modify `expected.txt` to make the tests pass again.
Expand Down
67 changes: 67 additions & 0 deletions docs/DeveloperGuide.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
= AddressBook Level 1 - Developer Guide
:stylesDir: stylesheets

[[SettingUp]]
== Setting up

*Prerequisites*

* JDK 8 or later
* IntelliJ IDE

*Importing the project into IntelliJ*

. Open IntelliJ (if you are not in the welcome screen, click `File` > `Close Project` to close the existing project dialog first)
. Set up the correct JDK version
.. Click `Configure` > `Project Defaults` > `Project Structure`
.. If JDK 8 is listed in the drop down, select it. If it is not, click `New...` and select the directory where you installed JDK 8.
.. Click `OK`.
. Click `Import Project`
. Locate the project directory and click `OK`
. Select `Create project from existing sources` and click `Next`
. Rename the project if you want. Click `Next`
. Ensure that your src folder is checked. Keep clicking `Next`
. Click `Finish`

== Design

AddressBook saves data in a plain text file, one line for each person, in the format `NAME p/PHONE e/EMAIL`.
Here is an example:

....
John Doe p/98765432 e/[email protected]
Jane Doe p/12346758 e/[email protected]
....

All person data are loaded to memory at start up and written to the file after any command that mutates data.
In-memory data are held in a `ArrayList<String[]>` where each `String[]` object represents a person.

[[Testing]]
== Testing

*Windows*

. Open a DOS window in the `test` folder
. Run the `runtests.bat` script
. If the script reports that there is no difference between `actual.txt` and `expected.txt`,
the test has passed.

*Mac/Unix/Linux*

. Open a terminal window in the `test` folder
. Run the `runtests.sh` script
. If the script reports that there is no difference between `actual.txt` and `expected.txt`,
the test has passed.

*Troubleshooting test failures*

* Problem: How do I examine the exact differences between `actual.txt` and `expected.txt`? +
Solution: You can use a diff/merge tool with a GUI e.g. WinMerge (on Windows)

* Problem: The two files look exactly the same, but the test script reports they are different. +
Solution: This can happen because the line endings used by Windows is different from Unix-based
OSes. Convert the `actual.txt` to the format used by your OS using some https://kb.iu.edu/d/acux[utility].

* Problem: Test fails during the very first time. +
Solution: The output of the very first test run could be slightly different because the program
creates a new storage file. Tests should pass from the 2nd run onwards.

0 comments on commit 1e7a58d

Please sign in to comment.