Home » Modeling » EMF » Generated tests from EMF
Generated tests from EMF [message #662581] |
Thu, 31 March 2011 08:35 |
|
Hi,
We can generated unit tests for our EMF model. When i look at these tests most of them are empty blocks.
What is the real purpose of these tests ?
Have someone used these generated tests ? Can you share your experience by this feature ?
Regards,
Ashwani Kr Sharma
|
|
| |
Re: Generated tests from EMF [message #663060 is a reply to message #662703] |
Sat, 02 April 2011 21:32 |
Alain Picard Messages: 266 Registered: July 2009 |
Senior Member |
|
|
Ed,
Why is then that all generated test end up with:
// TODO: implement this operation test method
// Ensure that you remove @generated or mark it @generated NOT
fail();
which by default causes hundreds of failures. What we would want is the
for the default to do nothing, just put a TODO and we can implement only
the tests we care about and still get the scaffolding generated.
Or am I missing something obvious?
Cheers,
Alain
On 3/31/2011 11:43 AM, Ed Merks wrote:
> Ashwani,
>
> Comments below.
>
> Ashwani Kr Sharma wrote:
>> Hi,
>>
>> We can generated unit tests for our EMF model. When i look at these
>> tests most of them are empty blocks.
>> What is the real purpose of these tests ?
> They're scaffolding in which you can write meaningful tests.
>> Have someone used these generated tests ? Can you share your
>> experience by this feature ?
> The UML2 project has used them. So you might look at their source.
>
> Think about it though... If you have a well formed model, EMF always
> generated a correct implementation of it. There's really nothing to
> test. If there were tests that failed, we'd have to fix the generator so
> they didn't. The only things that need testing is the code that you add
> yourself to the generated classes. As you add such code, you should
> write the tests to validate and confirm correct expected behavior.
>>
>> Regards,
>> Ashwani Kr Sharma
|
|
|
Re: Generated tests from EMF [message #663061 is a reply to message #663060] |
Sat, 02 April 2011 23:19 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Alain,
Presumably all operations do something meaningful/useful that's worth
testing. That's the assumption we're making...
Alain Picard wrote:
> Ed,
>
> Why is then that all generated test end up with:
> // TODO: implement this operation test method
> // Ensure that you remove @generated or mark it @generated NOT
> fail();
>
> which by default causes hundreds of failures. What we would want is
> the for the default to do nothing, just put a TODO and we can
> implement only the tests we care about and still get the scaffolding
> generated.
>
> Or am I missing something obvious?
>
> Cheers,
> Alain
>
> On 3/31/2011 11:43 AM, Ed Merks wrote:
>> Ashwani,
>>
>> Comments below.
>>
>> Ashwani Kr Sharma wrote:
>>> Hi,
>>>
>>> We can generated unit tests for our EMF model. When i look at these
>>> tests most of them are empty blocks.
>>> What is the real purpose of these tests ?
>> They're scaffolding in which you can write meaningful tests.
>>> Have someone used these generated tests ? Can you share your
>>> experience by this feature ?
>> The UML2 project has used them. So you might look at their source.
>>
>> Think about it though... If you have a well formed model, EMF always
>> generated a correct implementation of it. There's really nothing to
>> test. If there were tests that failed, we'd have to fix the generator so
>> they didn't. The only things that need testing is the code that you add
>> yourself to the generated classes. As you add such code, you should
>> write the tests to validate and confirm correct expected behavior.
>>>
>>> Regards,
>>> Ashwani Kr Sharma
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Generated tests from EMF [message #663093 is a reply to message #663061] |
Sun, 03 April 2011 14:20 |
Alain Picard Messages: 266 Registered: July 2009 |
Senior Member |
|
|
Why not just like the unimplemented method, throw a
NotImplementedException(), the difference would be clearer.
Alain
On 4/2/2011 7:19 PM, Ed Merks wrote:
> Alain,
>
> Presumably all operations do something meaningful/useful that's worth
> testing. That's the assumption we're making...
>
>
> Alain Picard wrote:
>> Ed,
>>
>> Why is then that all generated test end up with:
>> // TODO: implement this operation test method
>> // Ensure that you remove @generated or mark it @generated NOT
>> fail();
>>
>> which by default causes hundreds of failures. What we would want is
>> the for the default to do nothing, just put a TODO and we can
>> implement only the tests we care about and still get the scaffolding
>> generated.
>>
>> Or am I missing something obvious?
>>
>> Cheers,
>> Alain
>>
>> On 3/31/2011 11:43 AM, Ed Merks wrote:
>>> Ashwani,
>>>
>>> Comments below.
>>>
>>> Ashwani Kr Sharma wrote:
>>>> Hi,
>>>>
>>>> We can generated unit tests for our EMF model. When i look at these
>>>> tests most of them are empty blocks.
>>>> What is the real purpose of these tests ?
>>> They're scaffolding in which you can write meaningful tests.
>>>> Have someone used these generated tests ? Can you share your
>>>> experience by this feature ?
>>> The UML2 project has used them. So you might look at their source.
>>>
>>> Think about it though... If you have a well formed model, EMF always
>>> generated a correct implementation of it. There's really nothing to
>>> test. If there were tests that failed, we'd have to fix the generator so
>>> they didn't. The only things that need testing is the code that you add
>>> yourself to the generated classes. As you add such code, you should
>>> write the tests to validate and confirm correct expected behavior.
>>>>
>>>> Regards,
>>>> Ashwani Kr Sharma
>>
|
|
|
Re: Generated tests from EMF [message #663094 is a reply to message #663093] |
Sun, 03 April 2011 14:24 |
Alain Picard Messages: 266 Registered: July 2009 |
Senior Member |
|
|
Sorry, meant: UnsupportedOperationException()
Alain
On 4/3/2011 10:20 AM, Alain Picard wrote:
> Why not just like the unimplemented method, throw a
> NotImplementedException(), the difference would be clearer.
>
> Alain
>
> On 4/2/2011 7:19 PM, Ed Merks wrote:
>> Alain,
>>
>> Presumably all operations do something meaningful/useful that's worth
>> testing. That's the assumption we're making...
>>
>>
>> Alain Picard wrote:
>>> Ed,
>>>
>>> Why is then that all generated test end up with:
>>> // TODO: implement this operation test method
>>> // Ensure that you remove @generated or mark it @generated NOT
>>> fail();
>>>
>>> which by default causes hundreds of failures. What we would want is
>>> the for the default to do nothing, just put a TODO and we can
>>> implement only the tests we care about and still get the scaffolding
>>> generated.
>>>
>>> Or am I missing something obvious?
>>>
>>> Cheers,
>>> Alain
>>>
>>> On 3/31/2011 11:43 AM, Ed Merks wrote:
>>>> Ashwani,
>>>>
>>>> Comments below.
>>>>
>>>> Ashwani Kr Sharma wrote:
>>>>> Hi,
>>>>>
>>>>> We can generated unit tests for our EMF model. When i look at these
>>>>> tests most of them are empty blocks.
>>>>> What is the real purpose of these tests ?
>>>> They're scaffolding in which you can write meaningful tests.
>>>>> Have someone used these generated tests ? Can you share your
>>>>> experience by this feature ?
>>>> The UML2 project has used them. So you might look at their source.
>>>>
>>>> Think about it though... If you have a well formed model, EMF always
>>>> generated a correct implementation of it. There's really nothing to
>>>> test. If there were tests that failed, we'd have to fix the
>>>> generator so
>>>> they didn't. The only things that need testing is the code that you add
>>>> yourself to the generated classes. As you add such code, you should
>>>> write the tests to validate and confirm correct expected behavior.
>>>>>
>>>>> Regards,
>>>>> Ashwani Kr Sharma
>>>
>
|
|
|
Re: Generated tests from EMF [message #663105 is a reply to message #663093] |
Sun, 03 April 2011 16:36 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Alain,
Wouldn't that just produce a different kind of failure? It's not
obvious to me why that kind of failure would be better or more clear.
Certainly a TODO automatically produces markers that are designed to
call attention to things that need to be done...
Alain Picard wrote:
> Why not just like the unimplemented method, throw a
> NotImplementedException(), the difference would be clearer.
>
> Alain
>
> On 4/2/2011 7:19 PM, Ed Merks wrote:
>> Alain,
>>
>> Presumably all operations do something meaningful/useful that's worth
>> testing. That's the assumption we're making...
>>
>>
>> Alain Picard wrote:
>>> Ed,
>>>
>>> Why is then that all generated test end up with:
>>> // TODO: implement this operation test method
>>> // Ensure that you remove @generated or mark it @generated NOT
>>> fail();
>>>
>>> which by default causes hundreds of failures. What we would want is
>>> the for the default to do nothing, just put a TODO and we can
>>> implement only the tests we care about and still get the scaffolding
>>> generated.
>>>
>>> Or am I missing something obvious?
>>>
>>> Cheers,
>>> Alain
>>>
>>> On 3/31/2011 11:43 AM, Ed Merks wrote:
>>>> Ashwani,
>>>>
>>>> Comments below.
>>>>
>>>> Ashwani Kr Sharma wrote:
>>>>> Hi,
>>>>>
>>>>> We can generated unit tests for our EMF model. When i look at these
>>>>> tests most of them are empty blocks.
>>>>> What is the real purpose of these tests ?
>>>> They're scaffolding in which you can write meaningful tests.
>>>>> Have someone used these generated tests ? Can you share your
>>>>> experience by this feature ?
>>>> The UML2 project has used them. So you might look at their source.
>>>>
>>>> Think about it though... If you have a well formed model, EMF always
>>>> generated a correct implementation of it. There's really nothing to
>>>> test. If there were tests that failed, we'd have to fix the
>>>> generator so
>>>> they didn't. The only things that need testing is the code that you
>>>> add
>>>> yourself to the generated classes. As you add such code, you should
>>>> write the tests to validate and confirm correct expected behavior.
>>>>>
>>>>> Regards,
>>>>> Ashwani Kr Sharma
>>>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Generated tests from EMF [message #663135 is a reply to message #663105] |
Mon, 04 April 2011 00:03 |
Alain Picard Messages: 266 Registered: July 2009 |
Senior Member |
|
|
IMHO it would make it a bit easier to discern what is a test failure vs.
a non implementation.
Alain
On 4/3/2011 12:36 PM, Ed Merks wrote:
> Alain,
>
> Wouldn't that just produce a different kind of failure? It's not obvious
> to me why that kind of failure would be better or more clear. Certainly
> a TODO automatically produces markers that are designed to call
> attention to things that need to be done...
>
>
> Alain Picard wrote:
>> Why not just like the unimplemented method, throw a
>> NotImplementedException(), the difference would be clearer.
>>
>> Alain
>>
>> On 4/2/2011 7:19 PM, Ed Merks wrote:
>>> Alain,
>>>
>>> Presumably all operations do something meaningful/useful that's worth
>>> testing. That's the assumption we're making...
>>>
>>>
>>> Alain Picard wrote:
>>>> Ed,
>>>>
>>>> Why is then that all generated test end up with:
>>>> // TODO: implement this operation test method
>>>> // Ensure that you remove @generated or mark it @generated NOT
>>>> fail();
>>>>
>>>> which by default causes hundreds of failures. What we would want is
>>>> the for the default to do nothing, just put a TODO and we can
>>>> implement only the tests we care about and still get the scaffolding
>>>> generated.
>>>>
>>>> Or am I missing something obvious?
>>>>
>>>> Cheers,
>>>> Alain
>>>>
>>>> On 3/31/2011 11:43 AM, Ed Merks wrote:
>>>>> Ashwani,
>>>>>
>>>>> Comments below.
>>>>>
>>>>> Ashwani Kr Sharma wrote:
>>>>>> Hi,
>>>>>>
>>>>>> We can generated unit tests for our EMF model. When i look at these
>>>>>> tests most of them are empty blocks.
>>>>>> What is the real purpose of these tests ?
>>>>> They're scaffolding in which you can write meaningful tests.
>>>>>> Have someone used these generated tests ? Can you share your
>>>>>> experience by this feature ?
>>>>> The UML2 project has used them. So you might look at their source.
>>>>>
>>>>> Think about it though... If you have a well formed model, EMF always
>>>>> generated a correct implementation of it. There's really nothing to
>>>>> test. If there were tests that failed, we'd have to fix the
>>>>> generator so
>>>>> they didn't. The only things that need testing is the code that you
>>>>> add
>>>>> yourself to the generated classes. As you add such code, you should
>>>>> write the tests to validate and confirm correct expected behavior.
>>>>>>
>>>>>> Regards,
>>>>>> Ashwani Kr Sharma
>>>>
>>
|
|
|
Goto Forum:
Current Time: Thu Sep 19 18:55:24 GMT 2024
Powered by FUDForum. Page generated in 0.04538 seconds
|