基于Django框架的mock-server的设计与实现

 2022-04-08 08:04

论文总字数:26250字

摘 要

在软件开发过程中,为了保证软件的质量,软件测试是必不可少的。由于公司架构核心为微服务架构,即是将应用按照业务拆分成不同服务,服务之间存在很多依赖关系。测试人员单边测试的目的是仅测试该服务,如果引入其他的服务组件,可能会因为所引入的服务组件的内部逻辑错误问题导致测试失败。为避免此类问题,以及提高测试目标服务组件时的测试效率,测试人员可以选择模拟所调用的服务组件的相关逻辑,形成功能简单、明确的mock-server,以快捷方便而准确地测试目标组件,减少外部影响。本毕业设计的目的就是设计这样的mock-server。

本毕业设计基于Django框架进行mock-server的设计与实现。Django框架使用python语言设计,采用MTV设计模式,其特点是快捷方便的搭建服务器,同时模板语言丰富,管理界面优良,URL的设计简单易懂,适合快捷地网站开发。本课题设计的mock-server模拟了资金端所需要的资产端和支付端的相关功能和调用,在保证资金端能够进行正常测试的情况下,mock-server提供了更加简易的操作,减少了测试人员进行测试的工作量。

经验证,本毕业设计所实现的mock-server可以实现资产端、支付端相应功能的模拟并辅助资金端进行相应的测试,其中功能包括资产端的商品创建、成立通知、兑付还款,支付端的支付、转账请求的响应等,基本满足资金端的测试需求。

关键字:微服务,mock-server,资金端,资产端,支付端

Abstract

In the process of software development, in order to ensure the quality of software, software testing is essential. Since the core of the corporate architecture is the micro-service architecture, which is to divide the application into different services according to the business, there are many dependencies among the services. However, The purpose of the tester's unilateral testing is to test only the service. If other service components are introduced, the test may fail due to internal logic errors of the introduced service components. In order to avoid such problems and improve the test efficiency when testing the target service component, testers can mock the logic of the invoked service component as a mock-server with simple and explicit functions, so that we could test the target component quickly and reduce external influences. The graduation project is devoted to sign a mock-server like this.

The graduation project designs and achieves the mock-server based on the Django framework. Django framework is coded by python language and adopts MTV framework mode. It is characterized by fast and convenient server construction, rich template language, excellent management interface, simple URL design, and suitable for rapid development. The mock-server designed by the graduation project mocks the functions that is provided by the asset system and payment system and the KXD is required. Under the condition that the KXD can be tested normally, the mock-server provides more simple operation and reduces the workload of the testers.

Verified, the mock-server can mock the functions provided by payment and asset system and make it successful to complete the testing of KXD. These function includes the goods-creating, commodity-establish notice, repayment in the asset system and the payment in the payment system. In general, the mock-server can meet the demand to test the fund system.

Keywords: micro-service, mock-server, KXD, asset system, payment system.

重要术语解释

资金端 :开鑫贷公司的板块,简称X2D,将标准的金融化产品发布到交易平台上并销售给出借人。主要负责投资产品发布、起售、投资、止售、流标、成立、转让等流程。

资产端 : 开鑫贷公司的板块,将非标准化的资产转化为标准的金融产品,其主要类型为KJW和P2P(在本论文中,资产端的主要作用是创建投资产品,成立、流标的通知,商品兑付)

支付端 :开鑫贷公司的板块,用于用户开户、绑卡,以及支付交易、转账交易的资金转账操作.按照支付方式分为XCG和KXF两种支付方式。

MTV:MTV设计模式,其本质和MVC设计模式相似——为了降低各个组件耦合。M层(Model)负责业务和数据库的关系映射,T层(Template)负责如何把页面展示给用户,V层(Views)则负责业务逻辑。

目 录

第一章 绪论 1

1.1 选题背景 1

1.2 项目简介 2

1.3 论文主要内容及安排 2

第二章 相关技术和框架 3

2.1 mock-server和mock 3

2.2 Python语言和Django框架 4

2.3 本章小结 6

第三章 mock-server需求分析 7

3.1功能需求分析 7

3.2 非功能需求分析 10

3.3本章小结 10

第四章 mock-server概要设计 11

4.1 kaifae/p2p erp mock 11

4.2 xcg/kxf mock 12

4.3 其它设计 13

4.4本章小结 14

第五章 mock-server详细设计与实现 15

5.1 mock-server架构详细设计 15

5.2 kaifae/p2p mock设计与实现 19

5.3 xcg/kxf mock 设计与实现 20

5.4 其它功能设计 23

5.5 本章小结 23

第六章 Mock-server测试 25

6.1 功能测试 25

6.2 非功能测试 26

6.3 本章小结 27

第七章 Mock-server应用 28

7.1 应用场景及效果展示 28

7.2 本章小结 31

第八章 总结与展望 33

8.1 总结 33

8.2 展望 33

参考文献 34

致 谢 35

第一章 绪论

1.1 选题背景

随着科技不断的进步,软件开发不断地发展、趋于成熟,软件测试在软件开发流程中的地位也愈发重要。软件如果没有进行软件测试,该软件是不稳定的。其可能会有很多潜在的问题,以至于软件在使用过程中出现意料之外的错误,这些错误可能是影响用户体验的显示、点击等方面的轻微bug,也可能是导致软件瘫痪、造成巨大经济损失的致命bug。一个优秀的软件产品必然是经历了全面、专业的软件测试的。

剩余内容已隐藏,请支付后下载全文,论文总字数:26250字

您需要先支付 80元 才能查看全部内容!立即支付

该课题毕业论文、开题报告、外文翻译、程序设计、图纸设计等资料可联系客服协助查找;