Closed Bug 1101039 Opened 10 years ago Closed 10 years ago

Add line numbers to assertions

Categories

(Testing :: Mochitest, defect)

defect
Not set
normal

Tracking

(firefox42 fixed)

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: martijn.martijn, Assigned: hiro)

References

Details

Attachments

(2 files, 2 obsolete files)

Attached patch poc patchSplinter Review
From bug 744387, comment 5: " maybe we can add a line number into the output to make assertions clearer? (I've wanted that even for assertions with a message, it's not always clear which one they are.) " The poc patch does something like that.
Attached patch A simple solution (obsolete) — Splinter Review
This patch outputs stack traces on console if assertion fails like this: 3446 INFO TEST-UNEXPECTED-FAIL | dom/tests/mochitest/general/test_resource_timing.html | Performance.getEntries() returned wrong number of entries. - got 4, expected 5 SimpleTest.is@tests/SimpleTest/SimpleTest.js:286:5 is@tests/dom/tests/mochitest/general/resource_timing_main_test.html:59:3 window.onload@tests/dom/tests/mochitest/general/resource_timing_main_test.html:80:1 3447 INFO TEST-UNEXPECTED-FAIL | dom/tests/mochitest/general/test_resource_timing.html | Performance.getEntriesByName() should return some results ok@tests/dom/tests/mochitest/general/resource_timing_main_test.html:55:3 window.onload@tests/dom/tests/mochitest/general/resource_timing_main_test.html:86:1 3448 INFO TEST-UNEXPECTED-FAIL | dom/tests/mochitest/general/test_resource_timing.html | An entry with the name 'http://mochi.test:8888/tests/image/test/mochitest/blue.png' should be available ok@tests/dom/tests/mochitest/general/resource_timing_main_test.html:55:3 checkEntries@tests/dom/tests/mochitest/general/resource_timing_main_test.html:196:1 window.onload@tests/dom/tests/mochitest/general/resource_timing_main_test.html:106:1 Not prettified yet but OK in my use-case.
Attachment #8598457 - Flags: feedback?(ted)
Attachment #8598457 - Flags: feedback?(martijn.martijn)
Attachment #8598457 - Flags: feedback?(jaws)
Assignee: nobody → hiikezoe
Comment on attachment 8598457 [details] [diff] [review] A simple solution Review of attachment 8598457 [details] [diff] [review]: ----------------------------------------------------------------- Looks great to me. Perhaps you could indent the lines that contain the stack? That makes it a little clearer.
Attachment #8598457 - Flags: feedback?(martijn.martijn) → feedback+
Comment on attachment 8598457 [details] [diff] [review] A simple solution Review of attachment 8598457 [details] [diff] [review]: ----------------------------------------------------------------- Looks fine to me, but I'm not in a position to really give an authoritative review of it.
Attachment #8598457 - Flags: feedback?(jaws) → feedback+
:mwargers, :jaws, thank you for your feedbacks! This patch adds 4 spaces to indent each line. A example of the output: Expected PASS, got FAIL didn't expect 1, but got it SimpleTest.isnot@SimpleTest/SimpleTest.js:299:5 isnot@dom/tests/mochitest/general/resource_timing_main_test.html:63:3 secondCheck@dom/tests/mochitest/general/resource_timing_main_test.html:222:1 https://treeherder.mozilla.org/#/jobs?repo=try&revision=fb44ad6cbe6d
Attachment #8598457 - Attachment is obsolete: true
Attachment #8598457 - Flags: feedback?(ted)
Attachment #8600247 - Flags: review?(ted)
Attachment #8600247 - Flags: review?(ted) → review+
Sorry for the long review delay!
Unrotted. Thanks!
Attachment #8600247 - Attachment is obsolete: true
Attachment #8634417 - Flags: review+
Keywords: checkin-needed
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: