All Downloads are FREE. Search and download functionalities are using the official Maven repository.

s.opensource.haxemojos-maven-plugin.1.0.1.source-code.testReport.vm Maven / Gradle / Ivy

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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy