Skip to content
Permalink
Browse files

[TestGeneration] Testcases can be targeted toward specific platforms,…

…if test cases declared as JUnit, then it will only be generated if the xUnit generator chosen is JUnit. The same thing applies for PhpUnit and RubyUnit. This can be used to tag a lit of tetss to be only generated at the concrete level for a particular generator. syntax example: JUnit test testcaseName {//code}.
  • Loading branch information...
SultanEid committed Sep 23, 2019
1 parent 329b565 commit 502dfebf8afb32abed70ff1e49b68f9a8d88467b
@@ -6,17 +6,23 @@ members_AllTestCases <<!<</*members_AllTestCases*/>><<#
{
boolean hasBeforeAssertions=false;
boolean hasAfterAssertions=false;
String concreteLang="";






appendln(realSb, " //------------------");
appendln(realSb, " //User-defined Tests");
appendln(realSb, " //------------------");
for (UmpleTestCase uTestCase :uClass.getUmpleTestCases())
{#>>
for (UmpleTestCase uTestCase :uClass.getUmpleTestCases())
{
if(uTestCase.getIsConcrete())
{ concreteLang = uTestCase.getConcreteLang()+" "; }
#>>

test <<=uTestCase.getName()>> {
<<=concreteLang>>test <<=uTestCase.getName()>> {
<<#

for (UmpleAssertion uAssert : uTestCase.getUmpleAssertions())
@@ -264,6 +264,8 @@ class UmpleTestCase {
int locOrder;
boolean isTimed = false;
boolean isOverride = false;
boolean isConcrete = false;
String concreteLang = "";
0..1 -- * UmpleAssertion;
0..1 -- * TestAction;
0..1 -- * TestInit;
@@ -209,6 +209,16 @@ private void analyzeTestCase(Token token, UmpleElement uElement, UmpleTestCase u
for (Token subToken : token.getSubTokens())
{

if(subToken.getName().equals("isConcrete"))
{
if( subToken.getValue("isConcrete")!= null)
{
uTestCase.setIsConcrete(true);
uTestCase.setConcreteLang(subToken.getValue("isConcrete"));
}

}

if(subToken.getName().equals("testAction"))
{
analyzeTestAction(subToken,uElement,uTestCase);
@@ -62,7 +62,7 @@ methodThrowsExceptions : throws [~exception] ( , [~exception] )*
parameterList : OPEN_ROUND_BRACKET ([[parameter]] ( , [[parameter]] )* )? CLOSE_ROUND_BRACKET
parameter : [[typedName]]

testCase : [=isTimed:before|after]? [=isOverride:override]? test [~testCaseName] { ( [[assertion]] | [[testAction]] | [[testInit]] | [[testInitAtt]] | [[testInitAttWithMethodCall]] | [[comment]] )* }
testCase : [=isTimed:before|after]? [=isConcrete:JUnit|PhpUnit|RubyUnit]? [=isOverride:override]? test [~testCaseName] { ( [[assertion]] | [[testAction]] | [[testInit]] | [[testInitAtt]] | [[testInitAttWithMethodCall]] | [[comment]] )* }
assertion : [=isTimed:before|after]? [=assertType:assertTrue|assertFalse|assertEqual|assertNull|assertMethod] OPEN_ROUND_BRACKET [**code] CLOSE_ROUND_BRACKET ;
testAction : [~objectName] ( (.)[~methodName] )? OPEN_ROUND_BRACKET [[testActionParameterList]] CLOSE_ROUND_BRACKET ;
testMethodCall : [~objectName] ( (.)[~methodName] )? OPEN_ROUND_BRACKET [[testActionParameterList]] CLOSE_ROUND_BRACKET
@@ -26,7 +26,7 @@ class Person {
}


test checkName {
JUnit test checkName {
//test code

}
@@ -64,7 +64,7 @@ Test Person {



test checkName {
JUnit test checkName {
//test code
}

0 comments on commit 502dfeb

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