Closed Bug 802227 Opened 11 years ago Closed 11 years ago

Add --testvars argument to Marionette

Categories

(Remote Protocol :: Marionette, defect)

defect
Not set
normal

Tracking

(firefox18 fixed, firefox19 fixed)

RESOLVED FIXED
mozilla19
Tracking Status
firefox18 --- fixed
firefox19 --- fixed

People

(Reporter: jgriffin, Assigned: automatedtester)

References

Details

Attachments

(2 files)

Zac needs a way to pass private information into a test, that should not be hardcoded in a test, such as the marketplace credentials.

We could add a --testvars argument that would point to a Python or JSON file containing a dict with values that we'd make available to tests, e.g.,

--testvars mypassword.py contains

test_vars = {
  'user': 'joe',
  'password': 'foobar'
}

A test might use these then like:

def test_something(self):
    element = # find some element
    element.send_keys(self.test_vars['user'])
Assignee: nobody → dburns
Adding in the ability to run tests with --testvars that takes a JSON file. Chose JSON since that way they will be able to manipulate the data as they want and just work with a dictionary to get the data out.
Attachment #673264 - Flags: review?(jgriffin)
Comment on attachment 673264 [details] [diff] [review]
adding in test vars

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

Looks good!  Can you also bump the version in setup.py to 0.5, and then after landing this, mirror it to github, and then post the package to pypi?  I'll need to set you as an owner of the pypi package, so msg me your pypi username.

::: testing/marionette/client/marionette/runtests.py
@@ +202,5 @@
> +
> +        if testvars is not None:
> +            if not os.path.exists(testvars):
> +                raise Exception('--testvars file does not exist')
> +            

Can you remove the extra whitespace at the beginning of this line?
Attachment #673264 - Flags: review?(jgriffin) → review+
uploaded to pypi
.
.
.
Writing marionette_client-0.5/setup.cfg
creating dist
Creating tar archive
removing 'marionette_client-0.5' (and everything under it)
running upload
Submitting dist/marionette_client-0.5.tar.gz to http://pypi.python.org/pypi
Server response (200): OK
https://hg.mozilla.org/mozilla-central/rev/be7c882f0f85
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
Attached file B2G Marionette Broken
Did you forget to fix MarionetteJSTestCase or something?
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
patch for this is on bug 803850
patch in bug 803850 has landed and merged to m-c, closing
Status: REOPENED → RESOLVED
Closed: 11 years ago11 years ago
Resolution: --- → FIXED
IMO JSON is not a good choice for this because it's very sensitive to syntax and you can't put comments into it.
But it does work, thanks
Whiteboard: [automation-needed-in-aurora]
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.