On Tue, 15 Apr 2014 18:24:30 GMT, Casey wrote:

Hello,

I just started using tested with dub and I've noticed that I don't see the "results.json" file being created when I do a "dub test". Is this the correct behavior because my expectation, from the documentation, is that it would automatically create this when I call "dub test" as well as execute the tests. Or am I missing something?

The default main file that DUB generates if "tested" is present looks like this:

import std.stdio;
import core.runtime;

void main() { writeln("All unit tests have been run successfully."); }
shared static this() {
	version (Have_tested) {
		import tested;
		import core.runtime;
		import std.exception;
		Runtime.moduleUnitTester = () => true;
		enforce(runUnitTests!allModules(new ConsoleTestResultWriter), "Unit tests failed.");
	}
}

So it runs the tests with a console result writer only. To generate the JSON file, a JsonTestResultWriter would have to be instantiated instead. To achieve that, you could either use dub test --main-file=../path/to/your/custom/main.d or by creating a "test" configuration in the project's dub.json that either specifies a different main file, or uses the same main file, but version (unittest) is used to replace the normal main function with the test runner.