[英]Maven tomcat7 deploy integration tests failure
我正在使用Spring Tool Suite 3.5.1開發Spring Roo 1.2.5項目。 我使用EclipseLink(JPA)生成實體(沒有Active Record),服務(實現和接口)以及主要使用這些命令的簡單控制器:
數據庫逆向工程師--schema ssigdl --package~.domain --repository --testAutomatically
service all --interfacePackage~.service --classPackage~.service.impl
web mvc設置
controller類--class~.web.CustomPageController --preferredMapping / custompage
然后我嘗試使用maven來部署這個目標:
當進程到達測試的一部分時,會發生這些錯誤
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.
如果我在“運行配置”窗口中設置了“ 跳過測試 ”復選框,則編譯過程將成功完成。 我的問題是:
更新
這是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.