java集成测试_java – maven没有运行集成测试方法

我使用dockerfile-maven插件在我的docker容器和maven-failsafe-plugin中移动jar文件来启动我的集成测试.但maven从未运行集成测试方法.下面是我的pom.xml

org.apache.maven.plugins

maven-surefire-plugin

2.20.1

**/*IntegrationTestIT.java

integration-test

test

integration-test

none

**/*IntegrationTestIT.java

org.apache.maven.plugins

maven-failsafe-plugin

2.12

integration-test

**/*.java

com.spotify

dockerfile-maven-plugin

1.3.7

default

build

push

rohitbarnwal7/presto_log_updated

${project.version}

plugin-${project.version}-jar-with-dependencies.jar

我已将Integration测试类命名为IntegrationTestIT.java,并按照this来集成dockerfile maven插件.

我一直坚持这个问题,任何帮助都将受到高度赞赏.

更新1:

添加我的IntegrationTestIT.java文件.在这里,我尝试连接presto并运行查询以检查它们是否已记录到文件中.(Maven项目是一个presto插件,它可以记录在presto服务器上运行的所有presto查询.)

import java.sql.Connection;

import java.sql.DriverManager;

import java.sql.Statement;

import java.sql.SQLException;

import java.sql.ResultSet;

import java.io.IOException;

import java.io.File;

import java.util.Scanner;

// import static org.hamcrest.CoreMatchers.*;

import static org.hamcrest.MatcherAssert.*;

import static org.junit.matchers.JUnitMatchers.*;

import io.prestodb.tempto.query.QueryExecutor;

import static io.prestodb.tempto.context.ThreadLocalTestContextHolder.testContext;

import io.prestodb.tempto.AfterTestWithContext;

import io.prestodb.tempto.BeforeTestWithContext;

import org.junit.Assert.*;

import com.facebook.presto.jdbc.PrestoDriver;

import io.airlift.log.Logger;

import org.testng.annotations.*;

class IntegrationTestIT{

@Test

void checkForQueryInFile() {

System.out.println("This test method should be run");

String url = "jdbc:presto://sandbox:8080/jmx/default";

Statement stmt = null;

try {

Connection connection = DriverManager.getConnection(url, "jumbo", null);

stmt = connection.createStatement();

String file_path = "";

String sql_string = "show schemas";

ResultSet rs = stmt.executeQuery(sql_string);

File folder = new File("//jars");

// Move this to constant class

File[] files = folder.listFiles();

for (File file:files) {

if (file.isFile()) {

file_path = file.getAbsolutePath();

}

}

File log_file = new File(file_path);

final String scanner = new Scanner(log_file).useDelimiter("\\Z").next();;

assertThat(scanner, containsString(sql_string));

rs.close();

stmt.close();

connection.close();

} catch (IOException exception) {

exception.printStackTrace();

} catch(SQLException sqlException) {

sqlException.printStackTrace();

}

}

}

更新2:

这是来自控制台的maven测试报告.

[INFO]已成功构建rohitbarnwal7 / presto_log_updated:0.0.1

[INFO] — maven-surefire-plugin:2.20.1:test(integration-test)@plugin

[INFO] T E S T S.

[INFO]运行IntegrationTestIT

[INFO]测试运行:0,失败:0,错误:0,跳过:0,已过去时间:0.804秒 – 在IntegrationTestIT中

[INFO]结果:

[INFO]测试运行:0,失败:0,错误:0,跳过:0

[INFO] — maven-failsafe-plugin:2.12:integration-test(默认)@plugin —

[INFO]故障安全报告目录:/ Users / rohit / workspace / work / presto-plugins / target / failsafe-reports

T E S T S.

运行IntegrationTestIT

配置TestNG:org.apache.maven.surefire.testng.conf.TestNGMapConfigurator@7960847b

测试运行:0,失败:0,错误:0,跳过:0,经过时间:0.469秒

结果:

测试运行:0,失败:0,错误:0,跳过:0

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值