-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add information about writing tests #80
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Rui Shan! I believe this will be a great addition, as it allows students to follow along and learn about the various aspects of the code they need to write tests for as they go. I just have a few more additions for the tests based on the Git diffs in the tutorial.
tutorials/ab3AddRemark.md
Outdated
- Since we created a new file RemarkCommand, we should also create a `RemarkCommandTest` file. JUnit tests are annotated with `@Test`. For now, we expect `execute` in `RemarkCommand` to fail. Thus, the test will reflect this expectation. | ||
|
||
- ```java | ||
assertCommandFailure(new RemarkCommand(), model, MESSAGE_NOT_IMPLEMENTED_YET); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we include the full test instead? For clarity and consistency
@Test
public void execute() {
assertCommandFailure(new RemarkCommand(), model, MESSAGE_NOT_IMPLEMENTED_YET);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, done!
tutorials/ab3AddRemark.md
Outdated
@@ -141,6 +165,47 @@ public class RemarkCommand extends Command { | |||
} | |||
``` | |||
|
|||
<panel header="Update construction of `RemarkCommand` in `RemarkCommandTest`"> | |||
|
|||
- Since `RemarkCommand`’s constructor now accepts arguments, the tests will reflect that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since both the constructor and execute method of RemarkCommand
was updated, how about phrasing this like this instead?
Since RemarkCommand
now requires both an index and a remark for instantiation, the tests should be updated accordingly. Additionally, the execution of the command has been updated, so the tests should be adjusted to reflect these changes.
@Test
public void execute() {
final String remark = "Some remark";
assertCommandFailure(new RemarkCommand(INDEX_FIRST_PERSON, remark), model,
String.format(MESSAGE_ARGUMENTS, INDEX_FIRST_PERSON.getOneBased(), remark));
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amended it according to this too!
Hello Rui Shan, Great job on the proposed changes! I’ve reviewed your work, and I have a few additional suggestions that might help enhance the clarity and usefulness of the tutorial for the readers:
Thank you for your hard work and besides these, LGTM! |
@Carlintyj I'm not sure if we need this one. At this point students should have used JUnit in the iP already. We can point to the JUnit guide but we can't keep repeating all the basics in every tutorial :-) |
Okay, sounds good to me to just point to the JUnit guide. 😃 Thanks prof @damithc |
Not sure what this refers to exactly. I have included short sentences/ clauses to explain why the tests are being written. For example: Since
Done! Added a link in the first panel. |
I was thinking instead of saying we should also create Hope this clarifies my intentions. |
@Carlintyj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, LGTM! But are some of the contents overlapping with the Test section in IP?
tutorials/ab3AddRemark.md
Outdated
- ```java | ||
@Test | ||
public void execute() { | ||
final String remark = "Some remark"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not too sure but should this be indented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Added the indentation.
@ruishanteo Thanks for this PR. |
Fixes #79