s.opensource.haxemojos-maven-plugin.1.0.1.source-code.testReport.vm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of haxemojos-maven-plugin Show documentation
Show all versions of haxemojos-maven-plugin Show documentation
Maven plugin created to build Haxe projects
The newest version!
package;
import haxe.unit.TestResult;
class GeneratedTestRunner extends haxe.unit.TestRunner
{
public static function main()
{
var runner = new GeneratedTestRunner();
#foreach( $case in $cases )
runner.add(new $case());
#end
runner.run();
}
override public function run():Bool
{
var _result = new TestResult();
var errors = 0;
var failures = 0;
result = _result;
for (c in cases)
{
runCase(c);
var caseName = Type.getClassName(Type.getClass(c));
var tests = _result.getTests();
var buff = new StringBuf();
var caseBuff = new StringBuf();
var caseErrors = 0;
var caseFailures = 0;
for (t in tests)
{
caseBuff.add('');
if (t.error != null)
{
caseBuff.add('');
caseErrors++;
errors++;
}
else if (t.backtrace != null)
{
caseBuff.add(' ');
caseFailures++;
failures++;
}
caseBuff.add(' ');
}
buff.add('');
buff.add(caseBuff.toString());
buff.add(' ');
sys.io.File.saveContent("$surefireDir"+"TEST-" + caseName + ".xml", buff.toString());
}
haxe.unit.TestRunner.print(result.toString());
Sys.exit(failures > 0 || errors > 0 ? 1 : 0);
return result.success;
}
}
class TestResult extends haxe.unit.TestResult
{
public function getTests():List
{
return m_tests;
}
}