Closed Bug 868375 Opened 13 years ago Closed 13 years ago

Change the assertions.js module so that Assert is the base class instead of Expect

Categories

(Testing Graveyard :: Mozmill, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: daniela.p98911, Assigned: daniela.p98911)

References

Details

(Whiteboard: [mozmill-2.0][ateamtrack: p=mozmill q=2013q2 m=4])

Attachments

(2 files, 4 obsolete files)

This is based on bug 791634 comment #6. The Assert class in assertions.js module has to be the base one so that we can move the code from utils.waitFor to the assertions module. Also, if Assert is the base class, in Expect we will catch the assertions exceptions.
Whiteboard: [mozmill-2.0?]
As said, we should do this first for our assertion module in mozmill-tests to verify it works as expected.
Whiteboard: [mozmill-2.0?] → [mozmill-2.0?][sprint2013-32]
Assignee: nobody → andreea.matei
Status: NEW → ASSIGNED
Assignee: andreea.matei → nobody
Status: ASSIGNED → NEW
Whiteboard: [mozmill-2.0?][sprint2013-32] → [mozmill-2.0?]
No longer depends on: 868371
Depends on: 868371
Comment on attachment 763524 [details] [diff] [review] patch v1.0 Review of attachment 763524 [details] [diff] [review]: ----------------------------------------------------------------- Looks nearly ok, just a missed line. ::: mozmill/mozmill/extension/resource/modules/assertions.js @@ -537,5 @@ > -var Assert = function () {} > - > -Assert.prototype = new Expect(); > - > -Assert.prototype.AssertionError = AssertionError; Where did this line went to? We still need the object attached to the Assert class.
Attachment #763524 - Flags: review?(hskupin) → review-
Attached patch patch v1.1 (obsolete) — — Splinter Review
Attachment #763524 - Attachment is obsolete: true
Attachment #764050 - Flags: review?(hskupin)
Comment on attachment 764050 [details] [diff] [review] patch v1.1 Review of attachment 764050 [details] [diff] [review]: ----------------------------------------------------------------- ::: mozmill/mozmill/extension/resource/modules/assertions.js @@ +571,1 @@ > Assert.prototype.AssertionError = AssertionError; Please put this directly into the prototype definition of the Assert class. If AssertionError needs to be moved up before any other class, I would even support that for clarity.
Attachment #764050 - Flags: review?(hskupin) → review-
Attached patch patch v1.2 (obsolete) — — Splinter Review
Modified patch based on review. Reports are below. I will also attach the log file with console output for checking the assert.AssertionError works the same now. Linux: http://mozmill-crowd.blargon7.com/#/functional/report/f2d3b6136b11cb7b6708636cffdc3eb2 MAC: http://mozmill-crowd.blargon7.com/#/functional/report/f2d3b6136b11cb7b6708636cffdcde03
Attachment #764050 - Attachment is obsolete: true
Attachment #764720 - Flags: review?(hskupin)
This is a log file where I have dumped assert.AssertionError (before and after the change) and also modified controller/contextmenu.js mutt test to fail to compare if it works the same in both cases
(In reply to Daniela Petrovici from comment #7) > This is a log file where I have dumped assert.AssertionError (before and > after the change) and also modified controller/contextmenu.js mutt test to > fail to compare if it works the same in both cases This is not what you want to test. What you really want is to catch such an exception and check that it's of type assert.AssertionError.
Comment on attachment 764720 [details] [diff] [review] patch v1.2 Testing now based on the previous comment
Attachment #764720 - Flags: review?(hskupin)
Attached patch patch v1.3 (obsolete) — — Splinter Review
(In reply to Henrik Skupin (:whimboo) from comment #8) > This is not what you want to test. What you really want is to catch such an > exception and check that it's of type assert.AssertionError. I used try-catch and caught an error from assert.equal and dumped ex instanceof assert.AssertionError. It shows true. I also tried dumping the constructor.name for the exception and this change did not affect anything. Also, the mutt tests are still working properly, including the mutt test for assertions
Attachment #764720 - Attachment is obsolete: true
Attachment #764737 - Flags: review?(hskupin)
Comment on attachment 764737 [details] [diff] [review] patch v1.3 Review of attachment 764737 [details] [diff] [review]: ----------------------------------------------------------------- One last thing to do, then we should be good in getting this landed. ::: mozmill/mozmill/extension/resource/modules/assertions.js @@ +251,5 @@ > > /** > + * Error object thrown by the Assert class > + */ > + AssertionError: AssertionError, This is an attribute on the prototype, so it should be located before any getters, setter, and methods.
Attachment #764737 - Flags: review?(hskupin) → review-
Attached patch patch v1.4 — — Splinter Review
Modified patch based on review
Attachment #764737 - Attachment is obsolete: true
Attachment #765855 - Flags: review?(hskupin)
Attachment #765855 - Flags: review?(hskupin) → review+
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: [mozmill-2.0?] → [mozmill-2.0][ateamtrack: p=mozmill q=2013q2 m=4]
Product: Testing → Testing Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: