httpclient+maven+excel+testng 框架实例----02 之配置pom文件
本文为简单的 接口自动化请求框架,其中包含get 和 post方法,方法的封装,@parameters 和@DataProvider的传参,读取自定义配置文件及配置log4j.properties等内容。
参考资料:https://blog.csdn.net/u011541946/article/category/7680864
1.pom 文件配置
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>httpclient</groupId>
<artifactId>httpclient</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<!-- 指明编译源代码时使用的字符编码,maven编译的时候默认使用的GBK编码,
通过project.build.sourceEncoding属性设置字符编码,告诉maven这个项目使用UTF-8来编译 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!--这里可以设置需要运行group-->
<groupsTest>execShell</groupsTest>
</properties>
<dependencies>
<!--tesgng依赖包-->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.13</version>
</dependency>
<!--poi创建和读取office文档-->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<!--Java 的HTML解析器,可直接解析某个URL地址、HTML文本内容-->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient-cache</artifactId>
<version>4.5.2</version>
</dependency>
<dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpmime</artifactId> <version>4.5.2</version> </dependency> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpcore</artifactId> <version>4.4.9</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> <version>1.2.47</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.2</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.2</version> </dependency> <!--java中建立sftp服务连接所需的jar包--> <dependency> <groupId>com.jcraft</groupId> <artifactId>jsch</artifactId> <version>0.1.54</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.38</version> </dependency> <!--下面几个引用包是我们手动下载并添加的依赖--> <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> <version>1.8.0</version> <scope>system</scope> <systemPath>${basedir}/json/commons-beanutils-1.8.0.jar</systemPath> </dependency> <dependency> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> <version>3.2.1</version> <scope>system</scope> <systemPath>${basedir}/json/commons-collections-3.2.1.jar</systemPath> </dependency> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.5</version> <scope>system</scope> <systemPath>${basedir}/json/commons-lang-2.5.jar</systemPath> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.1.1</version> <scope>system</scope> <systemPath>${basedir}/json/commons-logging-1.1.1.jar</systemPath> </dependency> <dependency> <groupId>ezmorph</groupId> <artifactId>ezmorph</artifactId> <version>1.0.6</version> <scope>system</scope> <systemPath>${basedir}/json/ezmorph-1.0.6.jar</systemPath> </dependency> <dependency> <groupId>json-lib</groupId> <artifactId>json-lib</artifactId> <version>2.4</version> <scope>system</scope> <systemPath>${basedir}/json/json-lib-2.4-jdk15.jar</systemPath> </dependency> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20140107</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.19.1</version> <configuration> <threadCount>1</threadCount> <forkCount>1</forkCount> <reuseForks>true</reuseForks> <argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine> <forkMode>once</forkMode> <argLine>-Dfile.encoding=UTF-8</argLine> <groups>${groupsTest}</groups> <includes> <include>**/*Test.java</include> </includes> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18.1</version> <configuration> <suiteXmlFiles> <suiteXmlFile>testng.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin> </plugins> </build></project>
posted on 2018-06-05 16:45 chenzx0918 阅读(665) 评论(1) 编辑 收藏 举报