Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a testng configuration for unit and integration tests #1

Closed
flefevre opened this issue Jan 13, 2016 · 15 comments

Comments

@flefevre
Copy link

commented Jan 13, 2016

Dear Calvin,
great job here !
thanks a lot for this usefull example.

I am trying to add a testng test configuration for unit and integration tests to be sure that the project do not diverge.
I am facing the problem for unit test

<<
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) @ qvto-app ---


T E S T S

Running TestSuite
Fast test
Failed to execute file:/home/flefevre/gits/qvt-cloud-factory/qvto-app/src/test/resources/qvto4abcmodel/transforms/transformationABC.qvto: Compilation errors found in unit 'file:/home/flefevre/gits/qvt-cloud-factory/qvto-app/src/test/resources/qvto4abcmodel/transforms/transformationABC.qvto'
Failed to resolve metamodel 'http://www.mmsource.fr' (at:1)
Type of transformation parameter should be model type (at:4)
Type of transformation parameter should be model type (at:4)
<<<

and exactly the same for the integration tests

<<
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) @ qvto-app ---
[INFO] Building jar: /home/flefevre/gits/qvt-cloud-factory/qvto-app/target/qvto-app-0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-shade-plugin:2.3:shade (default) @ qvto-app ---
[WARNING] Map in class org.apache.maven.plugins.shade.resource.ManifestResourceTransformer declares value type as: class java.util.jar.Attributes but saw: class java.lang.String at runtime
[INFO] Including at.ac.wu.nm:qvt-bundle:jar:repackaged:4.4 in the shaded jar.
[INFO] Including com.beust:jcommander:jar:1.47 in the shaded jar.
[INFO] Including org.slf4j:slf4j-api:jar:1.6.1 in the shaded jar.
[INFO] Including ch.qos.logback:logback-classic:jar:1.0.13 in the shaded jar.
[INFO] Including ch.qos.logback:logback-core:jar:1.0.13 in the shaded jar.
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing /home/flefevre/gits/qvt-cloud-factory/qvto-app/target/qvto-app-0.1-SNAPSHOT.jar with /home/flefevre/gits/qvt-cloud-factory/qvto-app/target/qvto-app-0.1-SNAPSHOT-shaded.jar
[INFO] Dependency-reduced POM written at: /home/flefevre/gits/qvt-cloud-factory/qvto-app/dependency-reduced-pom.xml
[INFO] Dependency-reduced POM written at: /home/flefevre/gits/qvt-cloud-factory/qvto-app/dependency-reduced-pom.xml
[INFO]
[INFO] --- maven-failsafe-plugin:2.19.1:integration-test (default) @ qvto-app ---


T E S T S

Running TestSuite
Fast test
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/home/flefevre/gits/qvt-cloud-factory/qvto-app/target/qvto-app-0.1-SNAPSHOT.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/home/flefevre/.m2/repository/ch/qos/logback/logback-classic/1.0.13/logback-classic-1.0.13.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
Failed to execute file:/home/flefevre/gits/qvt-cloud-factory/qvto-app/src/test/resources/qvto4abcmodel/transforms/transformationABC.qvto: Compilation errors found in unit 'file:/home/flefevre/gits/qvt-cloud-factory/qvto-app/src/test/resources/qvto4abcmodel/transforms/transformationABC.qvto'
Failed to resolve metamodel 'http://www.mmsource.fr' (at:1)
Type of transformation parameter should be model type (at:4)
Type of transformation parameter should be model type (at:4)

<<

I have added in the qvto pom the following elements

org.testng testng 6.9.8 test

and

org.apache.maven.plugins maven-surefire-plugin 2.19.1 src/test/resources/unitTests/testng.xml org.apache.maven.plugins maven-failsafe-plugin 2.19.1 src/test/resources/integrationTests/testng.xml target/qvto-app-0.1-SNAPSHOT.jar integration-test verify

