-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add front runner. * Solve Rebase Conflict. * Move FIXTURE_DIRS into test_settings. * Move logger from back's package into top package. * Complete flush and loaddata func before front testting. * Rename FrontTestRunner. * Remove TAG_DB_MODIFY. * Modify settings' place and update doc. * Move log path into test_settings. * Updata TODO.
- Loading branch information
Showing
10 changed files
with
94 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
* 将所有subTest改成失败的话,直接整个TC都fail,因为我使用的所有的SubTest都只是表示的一个线性操作序列而已。 | ||
* 修改user photo相关的测试样例,劫持图床服务器。因为目前我没有劫持图床服务器,每次测试的时候都会向图床服务器发送一个真实的请求,这是不太合适的……会给人家的服务器带去虽然很小但确实存在的不必要的困扰。 | ||
* 现在前测试依然是使用正在跑的数据库当测试数据库,这并不安全。想办法解决这个问题,使得前测试也和后测试一样,在测试开始时创建一个专用的测试数据库。有两种可能可行的解: | ||
* 研究怎么让正在跑的django server切换到我新建的test database | ||
* 研究怎么在我开始测试的时候新建一个django服务器,并指定它在我新建的测试数据库上跑 | ||
* 在前测试点,构造usercase模拟一套用户的操作,并在此基础上实现并行测试。 | ||
* 并行测试:构建多个usercase,随机伪并发执行,检验是否运作正常。 | ||
* 易用性检查 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env python | ||
import os | ||
|
||
import test_settings | ||
from .rmc_test_logger import log | ||
from django.conf import settings | ||
from django.test.runner import DiscoverRunner | ||
from django.core.management.commands import loaddata, flush | ||
|
||
class ReloadTestRunner(DiscoverRunner): | ||
'''This TestRunner will flush and load database before testting.''' | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
|
||
db_name = settings.DATABASES["default"]["NAME"] | ||
if test_settings.DATABASES["default"]["NAME"] != db_name: | ||
raise Exception("Please test from test_manage.py, because of an independent test database needed for front testing.") | ||
|
||
# Flush test database | ||
log.info("Start flushing database [{0}]...".format(db_name)) | ||
flush_cmd = flush.Command() | ||
flush_cmd.run_from_argv([ | ||
"test/test_manage.py", | ||
"flush", | ||
"--noinput", | ||
]) | ||
log.info("Finished flushing!") | ||
|
||
# Load fixture | ||
log.info("Start installing fixture on database [{}] from [{}]...".format(db_name, test_settings.FRONT_FIXTURE)) | ||
load_cmd = loaddata.Command() | ||
load_cmd.run_from_argv([ | ||
"test/test_manage.py", | ||
"loaddata", | ||
test_settings.FRONT_FIXTURE, | ||
]) | ||
log.info("Finished installing.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters