I have a Django application, myApp. In it, there's a tests.py file which defines a number of test cases using django.test.TestCase class. For example, one of them is called WebViews, and has a test method check_status_codes.
When I run ./manage.py test, the database is built with my initial data, but then it tells me that it ran 0 tests. I get similar results (tests not running) if I do this:
./manage.py test myApp
or even this:
./manage.py test myApp.WebViews
However, if I execute
./manage.py test.WebViews.check_status_codes
then that exact test method runs as expected.
I can string bunch of test methods together like this and get them to run, but this gets very tedious and I have a feeling I'm missing something.
Any hints or suggestions regarding what to do?
Thanks!
I believe the convention with unit tests is to have your test methods pre-pended with test. For example:
class FooTest(TestCase):
def setUp(self):
# do setup stuff here
pass
def tearDown(self):
# do teardown here
pass
def test_one_equals_one(self):
self.assertEqual(1, 1, "One did not equal 1")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With