Junit eunit example - test with resource models [message #1838938] |
Tue, 09 March 2021 21:53 |
Kieran Thompson Messages: 7 Registered: January 2021 |
Junior Member |
|
|
Hello,
I am currently working on top of a version the junit eunit example, from the repo. I wondering the best way to test models that have been imported in. The models in the resources folder being used in the eunit. How can these be called in the eunit file so they can be compared/altered?
edit: My understanding is the base example runs a tranformation on a model and then compares with an expected model. Please correct me if I am incorrect in thinking this.
Kind regards
Kieran
[Updated on: Wed, 10 March 2021 01:45] Report message to a moderator
|
|
|
Re: Junit eunit example - test with resource models [message #1838950 is a reply to message #1838938] |
Wed, 10 March 2021 09:00 |
|
Yes, the eunit.junit example runs an ETL transformation and then makes some checks on the resulting model. In fact, it uses the assertEqualModels assertion to compare that the models are equal according to EMF Compare. In order to make these models available to the assertEqualModels assertion, they have to be loaded into the model repository. While there is a resources/models/graph-expected.model file in the example, this file is not really used: the current version of the example just has GraphExpected start empty, and populates the expected contents right in the test to save time.
You could modify the prepareModels method in JUnitIntegrationExampleSuite to have it load a different set of models and have them really load their contents from the files, and then you could use assertEqualModels to check that the transformation results match those loaded models.
Hope that clarifies things - let me know if you have more questions!
|
|
|
|
|
|
|
Re: Junit eunit example - test with resource models [message #1839722 is a reply to message #1839566] |
Fri, 26 March 2021 13:50 |
|
I'm not sure I understand the issue. Could you post a minimal working example that reproduces your problem?
assertEqualModels just takes the names of two models in your model repository - it does not matter whether you use literal strings, variables, or other expressions to compute those names.
|
|
|
Powered by
FUDForum. Page generated in 0.04616 seconds