juleswhite/mobilecloud-14

Assignment 1 - Build/release class depends on test class

Closed this issue · 2 comments

The AutoGrading class depends on the class AutoGradingTest which is part of the test classes. Most IDEs separate test and build/release classes in a manner to hide the test classes and libraries from the build classes.

I know it's common to intermingle test and build classes and libraries in Eclipse, but this doesn't work by default in NetBeans and IntelliJ IDEA.

Warren Gates posted a workaround on the Coursera discussion forum:
https://class.coursera.org/mobilecloud-001/forum/thread?thread_id=231#post-1094

This is a bit of a hack, as it adds the test classes (there's only one right now, the AutoGradingTest) to the set of classes to compile as part of a build. Personally, I think it's a bad idea to let project classes depend on the tests, as in a real project you wouldn't want to have to distribute the tests alongside the rest of the project.

Using the gradle-wrapper, the project compiles either way.

One possible solution, is to move the AutoGrading class to be part of the test classes instead of the release classes, no other class seems to depend on AutoGrading, and it is clearly there for testing purposes (although specifically for submitting test results to the Coursera grading system). I haven't checked how this affects Eclipse, but it looks like it should work just fine in NetBeans, and I'm guessing it should work fine in IntelliJ as well.

Running with AutoGrading as the main class doesn't seem to work when it is located in the test package. Instead gradle falls back to the Application class, so moving the class is not a viable solution.

Fixed in 559e5e4.