If I execute the jar file alone it is working... by no way to test it in maven...
java -jar qvto-app-0.1-SNAPSHOT.jar -xform ../src/test/resources/qvto4abcmodel/transforms/transformationABC.qvto -src ../src/test/resources/qvto4abcmodel/modelSource/MMSource.ecore ../src/test/resources/qvto4abcmodel/modelSource/MSource.xmi -tgt ../src/test/resources/qvto4abcmodel/modelSource/MMSource.ecore ../src/test/resources/qvto4abcmodel/modelTarget/my.xmi

Do you have any idea why?

Francois, from Europa

@mrcalvin

This comment has been minimized.

Copy link
Owner

commented Jan 14, 2016

Salut,

Nice to learn that someone out there finds this useful. What is your usage scenario exactly?

As for the reported issue: Can you please provide a reproducible setup for me (testng.xml, annotated code)?

Resource resolution and registry (model files) is a weak spot in the Eclipse-verse, always. I am happy to help out, but I need a point to start.

Stefan (aka mrcalvin) from Vienna

@flefevre

This comment has been minimized.

Copy link
Author

commented Jan 14, 2016

Hello Stefan,
Nice to meet you.

I have fork your repository to push the preliminary configuration for
testng on your project.
#2

if you run mvn clean install, it will execute during test phase a simple
unit test and also an integration test.
Actually the test do no assert, it calls just your App class to set the
parameter to run a qvto transformation.

After the clean install process, you could also test manually your jar with
the following command (extracted from your documentation : nice to have doc
in your project :-) )
Running this command gives you the right out.uml file.

My goal/scenario is to be able to test the application because for
instance, I want to test the migration on eclipse mars.
So I do not want to break any feature, that why I would like to add tests
to catch any failure.

Thanks for your advice.

Francois

flefevre@localhost target]$ java -jar qvto-app-0.1-SNAPSHOT.jar -xform
../src/test/resources/qvto4abcmodel/transforms/transformationABC.qvto -src
../src/test/resources/qvto4abcmodel/modelSource/MMSource.ecore
../src/test/resources/qvto4abcmodel/modelSource/MSource.xmi -tgt
../src/test/resources/qvto4abcmodel/modelSource/MMSource.ecore
../src/test/resources/qvto4abcmodel/modelTarget/my.xmi
[flefevre@localhost target]$ more out.uml

<mmsource:root xmi:version="20131001" xmlns:xmi="
http://www.omg.org/spec/XMI/20131001" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:mmsource="
http://www.mmsource.fr" xsi:schemaLocation="http://www
.mmsource.fr
file:/home/flefevre/gitHubs/qvto-cli/qvto-app/target/../src/test/resources/qvto4abcmodel/modelSource/MMSource.ecore"
xmi:id="_8tG5Ibr2EeW61e2Op4LOHA">



/mmsource:root

On Thu, Jan 14, 2016 at 6:50 AM, mrcalvin notifications@github.com wrote:

Salut,

Nice to learn that someone out there finds this useful. What is your usage
scenario exactly?

As for the reported issue: Can you please provide a reproducible setup for
me (testng.xml, annotated code)?

Resource resolution and registry (model files) is a weak spot in the
Eclipse-verse, always. I am happy to help out, but I need a point to start.

Stefan (aka mrcalvin) from Vienna


Reply to this email directly or view it on GitHub
#1 (comment).

Francois Le Fevre
Management Informatique Innovation Biotechnologies

Paris, France

Avant d'imprimer, pensez à l'environnement

@flefevre

This comment has been minimized.

Copy link
Author

commented Jan 18, 2016

Hello Stefan
did you have time to watch my proposal?
have you any idea how to deal with the bug?

Thanks for your feedback

Francois

On Thu, Jan 14, 2016 at 8:50 PM, Francois Le Fevre flf.mib@gmail.com
wrote:

Hello Stefan,
Nice to meet you.

I have fork your repository to push the preliminary configuration for
testng on your project.
#2

