Skip to content
Permalink
Browse files

[TestGeneration] fixing files structure for test runner templates

  • Loading branch information...
SultanEid committed Oct 8, 2019
1 parent 74f3f5b commit 9281d86f92b980087375a1b512d8a1fb93ac6f84
@@ -1,5 +1,9 @@
namespace cruise.umple.testgenerator;

use Utility_TestRunnerTemplate_JUnit.ump;
use Utility_TestRunnerTemplate_RubyUnit.ump;
use Utility_TestRunnerTemplate_PhpUnit.ump;

class Util{

depend java.util.Random;
@@ -0,0 +1,50 @@
namespace cruise.umple.testgenerator;

class Util{


emit getTestRunnerTemplateJUnitCode (List<String> classes) (TestRunnerJUnitGenerator);

// Template for JUnit Test Runner
TestRunnerJUnitGenerator <<!<<#
String classesCode = "";

for (int x = 0; x < classes.size(); x++)
{
if (x == 0)
{classesCode+= classes.get(x)+".class";}
else
{classesCode+=", " +classes.get(x)+".class";}
}

#>>
import java.io.File;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.internal.TextListener;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;

public class TestRunner {

public static void main (String[] args)
JUnitCore junit = new JUnitCore();
junit.addListener(new TextListener(System.out));
Result result = junit.run(<<=classesCode>>);

resultReport(result);
}

public static void resultReport(Result result) {
System.out.println("Finished. Result: Failures: " +
result.getFailureCount() + ". Ignored: " +
result.getIgnoreCount() + ". Tests run: " +
result.getRunCount() + ". Time: " +
result.getRunTime() + "ms.");
}

}
!>>
}
@@ -0,0 +1,12 @@
namespace cruise.umple.testgenerator;

class Util{

emit getTestRunnerTemplatePhpUnitCode (List<String> classes) (TestRunnerPhpUnitGenerator);

// Template for PhpUnit test runner
TestRunnerPhpUnitGenerator <<!
//to be implemented
!>>

}
@@ -0,0 +1,14 @@
namespace cruise.umple.testgenerator;

class Util{

emit getTestRunnerTemplateRubyUnitCode (List<String> classes) (TestRunnerRubyUnitGenerator);


// Template for Ruby Unit test runner
TestRunnerRubyUnitGenerator <<!
//to be implemented
!>>


}

0 comments on commit 9281d86

Please sign in to comment.
You can’t perform that action at this time.