Skip to content
Work in progress. This library and its docs are new and still changing, and some parts are not yet tested on a real robot. Something wrong or unclear?Tell us with a short GitHub form.

TEST-01: Test kit - JUnit tests of your Robot.java on the laptop

medium prioritySimulator only (no robot needed)about 40 minLaptop tests (JUnit and the test kit)

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

  1. 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.
  2. Run ./gradlew :TeamCode:testDebugUnitTest from the robot project folder (Windows: gradlew.bat). All tests pass.
  3. Misspell a field in Tunables.java (say inPowr for inPower). Run again: tunablesNamesAreRight fails and names the field. Fix it.
  4. Change a motor's name in Robot.java to one the test does not use. Run again: read the message. Put it back.
  5. 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.
  6. 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 result

No 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.