Closed Bug 960438 Opened 10 years ago Closed 6 years ago

BaseMarionetteTestRunner should be able to have some customizable setup code

Categories

(Remote Protocol :: Marionette, defect, P3)

x86
All
defect

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: mdas, Assigned: mdas)

Details

(Keywords: pi-marionette-runner, Whiteboard: [affects=mtbf])

Before we run a test suite, we want to be able to run some setup code, say before run gets called here: http://mxr.mozilla.org/mozilla-central/source/testing/marionette/client/marionette/runner/base.py#249

Not sure if unittest has built in support for this, or if we'll need to add this functionality
Whiteboard: [runner]
unittest provides https://docs.python.org/2/library/unittest.html#setupclass-and-teardownclass and https://docs.python.org/2/library/unittest.html#setupmodule-and-teardownmodule

Since gaia-ui-test is NOT organized in classes, for example:

class TestMusic():
  def testMusic1(self): //test case #1
   ...
  def testMusic2(self): //test case #2
   ...

setUpClass and tearDownClass will be the same as setUp and tearDown
(In reply to Paul Yang [: pyang] from comment #1)
> unittest provides
> https://docs.python.org/2/library/unittest.html#setupclass-and-teardownclass
> and
> https://docs.python.org/2/library/unittest.html#setupmodule-and-
> teardownmodule
> 
> Since gaia-ui-test is NOT organized in classes, for example:
> 
> class TestMusic():
>   def testMusic1(self): //test case #1
>    ...
>   def testMusic2(self): //test case #2
>    ...
> 
> setUpClass and tearDownClass will be the same as setUp and tearDown

Ah, what we're looking for here is different. What you suggest is good for running something before each test class, but this particular bug is to help us get customizable code running before any tests are run.

So, pointing to a more recent base.py, it's something we want to add here:
https://mxr.mozilla.org/mozilla-central/source/testing/marionette/client/marionette/runner/base.py?rev=9347f1e2551a#1003
Whiteboard: [runner] → [affects=mtbf]
I'm not saying we should have something run before class, but it's sort of solution if we arrange test cases which have the same pre-condition in the same class, and 0 line needed to be added.

Since our test cases are suite based, agree that we can add handler there.
[mass update] Setting Harness bugs to all P3
Priority: -- → P3
I don’t think we should put any more effort into Mn harness features.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.