6.031 — Software Construction
Spring 2017

Automated Testing

Starting with Problem Set 0, you have been using the Didit system for automated building and testing: every time you push your commits to Athena, the Didit build server pulls a copy of your code, attempts to compile it, and runs tests.

This kind of automation is very common in the world of professional software development, and is very useful for coordinating a team of developers. There is no ambiguity about whether the code compiles or not: if it doesn’t compile on the build server, it doesn’t compile. And there is no ambiguity about whether the tests pass: if they don’t pass on the build server, they don’t pass.

Naming

For this project, Didit will run your tests: any JUnit tests you check in to your team’s project repository will be executed and the results included in your Didit build report. Tests must be in either the src or test directory with a name like somethingTest.java or somethingTests.java for Didit to find them.

Restrictions

Your tests will be run in an environment with limited permissions and resources. Any deliberate attempts to circumvent these restrictions are a violation of course policy and academic standards, and will be dealt with harshly. However:

  • Your code runs with read-only access to your src directory, and read/write access to your test directory.

  • Your code may listen on and connect to localhost ports 5021—5121.

If you find that Didit is unable to run some of your tests but you think they are reasonable and should be supported, post on Piazza with “Didit test restrictions” in the subject line. Hopefully we will be able to make Didit more accommodating.

Excluding tests

You may have some tests that Didit cannot run. Don’t let Didit’s restrictions stop you from writing such tests. Instead, for these tests, include the Javadoc tag @category no_didit on the test class. All tests in that file will be ignored. You cannot use @category no_didit on methods — you must use it on the class.

Here’s an example:

package abc.sound;
import org.junit.Test;
/**
 * Test some music playing stuff.
 * @category no_didit
 */
public class SequencePlayerTest {

    @Test public void testPlayMusic() {
        // Didit will not run this test
    }
    // nor any other tests in this file
}

On your build results page, Didit will report which tests it attempted to run, and which tests it skipped. Make sure you and your teammates are running the skipped tests manually.

If you include no tests, Didit will count that as a pass — remember to also check whether your code compiled, since no compilation means no tests!