I was hoping that in this year's Software Engineering class, our capstone for Computer Science, could implement a disciplined automated test strategy for their Java project. Now, with only seven weeks left my students have not gotten that started.

I figured that jUnit, because it's so widely used, would be relatively accessible. However, it seems to have a lot of complexity. Specifically, the inexperienced DevOps students — who only work 18 days before switching teams — would have to dive into Maven or Gradle to get the correct artifacts.

Also, when programming my students would need to ramp up almost instantly on Java annotations, when many of them are relatively inexperienced.

I am dying for some kind of Java unit-testing package that will:

  • easily plug in to a project as one or two JAR files
  • allow students to adapt their own tests quickly by using a Test interface of some sort
  • have a minimal framework that will run all the tests and emit the results

Maybe there's a wrapper for jUnit that will do this? I don't know.

Thanks in advance for any suggestions.

  • 3
    $\begingroup$ Note that JUnit was developed to support "test first" or "test driven development". Are you willing to do that? An implication is that assignments need to be differently structured. $\endgroup$
    – Buffy
    Commented Mar 23 at 11:56
  • 4
    $\begingroup$ Maven and Gradle are popular Java project management and build tools. Their popularity is well earned, but as far as I am aware, they are not essential to using JUnit, or most other Java frameworks. I confess, that most of my first-hand experience with JUnit dates mostly to before Maven and Gradle existed, but I'm pretty sure you can still do things the old-school way: manually download JARs and put them in the classpath. $\endgroup$ Commented Mar 23 at 13:10
  • $\begingroup$ @Buffy I've sketched TDD for the class but it's impossible in a 16-week semester. $\endgroup$ Commented Mar 24 at 14:40
  • $\begingroup$ @JohnBollinger jUnit 5 ("jupiter") doesn't actually list the JARs at all, it basically says "Maven or Gradle"? $\endgroup$ Commented Mar 24 at 14:41

2 Answers 2


Good on you for adding this into your class! But I admit that sounds it like a lot in a short time to me.

My only practical thoughts are to (1) provide some starter code that gets the lab project going and also provides some sample tests, and (2) temper your expectations of the tests that the students do produce being very good.

Oh, and give lots and lots and lots of gradle support. For students new to gradle, that is a bit like landing on a foreign planet.

Learning to write tests, at least the mechanical part, isn't so hard if the setup is done and there is a model. JUnit is fairly straightforward! But learning to create a good test suite takes far longer to learn, and there's as much art to it as science. You can (and should!) give them some guidance, but I'd still grade that aspect quite gently.

  • $\begingroup$ Yes, thank you. I might be able to whip up some kind of setup — but isn't that what jUnit (or TestNG) should do out-of-the-box? $\endgroup$ Commented Mar 24 at 14:42

If you are willing to use TDD, even in an elementary course there is a solution. I've used it, though with older students.

On the first day of the term, give a demo about how to develop a piece of software using test first but with only small pieces of a larger program. Describe how the test tests requirements and then writing a small piece of the program makes the tests pass. One or two tests. A few lines of code.

Then, when you give assignments, instead of giving them as a narrative describing the entire program, divide it up into "stories" as is done in Extreme Programming,

The display initially has zero value.

When a number key is pressed, the display takes that value.


Then have the program built in the order of those stories.

Using this technique you can, in parallel, introduce the programming concepts that you need in the course.

Another way to say this is that you don't, initially, have the students divide up the required program into individual parts/tasks. You do that for them. At some point you can make the stories bigger and require more in problem decomposition but that also helps them understand that problem decomposition and program composition are different if complementary processes.

I also incorporated pair programming into this, but you may not want to go that far.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.