feat: MES 接口自动化测试框架(unittest + HTMLTestRunner + 数据驱动)
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""质检管理用例。
|
||||
|
||||
用例保留
|
||||
「dao 查质检点 → 组装质检类型/方案」的链路,数据改为合成。
|
||||
"""
|
||||
import unittest
|
||||
|
||||
from core import auth, config
|
||||
from core.http_client import HttpClient
|
||||
from core.logger import setLog
|
||||
from dao.quality import QualityDao
|
||||
|
||||
|
||||
class TestQuality(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
auth.login()
|
||||
cls.http = HttpClient()
|
||||
cls.mes_id = auth.get_mes_id()
|
||||
|
||||
@setLog()
|
||||
def test_quality_point_add(self):
|
||||
"""新增质检点"""
|
||||
url = config.base_url() + '/mes/qualityPoint/add'
|
||||
body = self.http.post_json(url, {'name': '外观缺陷', 'remark': ''}).json()
|
||||
self.assertEqual(body['code'], 200)
|
||||
return body
|
||||
|
||||
@setLog()
|
||||
def test_quality_point_add_empty(self):
|
||||
"""新增质检点-名称为空"""
|
||||
url = config.base_url() + '/mes/qualityPoint/add'
|
||||
body = self.http.post_json(url, {'name': ''}).json()
|
||||
self.assertEqual(body['code'], 400)
|
||||
return body
|
||||
|
||||
def test_quality_dao(self):
|
||||
"""dao:质检点/质检类型查询"""
|
||||
dao = QualityDao()
|
||||
points = dao.get_points(self.mes_id)
|
||||
types = dao.get_types(self.mes_id)
|
||||
self.assertGreaterEqual(len(points), 1)
|
||||
self.assertGreaterEqual(len(types), 1)
|
||||
dao.close()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user