繁体   English   中英

Maven tomcat7部署集成测试失败

[英]Maven tomcat7 deploy integration tests failure

我正在使用Spring Tool Suite 3.5.1开发Spring Roo 1.2.5项目。 我使用EclipseLink(JPA)生成实体(没有Active Record),服务(实现和接口)以及主要使用这些命令的简单控制器:

  1. 数据库逆向工程师--schema ssigdl --package~.domain --repository --testAutomatically

  2. service all --interfacePackage~.service --classPackage~.service.impl

  3. web mvc设置

  4. controller类--class~.web.CustomPageController --preferredMapping / custompage

然后我尝试使用maven来部署这个目标:

  • tomcat7:部署

当进程到达测试的一部分时,会发生这些错误

Tests in error: 
  testFindEntries(com.ssigdl.sirc.domain.SsiArticuloIntegrationTest): 
(..)
  testFindAll(com.ssigdl.sirc.domain.SsiArticuloIntegrationTest): 
(..)
  testCount(com.ssigdl.sirc.domain.SsiArticuloIntegrationTest): 
(..)
  testFind(com.ssigdl.sirc.domain.SsiArticuloIntegrationTest): 
(..)
  testSave(com.ssigdl.sirc.domain.SsiArticuloIntegrationTest): 
(..)
  testDelete(com.ssigdl.sirc.domain.SsiArticuloIntegrationTest): 

每个实体创建一个错误块。 最后它出现错误信息:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project sirc: There are test failures.

如果我在“运行配置”窗口中设置了“ 跳过测试 ”复选框,则编译过程将成功完成。 我的问题是:

  1. 为什么集成测试失败了?
  2. 我在spring roo命令中有错吗?
  3. 此错误是否会以某种方式影响我的应用程序?

更新

这是Spring Tool Suite抛出的错误图像

在此输入图像描述

我不能点击点

我按照@mvivo说明操作,发现我有这个错误:

com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'ssigdl.sequence' doesn't exist

在这个链接中,我找到了答案。 基本上,实体具有此注释

@GeneratedValue(strategy = GenerationType.AUTO)

与MySQL结合导致错误,所以我使用了以下注释:

@GeneratedValue(strategy = GenerationType.IDENTITY)

谢谢你的帮助!

要获取有关测试错误的信息,请打开“导航”视图(菜单Windows > Show views > Navigator )并查看target/surefire-reports 在那里你可以找到测试运行的所有输出。

为什么集成测试失败了?

查看com.ssigdl.sirc.domain。* Test *文件。 在那里,您将找到测试执行的所有输出和堆栈跟踪

我在spring roo命令中有错吗?

我不这么认为。 您可能必须自定义测试以进行调整以使其运行。 例如,自定义DOD(按需数据)服务以获取运行测试的连贯数据。

此错误是否会以某种方式影响我的应用程序?

如果问题(正如我想的那样)是测试对数据做错了,那么如果你在服务上以正确的方式处理数据,那么应用程序可以完美地运行。

在我看来,我建议你修复Roo生成的集成测试以使其运行。

认为Roo只生成一个模板用于测试(并且仅用于CRUD和查找操作)您的实体,但是没有办法让它知道数据库表上的应用程序逻辑或特殊规则。 这种事情总是你的责任(有时看起来像魔术,但没有;-))。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM