Commit 91986333 by shuai

20190125

parents
/.classpath
/.project
.idea
.settings
bin/
log/
testoutput/
test-output/
环境要求:
1. 安装Java jdk 和 ant到本地环境
运行准备和步骤:
1. 确保工程目录下的resources目录下的tmp.xls 文件不存在。
2. 打开data.xls文件,在Input sheet中的填写测试数据(一行数据就是一次接口调用). 可以把data_all.xls里Testcase Sheet里需要执行的测试用例复制到data.xls的Input里(带表头)。清除data.xls里output sheet里的数据。
保存并关闭data.xls.(必须关闭)
3. 选择测试环境配置: 修改env.properties里的环境值。 可以参照env.prod.properties和env.beta.properties
4. 在工程目录下执行,ant。
配置:
1. 测试数据表说明:data.xls
1)数字输入excel会变成字符型。如果参数为数字型,请输入单引号+数字。例如’10000。
2)OpenId,productId,orderId:
OpenId,productId,orderId需要从之前测试步骤执行结果获取的,填写"code". 代码会使用从之前的测试结果中取得的openid,prouductId,orderId。
3)VerifyCode
a. verifycode需要从之前测试步骤执行结果获取本条用例使用的手机号的verifycode的,填写"code_own"
b. verifycode需要从之前测试步骤执行结果获取非本条用例使用的手机号的verifycode的,填写"code_others"
c. verifycode需要从之前测试步骤执行结果获取本条用例使用的手机号的已过期的verifycode的,填写"code_old"
4)statusCode,errcode,errmsg需要填写期望返回值
5) 对于需要全新客户信息的case,需要把cleanDB字段置为Y。
2. env.properties 文件:
isProduct=Y 表示 生产环境运行,不会连接数据做数据插入和检查。注意,生产环境执行时,如果要测插入商品接口,请在data表的字段busiId和busiName填写实际值,不要使用“code”。
查看结果:
1)测试用例全部执行后,打开data.xls文件, 在output里查看结果。
说明: 在非beta环境运行时,测试case运行结束后,会清除数据库中的测试数据。如需不清除数据,需要comment掉:BestbuyGMAPITest.java里afterClass() function下的
this.cleanCustomerInfo();
this.cleanProductsFromDB();
this.cleanOrdersFromDB();
<project name="auto_test" default="testoutput" basedir=".">
<!-- Define <testng> task -->
<taskdef name="testng" classname="org.testng.TestNGAntTask" >
<classpath>
<pathelement location="lib/testng-6.8.6.jar" />
</classpath>
</taskdef>
<property name="testoutputdir" location="test-output" />
<property name="srcdir" location="src" />
<property name="libdir" location="lib" />
<property name="full-compile" value="true" />
<property name="basedir" value="D:/workspace/auto_test/" />
<path id="classpath.test">
<fileset dir="${libdir}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${testoutputdir}" />
<pathelement location="${srcdir}" />
</path>
<target name="clean">
<delete dir="${basedir}/bin" />
</target>
<target name="compile" depends="clean">
<mkdir dir="${basedir}/bin" />
<javac srcdir="${srcdir}" encoding="UTF-8" destdir="${basedir}/bin" verbose="${full-compile}" classpathref="classpath.test" includeantruntime="off" debug="on" debuglevel="lines,vars,source" />
</target>
<path id="classes">
<fileset dir="${libdir}" includes="*jar"/>
<fileset dir="${libdir}" includes="*zip"/>
<pathelement location="${basedir}/bin/"/>
</path>
<!--如果testng里面没有配置reportng监听器,则使用这个方式,如果testng里面配置了 reportng监听器,那么就使用这个配置
<target name="runtest" depends="compile">
<testng outputdir="${testoutputdir}" classpathref="classes"
useDefaultListeners="false"
delegateCommandSystemProperties="true" haltOnFailure="true"
listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter,org.testng.reporters.FailedReporter">
<sysproperty key="file.encoding" value="UTF-8" />
<xmlfileset dir="${basedir}" includes="testng.xml" />
</testng>
</target>-->
<!--如果testng里面配置了 reportng监听器,那么就使用这个配置-->
<target name="runtest" depends="compile">
<!---->
<testng outputdir="${testoutputdir}" classpathref="classes"
useDefaultListeners="false" >
<sysproperty key="file.encoding" value="UTF-8" />
<xmlfileset dir="${basedir}" includes="testng.xml" />
</testng>
</target>
<target name="testoutput" depends="runtest">
<java classname="com.offcn.TestUnti.Mail" classpath="${basedir}/bin">
<sysproperty key="file.encoding" value="UTF-8" />
<classpath>
<pathelement location="lib/javax.mail.jar" />
</classpath>
</java>
<!--
ui自动化测试报告部分
<xslt in="${testoutputdir}/testng-results.xml" style="${testoutputdir}/testng-results.xsl" out="${testoutputdir}/index.html ">
<param name="testNgXslt.outputDir" expression="${basedir}/testoutput/" />
<classpath refid="classpath.test" />
</xslt>
-->
</target>
</project>
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment