基于Ant+Selenium+TestNG的测试框架配置
2013-09-17 16:01
417 查看
<?xml version="1.0" encoding="UTF-8"?>
<!--This xml file build for Ant,default task "test" executed-->
<project default="run-test">
<property name="Framework-src" value="./src" />
<property name="bin" value="./bin" />
<property name="lib" value="./lib" />
<property name="outputs" value="./report" />
<property name="conf" value="./config" />
<!--Set path-->
<path id="cp">
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${bin}"/>
</path>
<path id="cp.jar">
<fileset dir="${lib}" includes="*.jar"/>
</path>
<!--Compile all resource java file into class file-->
<target name="Compile">
<javac srcdir="${Framework-src}" destdir="${bin}"
classpathref="cp" />
</target>
<!--Define testng task-->
<taskdef name="testngtest" classpathref="cp"
classname="org.testng.TestNGAntTask" />
<!--Define testng target-->
<target name="run_testNG">
<testngtest classpathref="cp"
useDefaultListeners="true"
outputDir="${outputs}">
<!--You can add one or more testcase xml here-->
<xmlfileset dir="${bin}" includes="testng.xml"/>
</testngtest>
</target>
<!--使用生成Excel报告-->
<target name="StartTest">
<delete dir="${outputs}"/>
<copy todir="${outputs}">
<fileset file="${conf}/Report-Template.xls"/>
</copy>
<rename src="${outputs}/Report-Template.xls" dest="${outputs}/Report.xls"/>
<java classname ="jd.main.RunTest" classpathref="cp" />
</target>
<!--使用testng-results.xls美化报告-->
<!--depends="run_testNG"-->
<target name= "transform">
<copy todir="${outputs}">
<fileset file="${conf}/testng-results.xsl"/>
</copy>
<xslt in= "${outputs}/testng-results.xml" style= "${outputs}/testng-results.xsl" out= "${outputs}/index1.html">
<!-- you need to specify the directory here again -->
<classpath refid= "cp.jar" />
<param name="testNgXslt.outputDir" expression="${basedir}/report"/>
<param name="testNgXslt.showRuntimeTotals" expression="true"/>
</xslt>
</target>
<!-- Run Test -->
<target name="run-test" description="Compile;Run TestNG;">
<parallel>
<sequential>
<antcall target="Compile"></antcall>
<antcall target="StartTest"></antcall>
<!-- <antcall target="run_testNG"></antcall>-->
<antcall target="transform"></antcall>
</sequential>
</parallel>
</target>
</project>
<!--This xml file build for Ant,default task "test" executed-->
<project default="run-test">
<property name="Framework-src" value="./src" />
<property name="bin" value="./bin" />
<property name="lib" value="./lib" />
<property name="outputs" value="./report" />
<property name="conf" value="./config" />
<!--Set path-->
<path id="cp">
<fileset dir="${lib}">
<include name="**/*.jar"/>
</fileset>
<pathelement location="${bin}"/>
</path>
<path id="cp.jar">
<fileset dir="${lib}" includes="*.jar"/>
</path>
<!--Compile all resource java file into class file-->
<target name="Compile">
<javac srcdir="${Framework-src}" destdir="${bin}"
classpathref="cp" />
</target>
<!--Define testng task-->
<taskdef name="testngtest" classpathref="cp"
classname="org.testng.TestNGAntTask" />
<!--Define testng target-->
<target name="run_testNG">
<testngtest classpathref="cp"
useDefaultListeners="true"
outputDir="${outputs}">
<!--You can add one or more testcase xml here-->
<xmlfileset dir="${bin}" includes="testng.xml"/>
</testngtest>
</target>
<!--使用生成Excel报告-->
<target name="StartTest">
<delete dir="${outputs}"/>
<copy todir="${outputs}">
<fileset file="${conf}/Report-Template.xls"/>
</copy>
<rename src="${outputs}/Report-Template.xls" dest="${outputs}/Report.xls"/>
<java classname ="jd.main.RunTest" classpathref="cp" />
</target>
<!--使用testng-results.xls美化报告-->
<!--depends="run_testNG"-->
<target name= "transform">
<copy todir="${outputs}">
<fileset file="${conf}/testng-results.xsl"/>
</copy>
<xslt in= "${outputs}/testng-results.xml" style= "${outputs}/testng-results.xsl" out= "${outputs}/index1.html">
<!-- you need to specify the directory here again -->
<classpath refid= "cp.jar" />
<param name="testNgXslt.outputDir" expression="${basedir}/report"/>
<param name="testNgXslt.showRuntimeTotals" expression="true"/>
</xslt>
</target>
<!-- Run Test -->
<target name="run-test" description="Compile;Run TestNG;">
<parallel>
<sequential>
<antcall target="Compile"></antcall>
<antcall target="StartTest"></antcall>
<!-- <antcall target="run_testNG"></antcall>-->
<antcall target="transform"></antcall>
</sequential>
</parallel>
</target>
</project>
相关文章推荐
- selenium+ant+testng测试框架简单介绍
- 基于maven+testng的selenium测试框架搭建
- jenkins、ant、selenium、testng搭建自动化测试框架
- selenium+testng+reprotng+ant框架搭建配置
- 设计自己的基于Selenium 的自动化测试框架-Java版(1) - 为什么selenium还需要测试框架?
- selenium+java+testNG+pageObject深入理解自动化测试框架
- ant+testng-xslt生成selenium测试报告
- 基于Selenium2和TestNG的自动化测试
- 基于python的接口测试框架设计(二)配置一些参数及文件
- Dagger学习之一步一步搭建简单的自动化测试平台(Selenium+TestNG+Ant+Jenkins)
- 【自动化测试与持续集成】基于Selenium2和TestNG的自动化测试的实现
- 设计自己的基于Selenium 的自动化测试框架-Java版(1) - 为什么selenium还需要测试框架?
- selenium+testng+reprotng+ant配置
- Java+Selenium3框架设计准备篇6-TestNG执行测试方法依赖关系
- 基于RFS(robot framework selenium)框架模拟POST/GET请求执行自动化接口测试
- 基于Selenium2和TestNG的自动化测试
- 基于TestNG使用PowerMock的Mockito扩展在Maven测试项目中的配置说明
- Java+Selenium3框架设计准备篇2-TestNG通过变量实现启动不同浏览器测试
- 基于Selenium2和TestNG的自动化测试
- 基于testNg的测试框架设计(二)---使用ant运行testNg