Thursday, September 26, 2013

Re: How to use selenium test against different browsers using LiveServerTestCase

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAlJEi9EACgkQuYLL1cDjHx3XUwCdGNbvxtQXNpEaVjIaWnteDXyN
MlUAn1W2UOejNbr1ihezahZslxR9byf7
=9vAu
-----END PGP SIGNATURE-----
On Thu, 26 Sep 2013 09:46:43 -0700 (PDT) Tianyi Wang
<wty52133@gmail.com> wrote:
> So follow the Django doc example,
> https://docs.djangoproject.com/en/dev/topics/testing/overview/#django.test.LiveServerTestCase
> In the example, the test only test against Firefox. How can I test
> against different browsers without duplicate the example code?

I would propose this:
In your classes __init__ (or in the init of your mixin specially for
this) check for an environment-variable or a django-setting to tell you
the browser to use. With a fallback if nothing is defined.

Then when you run the tests locally, you can decide which browser to
use. And when run in jenkins, the browser is a matrix-variable giving
you functional tests with all the defined browsers.

Have fun,

Arnold

No comments:

Post a Comment