|
Re: Problem using Epsilon Unit Testing Framework [message #870358 is a reply to message #870266] |
Mon, 07 May 2012 18:53 |
|
I'm sorry to hear that you're having problems. I've tried doing as you said, but it's working fine on my side:
- Import the examples.atl project.
- Run the stored launch configuration in "Test Tree2Graph.launch".
- SUCCESS (green bar).
- Open "models/graph-expected.model", after registering the two EPackages in metamodels.
- Add a new Node called "t3", and save.
- Run the previous stored launch configuration again.
- FAILURE (red bar), because the models are different.
Did you follow those steps, more or less? Is there anything I might have missed?
Which version of Epsilon are you using? Is it the latest interim version, a stable version, or are you running Epsilon straight from SVN?
All that said, I'm running into some issues with unmatched models and being unable to compare the expected and obtained models. I'll look into those as well .
[Updated on: Mon, 07 May 2012 18:53] Report message to a moderator
|
|
|
|
|
Re: Problem using Epsilon Unit Testing Framework [message #871319 is a reply to message #870661] |
Fri, 11 May 2012 22:45 |
|
Thanks, the version was a big hint: it does happen with the latest stable release. I was running Epsilon straight from SVN, so I didn't have your problem.
With the latest interim release, it doesn't do exactly that: instead, it produces an error saying it cannot find the comparator plugin required to integrate EMF Compare into EUnit. It seems we forgot to package the plugin into the Epsilon Core feature . The interim release complained about it, but the stable release simply said "SUCCESS" with no other indication. Sorry about that!
I've gotten it working by removing the stable release (using "Help -> About Eclipse -> Installed Features -> Uninstall..."), installing the latest interim release from http://download.eclipse.org/epsilon/interim/ and then unpacking the attached .zip to the dropins folder of your Eclipse installation. It's the missing plugin from the latest interim release .
You'll probably notice that the "Compare" button is grayed out, and you may get "Unmatched model" exceptions in some circumstances. These issues are fixed in SVN, though.
We'll try to prepare a new interim release as soon as possible with these issues fixed. Thanks for pointing it out!
[Updated on: Fri, 11 May 2012 22:49] Report message to a moderator
|
|
|
|
|
|
Re: Problem using Epsilon Unit Testing Framework [message #875972 is a reply to message #875842] |
Wed, 23 May 2012 16:36 |
|
The problem is that Ant properties are always global and immutable: once you set a value, they're frozen for the rest of the tests. A quick fix would be to use different property names for the atl_1 and atl_2 tasks.
There are quite a few ways to run the same tests for different sets of models in EUnit. I would suggest using EUnit's $with annotation, as it's very powerful: it allows you to repeat the same test with different sets of models. To use it, the models need to be available before EUnit is started, though, so you'd need to run the ATL transformations before launching EUnit.
To avoid copying and pasting the same fragment over and over, I'd suggest that you look into the <macrodef> Ant task to define your own reusable Ant task for running your ATL transformation.
Your eunit.xml file could look like this (untested, sorry!):
<project>
<target name="run-tests" depends="init-atl">
<runATL srcfile="models/myModel1.sysml" srcmodel="MyModel1" dstmodel="Model1"/>
<runATL srcfile="models/myModel1.sysml" srcmodel="MyModel2" dstmodel="Model2"/>
<epsilon.emf.loadModel name="ModelExpected1"
modelfile="models/model_expected_1.model"
metamodeluri="myMetamodelUri"
read="true" store="false" />
<epsilon.emf.loadModel name="ModelExpected2"
modelfile="models/model_expected_2.model"
metamodeluri="myMetamodelUri"
read="true" store="false" />
<epsilon.eunit src="tests/atl.eunit" report="yes">
<model ref="MyModel1"/>
<model ref="MyModel2"/>
<model ref="Model1"/>
<model ref="Model2"/>
<model ref="ModelExpected1"/>
<model ref="ModelExpected2"/>
</epsilon.eunit>
</target>
<target name="init-atl">
<atl.loadModel name="MMsysml" metamodel="MOF" uri="sysMLUri" />
<atl.loadModel name="MMModel" metamodel="MOF" uri="myMetamodelUri" />
<macrodef name="runATL">
<attribute name="srcfile"/>
<attribute name="srcmodel"/>
<attribute name="dstmodel"/>
<sequential>
<epsilon.emf.loadModel name="@{srcmodel}"
modelfile="@{srcfile}"
metamodeluri="myMetamodelUri"
read="true" store="false" />
<atl.loadModel name="@{srcmodel}" metamodel="MMsysml" path="@{srcfile}"/>
<atl.launch path="sysml2model.atl">
<inmodel name="INsysml" model="@{srcmodel}" />
<outmodel name="OUT" model="@{dstmodel}" metamodel="MMModel" />
</atl.launch>
<atl.saveModel model="@{dstmodel}" path="@{srcfile}.tmpdst.model" />
<epsilon.emf.loadModel name="@{dstmodel}" modelfile="@{srcfile}.tmpdst.model"
metamodeluri="myMetamodelUri" read="true" store="false" />
<delete file="@{srcfile}.tmpdst.model"/>
</sequential>
</macrodef>
</target>
</project>
With that, you'd avoid quite a bit of repetition, and your .eunit file could be shortened to:
$with Map {"Expected" = "ModelExpected1", "Obtained" = "Model1" }
$with Map {"Expected" = "ModelExpected2", "Obtained" = "Model2" }
@test
operation test1() {
assertEqualModels("Expected", "Obtained");
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.04272 seconds