Beispiel #1
0
from interfacetest.woniusales_test01.common.sales_report import SalesReports
from interfacetest.woniusales_test01.util.utility import Utility
import unittest
from parameterized import parameterized
data_config_path = '../config/testdata.conf'

data_config_info = Utility.get_json(data_config_path)
result_info = Utility.get_excel_to_tuple(data_config_info[7])


class SaleReportTest(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.sale_report = SalesReports()

    @parameterized.expand(result_info)
    def test_sale_report_selldetailtoday(self, url, method, data, resp_code,
                                         resp_content):
        resp = self.sale_report.query_selldetailtoday(url, data)
        self.assertEqual(resp.text, resp_content)


if __name__ == '__main__':
    unittest.main(verbosity=2)
import requests

from interfacetest.woniusales_test01.common.customer import Customer
from interfacetest.woniusales_test01.util.utility import Utility
import unittest
from parameterized import parameterized

base_conf_path = '../config/base.conf'
data_config_info = Utility.get_json('../config/testdata.conf')

add_customer_info = Utility.get_excel_to_tuple(data_config_info[1])
query_customer_info = Utility.get_excel_to_tuple(data_config_info[2])
edit_customer_info = Utility.get_excel_to_tuple(data_config_info[3])
class CustomerTest(unittest.TestCase):

	@classmethod
	def setUpClass(cls):
		cls.customer = Customer()

	# 添加会员
	@parameterized.expand(add_customer_info)
	def test_add_customer(self,url,method,test_data,resp_code,resp_content):
		print(url)
		add_customer_resp = self.customer.add_customer(url,test_data)
		self.assertEqual(add_customer_resp.text,resp_content)



	# 会员查询  查询1条 查询0条 查询所有 查询部分
	@parameterized.expand(query_customer_info)
	def test_query_customer(self,url,method,test_data,resp_code,resp_content):
Beispiel #3
0
import requests, time
import unittest
from parameterized import parameterized

from interfacetest.woniusales_test01.common.goods_store import GoodsStore
from interfacetest.woniusales_test01.util.utility import Utility

data_config_path = '../config/testdata.conf'

data_config_info = Utility.get_json(data_config_path)
info = Utility.get_excel_to_tuple(data_config_info[10])


class GoodsStoreTest(unittest.TestCase):
    @parameterized.expand(info)
    def test_goods_store(self, url, method, test_data, resp_code,
                         resp_content):
        resp = GoodsStore().goods_store(url, test_data)
        if len(resp.json()) > 0:
            actual = 'store_success'

        self.assertEqual(actual, resp_content)


if __name__ == '__main__':
    unittest.main(verbosity=2)
import requests, json

from interfacetest.woniusales_test01.common.customer import Customer
from interfacetest.woniusales_test01.common.sales import Sales
from interfacetest.woniusales_test01.util.utility import Utility
import unittest
from parameterized import parameterized
base_conf_path = '../config/base.conf'
data_config_path = '../config/testdata.conf'

data_config_info = Utility.get_json(data_config_path)

scan_barcode_info = Utility.get_excel_to_tuple(data_config_info[11])

query_customer_info = Utility.get_excel_to_tuple(data_config_info[5])


class SalesTest(unittest.TestCase):

    # 商品扫码
    @parameterized.expand(scan_barcode_info)
    def test_scan_barcode(self, url, method, test_data, resp_code,
                          resp_content):
        resp = Sales().scan_barcode(url, test_data)
        self.assertEqual(resp.text, resp_content)

    # 会员信息查询
    @parameterized.expand(query_customer_info)
    def test_query_customer(self, url, method, test_data, resp_code,
                            resp_content):
        resp = Sales().query_customer(url, test_data)
import requests

from interfacetest.woniusales_test01.common.customer import Customer
from interfacetest.woniusales_test01.common.store_query import StoreQuery
from interfacetest.woniusales_test01.util.utility import Utility
import unittest
from parameterized import parameterized

base_conf_path = '../config/base.conf'
data_config_info = Utility.get_json('../config/testdata.conf')
query_info = Utility.get_excel_to_tuple(data_config_info[9])


class StoreQueryTest(unittest.TestCase):
    @classmethod
    def setUpClass(cls):
        cls.store_query = StoreQuery()

    @parameterized.expand(query_info)
    def test_query_store(self, url, method, test_data, resp_code,
                         resp_content):
        print('url', url)
        query_store_count = len(self.store_query.query_store(url, test_data))

        # 查询0库存
        sql_zero = 'SELECT COUNT(*) FROM storesum WHERE  remained = 0'
        zero_count = Utility.query_one('../config/base.conf', sql_zero)[0]

        # 查询未入库
        sql_no_store = 'SELECT COUNT(*) FROM goods WHERE barcode="0"'
        nostore_count = Utility.query_one('../config/base.conf',