if you run mvn clean install, it will execute during test phase a simple
unit test and also an integration test.
Actually the test do no assert, it calls just your App class to set the
parameter to run a qvto transformation.

After the clean install process, you could also test manually your jar
with the following command (extracted from your documentation : nice to
have doc in your project :-) )
Running this command gives you the right out.uml file.

My goal/scenario is to be able to test the application because for
instance, I want to test the migration on eclipse mars.
So I do not want to break any feature, that why I would like to add tests
to catch any failure.

Thanks for your advice.

Francois

flefevre@localhost target]$ java -jar qvto-app-0.1-SNAPSHOT.jar -xform
../src/test/resources/qvto4abcmodel/transforms/transformationABC.qvto -src
../src/test/resources/qvto4abcmodel/modelSource/MMSource.ecore
../src/test/resources/qvto4abcmodel/modelSource/MSource.xmi -tgt
../src/test/resources/qvto4abcmodel/modelSource/MMSource.ecore
../src/test/resources/qvto4abcmodel/modelTarget/my.xmi
[flefevre@localhost target]$ more out.uml

<mmsource:root xmi:version="20131001" xmlns:xmi="
http://www.omg.org/spec/XMI/20131001" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xmlns:mmsource="
http://www.mmsource.fr" xsi:schemaLocation="http://www
.mmsource.fr
file:/home/flefevre/gitHubs/qvto-cli/qvto-app/target/../src/test/resources/qvto4abcmodel/modelSource/MMSource.ecore"
xmi:id="_8tG5Ibr2EeW61e2Op4LOHA">



/mmsource:root

On Thu, Jan 14, 2016 at 6:50 AM, mrcalvin notifications@github.com
wrote:

Salut,

Nice to learn that someone out there finds this useful. What is your
usage scenario exactly?

As for the reported issue: Can you please provide a reproducible setup
for me (testng.xml, annotated code)?

Resource resolution and registry (model files) is a weak spot in the
Eclipse-verse, always. I am happy to help out, but I need a point to start.

Stefan (aka mrcalvin) from Vienna


Reply to this email directly or view it on GitHub
#1 (comment).

Francois Le Fevre
Management Informatique Innovation Biotechnologies

Paris, France

Avant d'imprimer, pensez à l'environnement

Francois Le Fevre
Management Informatique Innovation Biotechnologies

Paris, France

Avant d'imprimer, pensez à l'environnement

@mrcalvin

This comment has been minimized.

Copy link
Owner

commented Jan 19, 2016

Hi Francois,

did you have time to watch my proposal?
No, I haven't found the time. I am kind of blocked till Thu this week. I
will take a closer look then.

Stefan

@mrcalvin

This comment has been minimized.

Copy link
Owner

commented Jan 28, 2016

Hi Francois,
I took a closer look. For some reason, the testng setup (runner and instrumentation) appears to reset or to empty the EMF Package registry. I need to dive further, bare any knowledge of testng.
Stefan

@flefevre

This comment has been minimized.

Copy link
Author

commented Jan 28, 2016

Stefan
ok, where did you see this?
Have you a trace so I can also investigate.

Francois

On Thu, Jan 28, 2016 at 9:19 AM, mrcalvin notifications@github.com wrote:

Hi Francois,
I took a closer look. For some reason, the testng setup (runner and
instrumentation) appears to reset or to empty the EMF Package registry. I
need to dive further, bare any knowledge of testng.
Stefan


Reply to this email directly or view it on GitHub
#1 (comment).

Francois Le Fevre
Management Informatique Innovation Biotechnologies

Paris, France

Avant d'imprimer, pensez à l'environnement

@mrcalvin

This comment has been minimized.

Copy link
Owner

commented Jan 28, 2016

