在单元测试方面,Django 继承 python 的 unittest.TestCase 实现了自己的 django.test.TestCase,编写测试用例通常从这里开始。测试代码通常位于 app 的 tests.py 文件中(也可以在 models.py 中编写,一般不建议)。在 Django 生成的 depotapp 中,已经包含了这个文件,并且其中包含了一个测试
用例的样例:
一些测试工具:unittest 或者 pytest
在单元测试方面,Django 继承 python 的 unittest.TestCase 实现了自己的 django.test.TestCase,编写测试用例通常从这里开始。测试代码通常位于 app 的 tests.py 文件中(也可以在 models.py 中编写,一般不建议)。在 Django 生成的 depotapp 中,已经包含了这个文件,并且其中包含了一个测试
用例的样例:
一些测试工具:unittest 或者 pytest