Skip to content
Permalink
Browse files

Apply recent changes to Ruby Unit templates. separrating templates fi…

…les for initialization and assertions.
  • Loading branch information...
SultanEid committed Jul 31, 2018
1 parent 8976ee3 commit ac91455e0ec2dc334e6c502e0c05123df60e4b09
@@ -3,6 +3,8 @@ use members_Setup.ump;
use members_TearDown.ump;
use where_init.ump;
use members_AllTestCases.ump;
use members_AllAssertions.ump;
use testcase_init.ump;



@@ -1,39 +1,27 @@

class UmpleTToRubyUnit {
members_AllAssertions <<!<</*members_AllAssertions*/>> <<#

members_AllAssertions <<!<</*members_AllAssertions*/>><<#


if(as.getType().equals("true")
{#>>
AssertTrue ..
<<#}
if(as.getType().equals("AssertTrue"))
{#>>
assert(<<=as.getAssertCode()>>)<<#}

if(as.getType().equals("false")
if(as.getType().equals("AssertFalse"))
{#>>
AssertFalse ..
<<#}
assert(!<<=as.getAssertCode()>>)<<#}

if(as.getType().equals("equal")
if(as.getType().equals("AssertEqual"))
{#>>
AssertEqual ..
<<#}
assert_equal (<<=as.getAssertCode()>>)<<#}

if(as.getType().equals("null")
if(as.getType().equals("AssertNull"))
{#>>
AssertNull ..
<<#}
assert_nil(<<=as.getAssertCode()>>)<<#}

if(as.getType().equals("method")
if(as.getType().equals("AssertMethod"))
{#>>
AssertMethod ..
<<#}



assert_method (<<=as.getAssertCode()>>)<<#}
#>>
!>>



}
@@ -1,4 +1,8 @@
class UmpleTToRubyUnit {

use members_AllAssertions.ump;
use testcase_init.ump;

class UmpleTToRubyUnit {

members_AllTestCases <<!<</*members_AllTestCases*/>><<#

@@ -15,14 +19,12 @@ for (TestCase tc : model.getTestSuite(0).getTestcases())
if (init.getLocOrder() == i )
{

String par = "";
for (Parameter pa : init.getParameters()){
par += pa.getValue()+",";
}
par = (String) par.subSequence(0, par.length()-1);

#>>
<<=init.getObjectName()>> = <<=init.getIdentifier()>>.new(<<=par>>)<<#

if (init.getLocOrder() == i )
{
#>><<@UmpleTToRubyUnit.testcase_init>><<#
}


}

@@ -53,25 +55,7 @@ for (TestCase tc : model.getTestSuite(0).getTestcases())
String assertCode = as.getAssertCode().replace(".","->");
if (as.getLocOrder() ==i)
{
if(as.getType().equals("AssertTrue"))
{#>>
assert(<<=as.getAssertCode()>>)<<#}

if(as.getType().equals("AssertFalse"))
{#>>
assert(!<<=as.getAssertCode()>>)<<#}

if(as.getType().equals("AssertEqual"))
{#>>
assert_equal (<<=as.getAssertCode()>>)<<#}

if(as.getType().equals("AssertNull"))
{#>>
assert_nil(<<=as.getAssertCode()>>)<<#}

if(as.getType().equals("AssertMethod"))
{#>>
assert_method (<<=as.getAssertCode()>>)<<#}
#>><<@UmpleTToRubyUnit.members_AllAssertions>><<#

}

@@ -1,9 +1,12 @@
class UmpleTToRubyUnit{
testcase_init <<!<</*testcase_init*/>><<#
for (Initialization init : tc.getInits())
{#>>
init for testcase

<<#}
String par = "";
for (Parameter pa : init.getParameters()){
par += pa.getValue()+",";
}
par = (String) par.subSequence(0, par.length()-1);

#>>
<<=init.getObjectName()>> = <<=init.getIdentifier()>>.new(<<=par>>)<<#
#>>!>>
}
@@ -23,8 +23,9 @@ def teardown
end

def someTest < Test::Unitt::TestCase
p1 = Person.new("John","123","someAddrss")
p1 = Person.new("John","123","someAddrss")
assert(p1.get_id!=nil)


end
end
@@ -23,8 +23,9 @@ module AssertionModule
end

def someTest < Test::Unitt::TestCase
p1 = Person.new("John","123","someAddrss")
p1 = Person.new("John","123","someAddrss")
assert(p1.get_id!=nil)


end
end
@@ -23,8 +23,9 @@ def teardown
end

def someTest < Test::Unitt::TestCase
p1 = Person.new("John","123","someAddrss")
p1 = Person.new("John","123","someAddrss")
assert(p1.get_id!=nil)


end
end
@@ -23,8 +23,9 @@ module DependModule
end

def someTest < Test::Unitt::TestCase
p1 = Person.new("John","123","someAddrss")
p1 = Person.new("John","123","someAddrss")
assert(p1.get_id!=nil)


end
end
@@ -23,8 +23,9 @@ def teardown
end

def someTest < Test::Unitt::TestCase
p1 = Person.new("John","123","someAddrss")
p1 = Person.new("John","123","someAddrss")
assert(p1.get_id!=nil)


end
end
@@ -23,8 +23,9 @@ module GenerateModule
end

def someTest < Test::Unitt::TestCase
p1 = Person.new("John","123","someAddrss")
p1 = Person.new("John","123","someAddrss")
assert(p1.get_id!=nil)


end
end
@@ -45,8 +45,8 @@ public void tearDown()
@Test
public void TestGenerate()
{
language = "Java";
createUmpleSystem(languagePath, "/testGenerator_rubyunit_testGenerate.ump");
//language = "Java";
//createUmpleSystem(languagePath, "/testGenerator_rubyunit_testGenerate.ump");

language = "RubyUnit";
System.out.println(pathToInput);
@@ -23,8 +23,9 @@ def teardown
end

def someTest < Test::Unitt::TestCase
p1 = Person.new("John","123","someAddrss")
p1 = Person.new("John","123","someAddrss")
assert(p1.get_id!=nil)


end
end
@@ -23,8 +23,9 @@ module SubOptionModule
end

def someTest < Test::Unitt::TestCase
p1 = Person.new("John","123","someAddrss")
p1 = Person.new("John","123","someAddrss")
assert(p1.get_id!=nil)


end
end
@@ -23,8 +23,9 @@ def teardown
end

def someTest < Test::Unitt::TestCase
p1 = Person.new("John","123","someAddrss")
p1 = Person.new("John","123","someAddrss")
assert(p1.get_id!=nil)


end
end
@@ -23,8 +23,9 @@ module TestcaseModule
end

def someTest < Test::Unitt::TestCase
p1 = Person.new("John","123","someAddrss")
p1 = Person.new("John","123","someAddrss")
assert(p1.get_id!=nil)


end
end

0 comments on commit ac91455

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