-
Notifications
You must be signed in to change notification settings - Fork 2
added robot init unit test #6
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "enableCppIntellisense": false, | ||
| "currentLanguage": "java", | ||
| "projectYear": "2024beta", | ||
| "projectYear": "2024", | ||
| "teamNumber": 8033 | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // Copyright (c) FIRST and other WPILib contributors. | ||
| // Open Source Software; you can modify and/or share it under the terms of | ||
| // the WPILib BSD license file in the root directory of this project. | ||
|
|
||
| package frc; | ||
|
|
||
| import edu.wpi.first.hal.HAL; | ||
| import frc.robot.Robot; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| /** Test robot init. */ | ||
| public class InitTests { | ||
| @BeforeEach | ||
| private void setup() { | ||
| HAL.initialize(500, 0); | ||
| } | ||
|
|
||
| @Test | ||
| private void initTest() { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Prefer test names that say what is expected. These are never called, so you should be excessively verbose since it's what's going to communicate intent when it fails. F.e, "robotShouldNotCombustWhenFedFrechfries()" would be a totally reasonable unit test method name.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also note you don't event need test in the name - you've already communicated it's a test with the annotation
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All that being said, what's your goal with this method? When does it fail? What does it tell you when it does?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the goal here is just to make sure
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Then I'd make it explicit with a assertDoesNotThrow. Communicates your intent and makes clear you didn't forget the assert along the way. |
||
| var robot = new Robot(); | ||
| robot.startCompetition(); | ||
| robot.close(); | ||
| } | ||
| } | ||
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.
Is this set to true on purpose?
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.
yes, to avoid excessive delays during deploys from running unit tests, and instead my plan was to run these tests in ci