<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
<div>Hi there,</div><div><br class="webkit-block-placeholder"></div><div>I'm using twill and selenium to test a client's websites.  I've got unit tests set up for different pages etc, checking for things such as failed include messages, and this is working fine with a hard-coded domain in my test script.  This example will happily test the wessexfm.com domain...</div><div><br class="webkit-block-placeholder"></div><div>--------- tw_test.py ----------- </div><div><br class="webkit-block-placeholder"></div><div><div>import unittest, time, re</div><div>from twill import get_browser</div><div>from twill.commands import find, notfind, title, code</div><div><br class="webkit-block-placeholder"></div><div>DOMAIN = {'primary': 'wessexfm.com', 'code': 'wx',}</div><div><br class="webkit-block-placeholder"></div><div>class Site_Test(unittest.TestCase):</div><div>    def setUp(self):</div><div>        self.tb = get_browser()</div><div>    def test_homepage(self):</div><div>        """Test the / homepage"""</div><div>        self.tb.go('<a href="http://www">http://www</a>.%s/' % DOMAIN['primary'])</div><div>        code(200)</div><div>        notfind('error occurred while processing this directive')</div><div><br class="webkit-block-placeholder"></div><div><span class="Apple-tab-span" style="white-space:pre">        </span>... etc ...<br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><div><div>if __name__ == "__main__":</div><div>    unittest.main()</div><div><br></div><div>-----------------------------------------</div><div><br></div><div>The client has 28 sites that are very similar.  I'd rather not have to clone the test script 28 times with different hard-coded domain details...  but I can't figure out how to pass in different parameters to the unit test - e.g. a different DOMAIN dict with data for other sites, and have the tests run on that domain instead.</div><div><br></div></div></div><div>Any tips or hints gratefully received!</div><div><br class="webkit-block-placeholder"></div><div>Cheers, Rob.</div><div><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div><br class="khtml-block-placeholder"></div><div>-- </div><div>Robert McHardy - London, UK</div><div><br></div><br class="Apple-interchange-newline"></span> </div><br></body></html>