Closed Bug 879683 Opened 6 years ago Closed 6 years ago

Allow MarionetteTestResult and MarionetteTextTestRunner to be subclassed

Categories

(Testing :: Marionette, defect)

x86
macOS
defect
Not set

Tracking

(firefox22 wontfix, firefox23 wontfix, firefox24 fixed, b2g18 fixed, b2g18-v1.0.0 wontfix, b2g18-v1.0.1 wontfix, b2g-v1.1hd fixed)

RESOLVED FIXED
mozilla24
Tracking Status
firefox22 --- wontfix
firefox23 --- wontfix
firefox24 --- fixed
b2g18 --- fixed
b2g18-v1.0.0 --- wontfix
b2g18-v1.0.1 --- wontfix
b2g-v1.1hd --- fixed

People

(Reporter: davehunt, Assigned: davehunt)

Details

Attachments

(1 file, 1 obsolete file)

We would like to gather additional debug for reporting in gaiatest, which would require subclassing MarionetteTestResult and MarionetteTextTestRunner.
This is working for me, but I'm requesting feedback in case there's a better approach. I have also allowed for errors to contain more than just two items in the tuple. Any additional items will be added by the subclass for reporting.
Attachment #758459 - Flags: feedback?(jgriffin)
Comment on attachment 758459 [details] [diff] [review]
Allow MarionetteTestResult and MarionetteTextTestRunner to be subclassed

Review of attachment 758459 [details] [diff] [review]:
-----------------------------------------------------------------

::: testing/marionette/client/marionette/runtests.py
@@ +70,5 @@
>                  self.stream.writeln('END LOG:')
>  
>      def printErrorList(self, flavour, errors):
> +        for error in errors:
> +            test, err = error[:2]

This will be fragile if we ever get inheritance chains, but for now I think it's ok.

Ideally, we'd want to integrate moztest into Marionette and use its TestResult, but that's a much bigger job.  I'll file a separate bug for that and see if I can find someone to work on it.

@@ +206,5 @@
>          self.type = type
>          self.device = device
>          self.symbols_path = symbols_path
>          self.timeout = timeout
> +        self.textrunnerclass = MarionetteTextTestRunner

Probably better to set textrunnerclass = MarionetteTextTestRunner as a class variable (like we do here:  http://mxr.mozilla.org/mozilla-central/source/testing/marionette/client/marionette/runtests.py#95), so you don't have to reset it in a subclass after calling the super's __init__.
Attachment #758459 - Flags: feedback?(jgriffin) → feedback+
Comment on attachment 762705 [details] [diff] [review]
Allow MarionetteTestResult and MarionetteTextTestRunner to be subclassed. v1.1

Review of attachment 762705 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks!
Attachment #762705 - Flags: review?(jgriffin) → review+
https://hg.mozilla.org/mozilla-central/rev/1f7059b5a6c6
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.