我正在使用sql plugin执行一个简单的DB测试用例。
首先,我正在将2行数据插入到表中(注意:在此之前,我正在手动截断表)。
然后,我运行一个select查询,以检查是否插入了这2行。
为了检查是否插入了这2行,我使用sql plugin的属性在文件中获取查询结果。
但是在运行maven之后,会创建输出文件,但它不包含任何数据。大小为0 KB。
请建议我哪里出错了,或者使用maven-sql-plugin在文件中获取查询输出的任何其他方法。
提前谢谢
在下面添加了我的pom.xml的执行标记:
<execution>
<id>insert-data</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<autocommit>true</autocommit>
<srcFiles>
<srcFile>insert-in-usage.sql</srcFile>
</srcFiles>
</configuration>
</execution>
<execution>
<id>select-data</id>
<phase>process-test-resources</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<sqlCommand>select distinct decode(count(*),2,'PASS','FAIL') as results from usage where version='3';</sqlCommand>
<outputFile>result.xls</outputFile>
</configuration>
</execution>
</executions>发布于 2017-06-16 12:38:25
对于像我这样几年后来到这里的新用户:您必须添加参数
<printResultSet>true</printResultSet>在配置中。根据文档的说法,它从1.3版开始就可以使用了。
https://stackoverflow.com/questions/43922091
复制相似问题