All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mapping.TestngMapper.xml Maven / Gradle / Ivy

There is a newer version: 0.2.2
Show newest version
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="tools.mapper.testng.TestngMapper" >

    <insert id="addTestExecutionRecord" parameterType="tools.testng.Statistic"
            useGeneratedKeys="true" keyProperty="uid">
        INSERT INTO site_reldb.testng_execution_record(TEST_UNIQUE_TAG,
            TEST_PROJECT_NAME, TEST_SUITE_NAME, XML_TEST_NAME, TEST_CLASS, TEST_NAME, TEST_RESULT,
            TEST_DURATION, TEST_START_TIME, TEST_FINISH_TIME, TEST_ANNO_INFO,
            INTER_NAME, METHOD_NAME, INTER_PATH, METHOD_PARAMS,
            TEST_PARAMS, TEST_EXPECT, TEST_ASSERT, TEST_ERROR_MSG, TEST_STACK_TRACE,
            GMT_CREATE)
        VALUES
            (
             #{uniqueTag,jdbcType=VARCHAR}, #{projectName}, #{suiteName}, #{xmlTestName}, #{className,jdbcType=VARCHAR},
             #{testName}, #{testResult}, #{duration}, #{startTime}, #{finishTime}, #{testAnnoInfo},
             #{interName}, #{methodName}, #{interPath}, #{methodParameters},
             #{testParameters}, #{expect}, #{assertion}, #{errorMsg}, #{stackTrace},
             now()
            )
    </insert>

    <insert id="insertTestExecutionRecord" parameterType="tools.testng.Statistic"
            useGeneratedKeys="true" keyProperty="uid">
        INSERT INTO site_reldb.testng_execution_record(TEST_UNIQUE_TAG,
            TEST_PROJECT_NAME, TEST_SUITE_NAME, XML_TEST_NAME, TEST_CLASS, TEST_NAME, TEST_RESULT,
            TEST_DURATION, TEST_START_TIME, TEST_FINISH_TIME, TEST_ANNO_INFO,
            INTER_NAME, METHOD_NAME, INTER_PATH, METHOD_PARAMS,
            TEST_PARAMS, TEST_EXPECT, TEST_ASSERT, TEST_ERROR_MSG, TEST_STACK_TRACE,
            GMT_CREATE)
        VALUES
            (
             #{uniqueTag,jdbcType=VARCHAR}, #{projectName}, #{suiteName}, #{xmlTestName}, #{className,jdbcType=VARCHAR},
             #{testName}, #{testResult}, #{duration}, #{startTime}, #{finishTime}, #{testAnnoInfo},
             #{interName}, #{methodName}, #{interPath}, #{methodParameters},
             #{testParameters}, #{expect}, #{assertion}, #{errorMsg}, #{stackTrace},
             now()
            )
    </insert>

    <resultMap id="StatisticBasicResultMap" type="tools.testng.Statistic" >
        <id column="UID" property="uid" javaType="Integer" jdbcType="INTEGER" />
        <result column="TEST_UNIQUE_TAG" property="uniqueTag" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_PROJECT_NAME" property="projectName" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_SUITE_NAME" property="suiteName" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_CLASS" property="className" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_NAME" property="testName" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_RESULT" property="testResult" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_DURATION" property="duration" javaType="String" jdbcType="INTEGER" />
        <result column="TEST_START_TIME" property="startTime" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_FINISH_TIME" property="finishTime" javaType="String" jdbcType="VARCHAR" />
    </resultMap>
    <sql id="Base_Column_List" >
        SELECT UID, TEST_UNIQUE_TAG, TEST_PROJECT_NAME, TEST_SUITE_NAME, TEST_CLASS, TEST_NAME, TEST_RESULT, TEST_DURATION, TEST_START_TIME, TEST_FINISH_TIME
    </sql>
    <select id="selectBasicInfoByUID" resultMap="StatisticBasicResultMap" parameterType="java.lang.Integer" >
        <include refid="Base_Column_List" />
        FROM test_ccc.testng_execution_record
        WHERE UID = #{uid,jdbcType=INTEGER}
    </select>


    <resultMap id="StatisticResultMap" type="tools.testng.Statistic" >
        <id column="UID" property="uid" javaType="Integer" jdbcType="INTEGER" />
        <result column="TEST_UNIQUE_TAG" property="uniqueTag" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_PROJECT_NAME" property="projectName" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_SUITE_NAME" property="suiteName" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_CLASS" property="className" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_NAME" property="testName" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_RESULT" property="testResult" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_DURATION" property="duration" javaType="String" jdbcType="INTEGER" />
        <result column="TEST_START_TIME" property="startTime" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_FINISH_TIME" property="finishTime" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_ANNO_INFO" property="testAnnoInfo" javaType="String" jdbcType="VARCHAR" />
        <result column="INTER_NAME" property="interName" javaType="String" jdbcType="VARCHAR" />
        <result column="INTER_PATH" property="interPath" javaType="String" jdbcType="VARCHAR" />
        <result column="METHOD_NAME" property="methodName" javaType="String" jdbcType="VARCHAR" />
        <result column="METHOD_PARAMS" property="methodParameters" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_PARAMS" property="testParameters" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_EXPECT" property="expect" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_ASSERT" property="assertion" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_ERROR_MSG" property="errorMsg" javaType="String" jdbcType="VARCHAR" />
        <result column="TEST_STACK_TRACE" property="stackTrace" javaType="String" jdbcType="VARCHAR" />
    </resultMap>
    <select id="selectStatisticInfoByUID" resultMap="StatisticResultMap" parameterType="java.lang.Integer" >
        <include refid="Base_Column_List" />,
        TEST_ANNO_INFO, INTER_NAME, INTER_PATH, METHOD_NAME, METHOD_PARAMS,
        TEST_PARAMS, TEST_EXPECT, TEST_ASSERT, TEST_ERROR_MSG, TEST_STACK_TRACE
        FROM test_ccc.testng_execution_record
        WHERE UID = #{uid,jdbcType=INTEGER}
    </select>
    <select id="selectStatisticListByUniqueTag" resultMap="StatisticResultMap" parameterType="java.lang.String" >
        <include refid="Base_Column_List" />,
        TEST_ANNO_INFO, INTER_NAME, INTER_PATH, METHOD_NAME, METHOD_PARAMS,
        TEST_PARAMS, TEST_EXPECT, TEST_ASSERT, TEST_ERROR_MSG, TEST_STACK_TRACE
        FROM test_ccc.testng_execution_record
        WHERE TEST_UNIQUE_TAG = #{uniqueTag,jdbcType=VARCHAR}
    </select>

    <!-- 上面是测试执行记录,下面试测试用例记录 -->

    <insert id="addTestCaseRecord" parameterType="tools.testng.TestCase"
            useGeneratedKeys="true" keyProperty="uid">
        INSERT INTO site_reldb.testng_case_record(TEST_PROJECT_NAME, TEST_PSM, TEST_INTERFACE, TEST_INTER_TYPE, TEST_CLASS,
                                                   TEST_METHOD, TEST_DESCRIPTION, VERSION, GMT_CREATE, GMT_MODIFY)
        VALUES
        (
            #{projectName}, #{psmKey}, #{interName}, #{protocolType,jdbcType=VARCHAR}, #{testClass},
            #{testMethod}, #{testDesc}, #{version}, now(), now()
        )
    </insert>

    <select id="selectExistTestCase" resultType="java.util.Map" parameterType="tools.testng.TestCase">
        SELECT * FROM site_reldb.testng_case_record
        WHERE TEST_PROJECT_NAME = #{projectName} AND TEST_PSM = #{psmKey} AND TEST_INTERFACE = #{interName} AND TEST_CLASS = #{testClass} AND TEST_METHOD = #{testMethod}
    </select>

    <select id="selectMaxVersion" resultType="java.util.Map">
        SELECT TEST_PROJECT_NAME, TEST_PSM, MAX(VERSION) AS MAX_VERSION
        FROM site_reldb.testng_case_record
        WHERE TEST_PSM = #{psmKey} AND TEST_PROJECT_NAME = #{projectName}
    </select>

    <update id="updateVersion" parameterType="tools.testng.TestCase">
        UPDATE site_reldb.testng_case_record
        SET VERSION = #{version}, GMT_MODIFY = now()
        WHERE TEST_PROJECT_NAME = #{projectName} AND TEST_PSM = #{psmKey} AND TEST_INTERFACE = #{interName} AND TEST_CLASS = #{testClass} AND TEST_METHOD = #{testMethod}
    </update>

    <delete id="deleteOldVersion">
        DELETE FROM site_reldb.testng_case_record
        WHERE VERSION = #{currMaxVersion}
        AND TEST_PSM = #{psmKey} AND TEST_PROJECT_NAME = #{projectName}
    </delete>

</mapper>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy