I would recommend reading Django 1.1 Testing and Debugging by Karen M. Tracey. The first five chapters cover testing in Django. Specifically, you should look at Chapter 5 which discusses integrating other test tools. Below is an excerpt of what Chapter 5 covers:
In this chapter, we:
Learned what hooks Django provides for adding test functions
Saw an example of how these hooks can be used, specifically in the case of adding code coverage reporting
Also explored an example where using these hooks was not necessary—when integrating the use of the twill test tool into our Django test cases
Here are links to some of the tools that Karen Tracey discusses in chapter 5 of her book:
Testing provides the answers to (at least ) 4 questions.
Is my implementation correct? Does the app match the documented or at least mental image of how it is supposed to behave.
Did my latest change break anything?
Is my app secure? From both innocent users and devious people.
Is my app's performance sufficient?
For #1, there needs to be at least one test per "feature" and probably many for major features. It is very easy to make errors of omission here if you are both the developer and the test developer.
For #2 starting out with the discipline of writing the test suites along with the code (and faithfully running it) is key.
For #3, Make sure that URLs accessed outside of normal program directing operations behave properly with respect to permissions. You probably don't want one user to be able to modify or even another user' info but if they can just type in ../user/505 and get to everything there that's probably a problem. I'm sure there is a lot of other things that should be tested here, so other people chime in here please.
Testing performance and scaling robustness for an app with a tremendous amount of traffic isn't something I know much about.
Looking at the test cases for Django itself provide a sense of the granularity of what should be tested.Django trunk tests
Django docs have a good article on testing: search the docs for testing.
发布评论
评论(2)
我建议阅读 Karen M 的 Django 1.1 测试和调试。特蕾西。前五章介绍了 Django 中的测试。具体来说,您应该查看第 5 章,其中讨论了集成其他测试工具。以下是第 5 章内容的摘录:
以下是 Karen Tracey 在她的书第 5 章中讨论的一些工具的链接:
coverage
模块生菜
您可能还想检查出生菜。来自网站:
Lettuce 文档还有一个关于将 Lettuce 与 Django 集成的部分。
I would recommend reading Django 1.1 Testing and Debugging by Karen M. Tracey. The first five chapters cover testing in Django. Specifically, you should look at Chapter 5 which discusses integrating other test tools. Below is an excerpt of what Chapter 5 covers:
Here are links to some of the tools that Karen Tracey discusses in chapter 5 of her book:
coverage
moduleLettuce
You may also want to check out Lettuce. From the website:
The Lettuce documentation also has a section on integrating Lettuce with Django.
测试提供(至少)4 个问题的答案。
我的实现正确吗?该应用程序是否符合记录的或至少是其应有行为方式的心理图像。
我的最新更改是否破坏了任何内容?
我的应用程序安全吗?来自无辜用户和狡猾的人。
我的应用程序的性能是否足够?
对于#1,每个“功能”至少需要进行一次测试,并且对于主要功能可能需要进行多次测试。
如果你既是开发人员又是测试开发人员,那么这里很容易犯疏忽错误。
对于#2,从编写测试套件和代码(并忠实地运行它)的原则开始是关键。
对于 #3,确保在正常程序定向操作之外访问的 URL 在权限方面表现正常。您可能不希望一个用户能够修改甚至另一个用户的信息,但如果他们只需输入 ../user/505 并获取那里的所有内容,那可能就是一个问题。我确信这里还有很多其他的东西需要测试,所以其他人也请在这里插话。
测试具有大量流量的应用程序的性能和扩展稳健性
我不太了解。
查看 Django 本身的测试用例可以了解应该测试的内容的粒度。Django trunk 测试
Django 文档有一篇关于测试的好文章:搜索文档进行测试。
Testing provides the answers to (at least ) 4 questions.
Is my implementation correct? Does the app match the documented or at least mental image of how it is supposed to behave.
Did my latest change break anything?
Is my app secure? From both innocent users and devious people.
Is my app's performance sufficient?
For #1, there needs to be at least one test per "feature" and probably many for major features.
It is very easy to make errors of omission here if you are both the developer and the test developer.
For #2 starting out with the discipline of writing the test suites along with the code (and faithfully running it) is key.
For #3, Make sure that URLs accessed outside of normal program directing operations behave properly with respect to permissions. You probably don't want one user to be able to modify or even another user' info but if they can just type in ../user/505 and get to everything there that's probably a problem. I'm sure there is a lot of other things that should be tested here, so other people chime in here please.
Testing performance and scaling robustness for an app with a tremendous amount of traffic
isn't something I know much about.
Looking at the test cases for Django itself provide a sense of the granularity of what should be tested.Django trunk tests
Django docs have a good article on testing: search the docs for testing.