Note that there are some explanatory texts on larger screens.

plurals
  1. POLiveServerTestCase does not map Django Application to url
    text
    copied!<h2>Background:</h2> <p>I am trying to setup my first Selenium driven integration test for a Django app. I have developed the following simple code:</p> <pre><code>from django.test import LiveServerTestCase from selenium.webdriver.firefox.webdriver import WebDriver from selenium.webdriver.common.keys import Keys class DynamicFormsIntegrationTest(LiveServerTestCase): @classmethod def setUpClass(cls): cls.selenium = WebDriver() cls.selenium.implicitly_wait(3) super(DynamicFormsIntegrationTest, cls).setUpClass() @classmethod def tearDownClass(cls): super(DynamicFormsIntegrationTest, cls).tearDownClass() cls.selenium.quit() def test_basic(self): """ Uses get to open application page """ self.selenium.get(self.live_server_url + '/woc/') #Force Test Fail self.fail("FAIL") </code></pre> <p>Now, when I run this test using the following command:</p> <pre><code>python manage.py test test2 </code></pre> <p>I get the following output:</p> <pre><code>python manage.py test test2^JCreating test database for alias 'default'... &lt;QueryDict: {}&gt; F ====================================================================== FAIL: test_basic (test2.tests.test_forms.DynamicFormsIntegrationTest) Adds a single set via Jquery/Javascript, Submits, and verifies it was rendered and added to Model.Sets ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/usr/path/to/app/test2/tests/test_forms.py", line 42, in test_basic self.fail("FAIL") AssertionError: FAIL ---------------------------------------------------------------------- Ran 1 test in 8.901s FAILED (failures=1) Destroying test database for alias 'default'... </code></pre> <p>And when I run through my regular setup:</p> <pre><code>python manage.py runserver </code></pre> <p>I get the following output upon page request:</p> <pre><code>python manage.py runserver Validating models... 0 errors found September 01, 2013 - 14:42:34 Django version 1.5.1, using settings 'app.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CONTROL-C. &lt;QueryDict: {}&gt; [01/Sep/2013 14:42:39] "GET /test2/ HTTP/1.1" 200 9372 </code></pre> <p>As you can see, the web page is not recognized when running the test (&amp; no "GET" request is actually made, as is correctly done in the dev environment request). I actually believe the "GET" failure is an just an indicator of the problem that the Application is not correctly set up by the LiveServerTestCase.</p> <h2>Question:</h2> <p>Why is the LiveServerTestCase not recognizing my page urls and how can I resolve the issue?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload