Closed eclipse-ocl-bot closed 1 month ago
By Ed Willink on Nov 29, 2009 02:42
Created attachment 153306 (attachment deleted)\
Shared KeywordsTests
By Ed Willink on Dec 05, 2009 03:01
Created attachment 153859 Shared IteratorsTest too
Attached makes the IteratorsTest shared too. (This is a precursor to adding more tests for bad iterator names etc that the changed grammar could allow).
This required introducing a %xxx denormaliziation in OCL expressions so that e.g. %Reference is EReference for Ecore and Property for UML. Using this denomalization allowed many getXxxName methods to be removed from the TestReflection interface.
There is now a suite of assertXXX methods for all sorts of invariant and parser checks. This halves the line count in tests and makes them much more readable.
Error messages for parser failures are now validated for content rather than existence. This detected Bug 296990.
:notepad_spiral: Bug296409.patch
By Ed Willink on Dec 11, 2009 01:16
Ping.
The original attachment has not been reviewed after 12 days, so my further contribution that supplanted it and has not been reviewed after 6 days. I had to include a replacement for one file as part of 297541 yesterday since the file that needed patching was not available.
Laurent, if you plan to contribute any new/revised test code, you will find it very helpful to see how this contribution supports shared Ecore/UML2 functionality, and how the inherited 'tools' halve the line count making tests much more readable.
By Laurent Goubet on Dec 11, 2009 05:38
Sorry for the delay on the reviewing of this ... it's been lying on my TODO list for a while. Took some time to look at the patch today; looks good to me, I'd just like to mention trivial things :
a) EcoreTestReflection#normalizers : I'd like this field not to be hidden within methods of the class; could it be moved before \ EcoreTestReflection#createOCL() ?
b) I must admit I find some things confusing at least. Let's take IteratorsTest#test_sortedByRequiresComparability_192729() as an example :
public void test_sortedByRequiresComparability_192729() {\ EClassifier context = getMetaclass(denormalize("%Package"));\ super.test_sortedByRequiresComparability_192729();\ \ // EDate defines '<' by having a Comparable instance class\ assertQuery(context, "let dates : Sequence(%Date) = Sequence{} in dates->sortedBy(e | e)");\ }
the call to "super" should come before retrieving the Package classifier. This order makes me believe it has a sense to retrieve it before calling super. The comment doesn't make any sense to me either.
c) GenericTestSuite#createOrderedSet() (same will be true for createSet and createSequence) : you should use CollectionUtil.createNewOrderedSet(). This will make the "create*" coherent with createBag and reduce duplication of code, reducing the number of methods to alter if we ever change the implementation of OrderedSet (LinkedHashSet).
By Ed Willink on Dec 16, 2009 16:27
Committed to CVS HEAD.
a) EcoreTestReflection#createOCL() is static. I prefer to keep all statics above non-statics.
b) Done. Order is indeed confusing.
c) Done.
By Laurent Goubet on Dec 17, 2009 02:55
Ed,
Ok, I understand now for a). I simply am not familiar with this way of coding ^^.
By Ed Willink on May 27, 2011 02:49
Closing after over 18 months in resolved state.
| --- | --- | | Bugzilla Link | 296409 | | Status | CLOSED FIXED | | Importance | P3 normal | | Reported | Nov 29, 2009 02:23 EDT | | Modified | May 27, 2011 02:49 EDT | | Version | 3.0.0 | | Reporter | Ed Willink |
Description
Attachment to follow demonstrates:
Use of helper functions to make tests more readable.\ Sharing of a GenericKeywordsTest by Ecore and UML.\ Use of the extended TestReflection to suppoort generic operation.\ Extension by UML with UML-specific tests.