Skip to content

Commit

Permalink
Completed Automated Text UI Testing
Browse files Browse the repository at this point in the history
Configured the runtest.bat file to work for semi automated ui text testing for users.
  • Loading branch information
Avalionnet committed Aug 19, 2020
1 parent caf233d commit 6ecf9b0
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/main/java/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ public void completed(){

@Override
public String toString(){
return (isDone ? "[\u2713]" : "[\u2718]") + " " + name;
return (isDone ? "[\u2705]" : "[\u2718]") + " " + name;
}
}
92 changes: 86 additions & 6 deletions text-ui-test/EXPECTED.TXT
Original file line number Diff line number Diff line change
@@ -1,7 +1,87 @@
Hello from
____ _
| _ \ _ _| | _____
| | | | | | | |/ / _ \
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|
Welcome to
____ _
| _ \ _ _| | _____
| | | | | | | |/ / _ \
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|

Your personal assistant :)
______________________________________________________
______________________________________________________
______________________________________________________
Got it. I've added this task:
[T][?] read book
Now you have 1 tasks in the list.
______________________________________________________
______________________________________________________
Invalid index entry
______________________________________________________
______________________________________________________
Got it. I've added this task:
[D][?] return book (by: June 6th)
Now you have 2 tasks in the list.
______________________________________________________
______________________________________________________
Got it. I've added this task:
[E][?] project meeting (at: Aug 6th)
Now you have 3 tasks in the list.
______________________________________________________
______________________________________________________
1: [T][?] read book
2: [D][?] return book (by: June 6th)
3: [E][?] project meeting (at: Aug 6th)
______________________________________________________
______________________________________________________
Nice! I've marked this task as done:
[T][?] read book
______________________________________________________
______________________________________________________
Sorry! I'm not really sure what to do with this command yet ☹
______________________________________________________
______________________________________________________
Got it. I've added this task:
[T][?] join sports club
Now you have 4 tasks in the list.
______________________________________________________
______________________________________________________
Got it. I've added this task:
[T][?] borrow book
Now you have 5 tasks in the list.
______________________________________________________
______________________________________________________
Nice! I've marked this task as done:
[T][?] join sports club
______________________________________________________
______________________________________________________
1: [T][?] read book
2: [D][?] return book (by: June 6th)
3: [E][?] project meeting (at: Aug 6th)
4: [T][?] join sports club
5: [T][?] borrow book
______________________________________________________
______________________________________________________
Got it. I've added this task:
[E][?] cca meeting (at: June 13th 3-4am)
Now you have 6 tasks in the list.
______________________________________________________
______________________________________________________
Got it. I've added this task:
[D][?] go to bed (by: 10pm)
Now you have 7 tasks in the list.
______________________________________________________
______________________________________________________
Nice! I've marked this task as done:
[E][?] project meeting (at: Aug 6th)
______________________________________________________
______________________________________________________
1: [T][?] read book
2: [D][?] return book (by: June 6th)
3: [E][?] project meeting (at: Aug 6th)
4: [T][?] join sports club
5: [T][?] borrow book
6: [E][?] cca meeting (at: June 13th 3-4am)
7: [D][?] go to bed (by: 10pm)
______________________________________________________
______________________________________________________
Bye. Hope to see you again soon!
______________________________________________________
16 changes: 16 additions & 0 deletions text-ui-test/input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
todo read book
done -1
deadline return book /by June 6th
event project meeting /at Aug 6th
list
done 1
carrots
todo join sports club
todo borrow book
done 4
list
event cca meeting /at June 13th 3-4am
deadline go to bed /by 10pm
done 3
list
bye
8 changes: 5 additions & 3 deletions text-ui-test/runtest.bat
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
@ECHO OFF

REM create bin directory if it doesn't exist
if not exist ..\bin mkdir ..\bin
if not exist "%CD%\..\bin" mkdir "%CD%\..\bin"

REM delete output from previous run
del ACTUAL.TXT

REM compile the code into the bin folder
javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\Duke.java
javac -cp "%CD%\..\src\main\java" -Xlint:none -d "%CD%\..\bin" "%CD%\..\src\main\java\Duke.java"
IF ERRORLEVEL 1 (
echo ********** BUILD FAILURE **********
exit /b 1
)
REM no error here, errorlevel == 0

REM run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT
java -classpath ..\bin Duke < input.txt > ACTUAL.TXT
java -classpath "%CD%\..\bin" Duke < input.txt > ACTUAL.TXT

REM compare the output to the expected output
FC ACTUAL.TXT EXPECTED.TXT

pause

0 comments on commit 6ecf9b0

Please sign in to comment.