ok, where did you see this?
Have you a trace so I can also investigate.
No, I started working (mvnDebug) backwards from
https://github.com/eclipse/qvto/blob/b0df200a292d41cb985d15fd3aca79967290eb23/plugins/org.eclipse.m2m.qvt.oml/src/org/eclipse/m2m/internal/qvt/oml/ast/parser/QvtOperationalVisitorCS.java#L3563

But time is up for the moment,
Stefan

@mrcalvin

This comment has been minimized.

Copy link
Owner

commented Jan 28, 2016

I should add that I need to find a way to store or link the Eclipse
plugin sources to the qvt standalone bundle (they are missing from in
there). Otherwise, I cannot step through the QVT sources. And this is
the main road block right now for effective debugging.

Stefan

Stefan
ok, where did you see this?
Have you a trace so I can also investigate.

Francois

On Thu, Jan 28, 2016 at 9:19 AM, mrcalvin notifications@github.com
wrote:

Hi Francois,
I took a closer look. For some reason, the testng setup (runner and
instrumentation) appears to reset or to empty the EMF Package
registry. I
need to dive further, bare any knowledge of testng.
Stefan


Reply to this email directly or view it on GitHub
#1 (comment).

Francois Le Fevre
Management Informatique Innovation Biotechnologies

Paris, France

Avant d'imprimer, pensez à l'environnement


Reply to this email directly or view it on GitHub
#1 (comment).

@mrcalvin

This comment has been minimized.

Copy link
Owner

commented Jan 29, 2016

For the time being, can you run the testng tests from within eclipse, using the testng-eclipse plugin? For one, this might get you going. Besides, this would help triangulate my suspicion.

Stefan

@flefevre

This comment has been minimized.

Copy link
Author

commented Jan 31, 2016

Hello

so I have installed the eclipse testng plugin in eclipse.
I can run it from the test directly or from a tesng.xml file
What ever I do, I get the following error in eclipse:

From the class

[TestNG] Running:
/tmp/testng-eclipse--750181238/testng-customsuite.xml

Fast test
Failed to execute
file:/home/flefevre/gitHubs/qvto-cli/qvto-app/src/test/resources/qvto4abcmodel/transforms/transformationABC.qvto:
Compilation errors found in unit
'file:/home/flefevre/gitHubs/qvto-cli/qvto-app/src/test/resources/qvto4abcmodel/transforms/transformationABC.qvto'
Failed to resolve metamodel 'http://www.mmsource.fr' (at:1)
Type of transformation parameter should be model type (at:4)
Type of transformation parameter should be model type (at:4)
Unknown type (root) (at:10)

Fom the tesng suite

Fast test
Failed to execute
file:/home/flefevre/gitHubs/qvto-cli/qvto-app/src/test/resources/qvto4abcmodel/transforms/transformationABC.qvto:
Compilation errors found in unit
'file:/home/flefevre/gitHubs/qvto-cli/qvto-app/src/test/resources/qvto4abcmodel/transforms/transformationABC.qvto'
Failed to resolve metamodel 'http://www.mmsource.fr' (at:1)
Type of transformation parameter should be model type (at:4)

Type of transformation parameter should be model type (at:4)

I have pushed the files under the fork on github.
I have added a friend in copy.

As we can see the qvt message is simple: it is no able to solve the
metamodel location.
I do precise that running the jar is OK.
The only one problem is to run the test from eclipse, testng or maven phase.
It is quite crucial t ensure the developments are in the good direction.

Perhaps we could ask on the forum qvt linking to the github fork repository?
And have a guidelines from Ed?

Francois

On Fri, Jan 29, 2016 at 2:34 AM, mrcalvin notifications@github.com wrote:

For the time being, can you run the testng tests from within eclipse,
using the testng-eclipse plugin? For one, this might get you going.
Besides, this would help triangulate my suspicion.

Stefan


Reply to this email directly or view it on GitHub
#1 (comment).

Francois Le Fevre
Management Informatique Innovation Biotechnologies

Paris, France

Avant d'imprimer, pensez à l'environnement

