0

Since things like the URL of the website to test, login and password may be common to a whole suite of Selenium 2 programs, how can they be centralized ? I am using Python, so the answer maybe to use a super-class which has these common values.

Post script

I did try a 'super class' inherited from unittest.TestCase which had the setUp and tearDown methods. The inherited sub-class had the core test code. This sub class also had import unittest for cross-referencing code. But i found that the test time doubled with this approach. Maybe just my code, but i decided to globally edit properties in Eclipse.

Chakra
  • 2,525
  • 8
  • 43
  • 82

1 Answers1

1

There are several ways to externalize common properties. It all depends on the underlying language you are using to test your application. Selenium doesn't have to do anything with loading external files as far as I know. I use selenium Java binding and use Java Properties to externalize common attributes. Since we run tests in different environments like qa, dev, pilot etc. I have one property file per environment. These individual property files contain environment specific urls and attributes. I load the property of interest on fly and run tests against that environment.

It looks like you are using python. I am not a python expert but a quick google search of Java properties equivalent in Python gave me this answer. Hope that helps you get started.

Community
  • 1
  • 1
nilesh
  • 14,131
  • 7
  • 65
  • 79