Help With Autograder (Java, Eclipse, JUnit)! (Fixed? Maybe)

Does anybody use the auto-grader and Java?
I’ve been trying for months to get the auto-grader to work. I’m at my wits end.
I’ve had a little success. But it doesn’t last long. I need a more permanent solution.

So, I gave up for a while, but am trying it again with a new project.

It does have a build.gradle file, but no gradle nature.
I’ve tried adding a Gradle nature to previous projects. I can get them to work on my end, but not for the students. From what I’m reading the nature isn’t necessary.

I believe I’ve gotten the commands to run on the auto-grader. However, the tests always fail. If I run them as JUnit tests on my machine (Eclipse), they all pass.

If anyone wants to play with it, I’m more than willing to make you a student in the class.

Im using:

  • Eclipse 2021-06
  • Java 1.8
  • JUnit 5.7.1

This is the project I’m currently working on:
https://github.com/rhunter-NTatC/FRQ_Type1_FrogSimulator
Here’s my student fork:
https://github.com/NewTech-CoppellCompSci/frq_01_frogsimulator-rhunter-NTatC

These are the Test commands I’ve run:
Screen Shot 2021-10-06 at 8.24.13 AM|462x500
Test Commands:

  • gradle test --tests TestA.test1
  • gradle test --tests TestA.test2
  • gradle test --tests TestA.test3
  • gradle test --tests TestA.test4
  • gradle test --tests TestB.test1
  • gradle test --tests TestB.test2

These are the answers to the FRQ: (Apologies if it doesn’t format it like code)

public boolean simulate() {
		int totalDistance = 0;
		for (int i = 0; i < maxHops; i++) {
			
			int dist = hopDistance();
			
			totalDistance += dist;
			
			if(totalDistance >= goalDistance) {
				return true;
			}
			else if (totalDistance < 0) {
				return false;
			}
		}
		
		return false;
}
public double runSimulations(int num) {
		int numWins = 0, numLosses = 0;
		
		for (int i = 0; i < num; i++) {
			if (simulate()) {
				numWins++;
			}
			else {
				numLosses++;
			}
		}
		
		return (double) numWins / (numWins + numLosses);
}

Any help or guidance would be GREATLY appreciated!

Thank you!

Ok, so I ran with what I had for another class yesterday. And it’s working.
Yeah I don’t know…

Here’s the Template Repository
https://github.com/rhunter-NTatC/Unit02_ProblemSet_RoeShamBo
Here’s my student fork.
https://github.com/NewTech-CoppellCompSci/problemSet_02_roe-sham-bo-rhunter-NTatC/settings

Maybe it’ll work forever now. We’ll see.

The test runner from education/autograding executes each test as a separate task in Gradle. Thus, your mock class FS1 is getting reset for each test, resulting in the same 5 jumps every time [5, 7, 2, 8, 10]. Since test2() depends upon fs1.count having been updated by test1(), it fails. When you run the entire test file locally in Eclipse (or Gradle - gradle test --tests TestA) it will pass, but when run as individual tests (e.g. gradle test --tests TestA.test2), only test1() passes because it isn’t dependent upon anything else.

© 2017 GitHub, Inc.
with by
GitHub Education