Is it possible to configure a code-based unit test so that students can see the assertions? For input-output unit tests, students can see the given input and expected outputs. However, this does not appear to be so for code-based unit tests.
There is value in students being able to see all of the assertions, even before they start coding. This helps them in fully understanding the presented problem, and the various cases they will need to handle.
I think this help article will help. Replit Docs - Unit testing
Ethan, thanks for your quick reply. I had meant to check back earlier, but such is the life of a teacher.
I have spent the intervening four months trying to figure this out, and just cannot find an answer through my own exploration nor through the documentation. Could you be more specific?
For context, I have substantial experience with unit testing; my courses have been unit test driven for many years. In Java, I have used JUnit. In Python, I have used a custom-written testing module, but which still uses the idea of assertions. I am happy to share links to repos where that it may be clearer what I am trying to achieve.
A month into my course, and this remain a significant problem. Students cannot see the unit test that will test their code, which
- affects their understanding of what their code is meant to do (a unit test being a specification)
- limits their ability to debug their code for given test cases.
I have tried to place a JUnit test into the repl, and then invoking it directly in main.java. This works to an extent, as at least the tests are visible and can be run. I then configure the unit testing interface to also call main.java, so that the two mechanisms run the same code. See https://replit.com/@CS20-2022-Fall/ex028-Loops-6#Loops6Test.java
This has its own problem, however, in that the debug tab will not run. Thus, students are relying on the stack trace to figure out which assertions are failing, and cannot step through their code. A desktop IDE (e.g. Eclipse) would certainly allow them to do so, and there is great value in it.
Any thoughts on how to make this work?