dimanche 5 avril 2015

selenium test not opening a browser django

I am trying to run a selenium test and this seems nothing happening. I tested the following code to make sure the setting was working: the firefox browser loaded as it is expected.


In functional_tests.py



browser = webdriver.Firefox()
broswer.get('http://localhost:8000')


But when I changed it to as follows:



import unittest
from selenium import webdriver

class NewVistorTest(unittest.TestCase):

def setUp(self):
self.browser = webdriver.Firefox()

def tearDown(self):
self.browser.quit()

def test_can_open_browser(self):
self.browser.get('http://localhost:8000')
self.assertIn('Test', self.browser.title)


It was not opening the browser, nothing was happening. I ran this python functional_tests.py


What is the best way to organize unit tests and selenium tests. I'd like to run it by module name, not all in tests.py or test_abc.py, not by nose.


Aucun commentaire:

Enregistrer un commentaire