Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Ecore Tools » JUnit test cases for ecore models(How to write own test cases for ecore models)
JUnit test cases for ecore models [message #1773937] Fri, 06 October 2017 17:36 Go to next message
Manoj Keshavaprakash is currently offline Manoj KeshavaprakashFriend
Messages: 3
Registered: October 2017
Junior Member
hi All,

I am Manoj Keshavaprakash. I am new to model based development, I have created a small ecore metamodel(class diagram) using the graphical editor. Now I want to run some custom test cases to change the attribute values of the model. I tried using the .genmodel to create the automated test. But these test are not very helpful for me.

I request in this forum to guide to write my own test case to change the values of my attributes.

I have attached a file with the description of the problem for your reference.

Regards,
Manoj
Re: JUnit test cases for ecore models [message #1774362 is a reply to message #1773937] Fri, 13 October 2017 09:53 Go to previous messageGo to next message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 427
Registered: July 2009
Senior Member
You have to change the value through the Java API, either the generated one (if you generated the code from the genmodel) then you should have a "setNoOfSeat(int i)" in the "Booking" Java class, or reflectively by getting the EObject instance and then calling the .eSet().

From your question it looks like you are quite new to the EMF technology, you might find the following tutorials interesting:
http://www.vogella.com/tutorials/EclipseEMF/article.html
https://eclipsesource.com/blogs/tutorials/emf-tutorial/


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Re: JUnit test cases for ecore models [message #1774459 is a reply to message #1774362] Sun, 15 October 2017 11:26 Go to previous message
Manoj Keshavaprakash is currently offline Manoj KeshavaprakashFriend
Messages: 3
Registered: October 2017
Junior Member
Thank you for your clarification. Now am able to get things working. But now I have a small question:

I have a metamodel (.ecore file (class diagram)) created using the graphical editor. Now I am able to create the dynamic instances programmatically, but in my metamodel I have a composition (Containment reference) wherein i want to create child instance of the contained class (programmatically). Please find the attached metamodel and related images for reference.
  • Attachment: Reference.pdf
    (Size: 370.69KB, Downloaded 30 times)
Previous Topic:Availability Viewpoint in Sirius
Goto Forum:
  


Current Time: Mon Apr 23 02:28:54 GMT 2018

Powered by FUDForum. Page generated in 0.02185 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software