Webx3接口测试七步曲-第二步

发表于:2010-8-02 14:44

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:晓峰    来源:Taobao QA Team

分享:
  然后在此工程的pom.xml文件里添加iTest的相关依赖:
<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/maven-v4_0_0.xsd”>    <modelVersion>4.0.0</modelVersion>    <groupId>com.taobao.marketing</groupId>
    <artifactId>marketing-web-test</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>marketing-web-test</name>
    <description>测试子工程</description>
    <parent>
        <groupId>com.taobao.marketing</groupId>
        <artifactId>marketing-test-all</artifactId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <dependencies>
        <!– Webx3的itest依赖 –>
        <dependency>
            <groupId>com.taobao.test</groupId>
            <artifactId>itest-webx3</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>test</scope>
        </dependency>
        <!– HSF的单元测试依赖 –>
        <dependency>
             <groupId>com.taobao.hsf</groupId>
             <artifactId>hsf.unit</artifactId>
             <version>1.0.1</version>
             <scope>test</scope>
         </dependency>
         <!–  解决开发版本过低的问题 –>
         <dependency>
             <groupId>com.taobao.hsf</groupId>
             <artifactId>hsf.notify.spring</artifactId>
             <version>1.4.4</version>
        </dependency>
        <dependency>
             <groupId>com.taobao.notify</groupId>
             <artifactId>notify-utils</artifactId>
             <version>1.5.3</version>
        </dependency>
        <!–  依赖被测试的Web工程 –>
        <dependency>
            <groupId>com.taobao.marketing</groupId>
            <artifactId>marketing-web</artifactId>
            <version>1.0-SNAPSHOT</version>
            <type>war</type>
        </dependency>
        <dependency>
             <groupId>com.taobao.marketing</groupId>
             <artifactId>marketing-web</artifactId>
             <version>1.0-SNAPSHOT</version>
             <type>warpath</type>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.appfuse.plugins</groupId>
                <artifactId>maven-warpath-plugin</artifactId>
                <version>2.1.0-M1</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <goals>
                            <goal>add-classes</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

  以上pom.xml文件有以下几点需要注意:
  a) 添加Webx3的itest依赖:itest-webx3
  b) 添加HSF的单元测试依赖:hsf.unit
  c) 解决开发依赖包版本过低问题:hsf.notify.spring与notify-utils
  开发版本可能都是1.4.3,我们需要分别升级到1.4.4与1.5.3。
  像这种开发依赖包版本过低问题,都可以通过在测试工程里增加高版本的依赖包解决。
  d) 我们需要增加maven-warpath-plugin的插件,因为开发web工程是打成war包的,war包不像jar包那样,我们可以引用到jar包里面的xml等配置文件,但是war包引用不到,所以,我们测试子工程也必须打为war包,并通过warpath插件来将开发web工程里的配置文件也打入到测试工程的war包里面,如果测试工程已经有跟开发web工程的同名文件,以测试工程里的文件为准。
  至此,测试工程建立完毕,在marketing-test-all目录下运行”mvn eclipse:eclipse –DdownloadSources=true”生成eclipse工程文件,然后将测试工程也导入到Eclipse中。
  现在我们第二步已经结束了,同样如果熟悉这一步的同学,可以跳过,直接到第三步。
相关链接:
Webx3接口测试七步曲-第一步
Webx3接口测试七步曲-第三、第四步
Webx3接口测试七步曲-第五步
Webx3接口测试七步曲-第六步
Webx3接口测试七步曲-第七步
22/2<12
重磅发布,2022软件测试行业现状调查报告~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计

法律顾问:上海漕溪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2023
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号