@mrcalvin

This comment has been minimized.

Copy link
Owner

commented Feb 12, 2016

Salut,

Check out the testng-example branch, this should get you going for the moment. Beware that this is not a permanent or ideal solution, but it allows you to develop your test suite; till I figure out a more sustainable approach (I have sth. in mind).

Hope it helps,
Stefan

@mrcalvin mrcalvin self-assigned this Feb 13, 2016

@flefevre

This comment has been minimized.

Copy link
Author

commented Feb 15, 2016

Hello
I have checkout the test-branch
I have made a mvn clean install : it works for the test but not for the jar
generation.
I have made a "pull request" in order to integrate the example inside the
branch, you were refering a /tmp folder.
This test files (model qvto) could be added to your repo in order to
provide a full continuous integration from code compialtion ot test,before
deploying.
I have modify the gitgnore and the package of the test

I think you could merge it.
I will look why the jar is not any more produce (the META-INF) seems to be
lacking.

What is your new approach?

Have a good start in your week.

Francois

On Fri, Feb 12, 2016 at 5:36 PM, mrcalvin notifications@github.com wrote:

Salut,

Check out the testng-example
https://github.com/mrcalvin/qvto-cli/tree/testng-example branch, this
should get you going for the moment. Beware that this is not a permanent or
ideal solution, but it allows you to develop your test suite; till I figure
out a more sustainable approach (I have sth. in mind).

Hope it helps,
Stefan


Reply to this email directly or view it on GitHub
#1 (comment).

Francois Le Fevre
Management Informatique Innovation Biotechnologies

Paris, France

Avant d'imprimer, pensez à l'environnement

@mrcalvin

This comment has been minimized.

Copy link
Owner

commented Feb 15, 2016

Hi,

I think you could merge it.
Can I kindly ask you to clean up the pull request? Remove .project,
out.uml, anything which is generated by a test run and not absolutely
needed (Eclipse metadata). Thx!
I will look why the jar is not any more produce (the META-INF) seems to be
lacking.

This is fixed now. Pls. verify.

What is your new approach?
Right now, there is no new approach. I just make sure that
testng/surefire are provided a meaningful classpath. A new approach will
hopefully put an end to the fat jar and provide the eclipse dependencies
as maven artifacts. I am on it.

Stefan

@flefevre

This comment has been minimized.

Copy link
Author

commented Feb 15, 2016

Stefan,
the solution is definitively on the mavenization of other artifacts.

sure no problem to respect the convention of maven and of your projet.
so feel free to make me any code review: my goal is to enhance my level :-)

I have a question due to my miss understanding of github.

I have tried to make the change you asked.
I have forked the project, I have checkout your the branch test-example
Then I have tried to push over my contribution with the correction you
proposed.

Is the status ok for you to a merge or did I make something wrong?
#3

Thanks for your explanation.

Francois

On Mon, Feb 15, 2016 at 8:26 PM, mrcalvin notifications@github.com wrote:

Hi,

I think you could merge it.
Can I kindly ask you to clean up the pull request? Remove .project,
out.uml, anything which is generated by a test run and not absolutely
needed (Eclipse metadata). Thx!
I will look why the jar is not any more produce (the META-INF) seems to
be
lacking.

This is fixed now. Pls. verify.

What is your new approach?
Right now, there is no new approach. I just make sure that
testng/surefire are provided a meaningful classpath. A new approach will
hopefully put an end to the fat jar and provide the eclipse dependencies
as maven artifacts. I am on it.

Stefan


Reply to this email directly or view it on GitHub
#1 (comment).

Francois Le Fevre
Management Informatique Innovation Biotechnologies

Paris, France

Avant d'imprimer, pensez à l'environnement

@mrcalvin

This comment has been minimized.

Copy link
Owner

commented Jul 20, 2018

flefevre's additions are preserved in the testng-example branch.

@mrcalvin mrcalvin closed this Jul 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.