FunTester 我的开发日记 (八)

FunTester · 2020年06月23日 · 574 次阅读

由于疫情原因,从周一开始在家办公了,个人感觉工作效率收影响还是挺大的。今天本来计划把测试用例这块写完,明后天写测试用例集这个模块,看了一下还有 11 个接口。

由于上星期把坑踩了不少,今天倒是挺顺利的,就是各类bean和库表设计有点费时间,真心觉得时间太长了,下午六点时候脑袋疼,就出去吃了个饭。照目前的进度,下周一完成开发没啥大问题,相信接下来也会比较顺利。

今天能想到的知识点就是resultMap的使用,在mybatis中,maptype很多相似的地方,map多了一层映射,可以把不同的属性和表的字段对应上,设置响应的typehandler

测试用例的编辑分成两部分,一部分是属性,特别是关联属性,第二部分是测试数据,都是跟请求相关的。

需求图

下面是这个测试用例详情图,左侧展示了部分关联属性的情况,这个界面是不可编辑的,下面的header上行参数具体的实现方式由第二张图所示,需要兼顾层级结构和参数属性(是否必传,参数类型等),这块数据我需要存,但是暂时还无法拿到具体的数据结构,这也是一个
测试用例详情
moco数据结构

查询测试用例数据详情

<resultMap type="com.okay.family.common.bean.testcase.response.CaseDetailBean" id="CaseDetailBean">
    <result property="id" column="id"/>
    <result property="envId" column="envId"/>
    <result property="envName" column="envName"/>
    <result property="apiId" column="apiId"/>
    <result property="apiName" column="apiName"/>
    <result property="httptype" column="method"/>
    <result property="serviceId" column="serviceId"/>
    <result property="serviceName" column="serviceName"/>
    <result property="moduleId" column="moduleId"/>
    <result property="moduleName" column="moduleName"/>
    <result property="readType" column="type"/>
    <result property="url" column="path"/>
    <result property="name" column="name"/>
    <result property="header" column="headersmoco"
            typeHandler="com.okay.family.common.typehandler.JsonArrayHandler"/>
    <result property="upData" column="paramsmoco"
            typeHandler="com.okay.family.common.typehandler.JsonArrayHandler"/>
    <result property="testWish" column="verify"
            typeHandler="com.okay.family.common.typehandler.ListCaseVerifyBeanHandler"/>
</resultMap>

<select id="getCaseDetail" parameterType="java.lang.Integer" resultMap="CaseDetailBean">
    select c.id,c.name,c.apiId,a.name apiName,c.envId,e.name envName,c.serviceId,s.name
    serviceName,c.moduleId,m.name moduleName,c.type,c.method,c.headersmoco,c.paramsmoco,c.verify,c.path from
    <include refid="table"/>
    c left join
    <include refid="env"/>
    e on c.envId = e.id left join
    <include refid="service_table"/>
    s on c.serviceId = s.id left join
    <include refid="module_table"/>
    m on c.moduleId = m.id left join
    <include refid="api_info"/>
    a on c.apiId = a.id
    WHERE c.id = #{0}
</select>

  • 公众号FunTester首发,欢迎关注,禁止第三方擅自转载,合作请联系Fhaohaizi@163.com

热文精选

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册