With the cancellation of the season, I have been working on a software curriculum for our team, with an emphasis on introducing some best practices that we find difficult to introduce later.
To that end, I have been trying to get get Junit working with a very simple robot code base. I want to start with the minimum that works, with the intention of building on it in later lessons. I am hampered by knowing virtually no Junit.
I started with @itsmechuckb and his videos, and with the PR request he has outstanding with WPILIB. (https://www.youtube.com/channel/UCekeDJzimFuocARIjuiDrGQ ) But I don’t want to modify any existing WPILIB classes. (https://github.com/wpilibsuite/allwpilib/pull/1461/commits/5ae640ebd048e13dc0ac8e438cc936dda7abd7cf ) I also was using the RoboTote example at https://github.com/robototes/2020_Template.
I started with a simple robot and started adding stuff from the template until I ran into a problem. I then tried just cloning their template a running that. When I run the template, I get an error about missing robot_library, which apparently is a submodule in GIT. I probably an figure this out, but it does suggest that the template is somewhat more complex than I would have hoped.
However, when I tried adding stuff as needed from the template to my small robot base, I found that I got a test to run. When I did a build it ran the tests I set up and they succeeded. I forced one to fail and rebuilt and now the test failed, so the tests were definitely getting run.
The problem though is when I went to the test file and pushed the “Run Test” button, the test just exits, no results. I stepped through the test and found that it was failing in the call to HAL.initialize(500, 0);. Apparently that jumps into some JNI code that blows up. Why does it work in the build but not individually? Any ideas?
If you want to see what I have at the moment, my repo is at:
P.S. it would really be great if WPI could add testing as a first class feature.