TEST-01: Test kit - JUnit tests of your Robot.java on the laptop
- Your robot needs: any robot.
- Starter bots that fit: goBILDA starter bot, REV DUO starter bot, AndyMark Robits starter bot, Studica starter bot.
- Library version: v0.17.0 or newer.
- The docs it tests: Test kit module, Testing procedures, Tutorial 13: Test your code without a robot.
Why
The test kit gives your robot in five files pretend motors and servos, so a JUnit test on the laptop can do INIT, START and a loop, and check what each motor was sent. A typo in Tunables.java then fails on the laptop in a second, not at INIT on the field. It must work in any team's project with no extra Gradle lines.
Setup
- Your robot in five files in TeamCode, with the library in the robot project.
- TeamCode set up for tests once (tutorial 13, step 3: the JUnit line and
returnDefaultValues). - No robot needed: this test runs on the laptop.
Steps
- Make
TeamCode/src/test/java/org/firstinspires/ftc/teamcode/RobotTest.java: copy the whole file from the testing guide. Change the lift test to one of your parts and its configuration name. - Run
./gradlew :TeamCode:testDebugUnitTestfrom the robot project folder (Windows:gradlew.bat). All tests pass. - Misspell a field in
Tunables.java(sayinPowrforinPower). Run again:tunablesNamesAreRightfails and names the field. Fix it. - Change a motor's name in
Robot.javato one the test does not use. Run again: read the message. Put it back. - Write one test of your own: a command to one part, one loop (
robot.all().update()), then check the power or position the pretend device was sent. - Time a full run of the tests.
Pass rule
The tests run with no extra Gradle lines beyond tutorial 13's (0 added), step 3 fails with the field's name in the message, and the whole run takes under 60 s after the first build.
Record
Write these down while you test. The report form has them as a list to fill in.
- your parts (kinds) and which one your own test checks
- any Gradle line you had to add, and the error that made you add it
- the failure message from step 3 and step 4 (copy them)
- how long the tests took (seconds)
If your robot is different
Any robot in five files works. The test kit cannot show gravity, time passing (an action's waitSeconds) or cameras: use the simulator for those. A robot with odometry can use PretendPinpoint to put the robot where the test wants: say if you tried it.
Report your result
Pass, fail, or could not run: every result helps. The form opens on GitHub with this test filled in (a free GitHub account is needed). No student names, please.
Report resultNo reports for this test yet: yours would be the first. Every test's reports.
All tests · Next: DOC-04 Lesson 10 from start to finish - record, break and update a test
Something wrong on this page? Tell us with a short GitHub form.