问题描述
我正在使用Django 3.1和Python 3.6
我有一个应用,我想通过运行./manage.py test myapp
/path/to/project/myapp/test.py
import os
from django.test import TestCase
from selenium import webdriver
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
import time
# Create your tests here.
class FunctionalTestCase(StaticLiveServerTestCase):
fixtures = ['user_test_data.json','foo_test_data']
@classmethod
def setUpClass(cls):
super().setUpClass()
loc='/path/to/some/loc/'
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--disable-notifications")
chrome_options.add_argument("user-data-dir=/home/morpheous/") #
cls.browser = webdriver.Chrome(os.path.join(loc,'chromedriver'),chrome_options=chrome_options)
@classmethod
def tearDownClass(cls):
cls.browser.quit()
super().tearDownClass()
def test_functest_one(self):
pass
def test_functest_two(self):
pass
# Create your tests here.
class UnitTestCase(TestCase):
def test_some_unit_test(self):
pass
当我运行./manage.py test myapp
时,它仅运行功能测试,并说两次测试失败(如预期)。如何运行功能性和单元测试两者?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)