Grails 2.3.8 应用程序集成测试失败
Grails 2.3.8 application integration test fails
我开始编写一个简单的 grails 应用程序。到目前为止,我只有几个域 类,没有其他人工制品。昨天我 运行 进行了唯一一次集成测试,并且通过了。今天,当我 运行 它时,我得到了这个输出:
2015-04-23 11:07:37,000 [main] ERROR hbm2ddl.SchemaUpdate - Unsuccessful: create table or
der (id bigint generated by default as identity, version bigint not null, customer_id bigi
nt not null, date_created timestamp not null, total float not null, primary key (id))
Error |
2015-04-23 11:07:37,002 [main] ERROR hbm2ddl.SchemaUpdate - Syntax error in SQL statement
"CREATE TABLE ORDER[*] (ID BIGINT GENERATED BY DEFAULT AS IDENTITY, VERSION BIGINT NOT NU
LL, CUSTOMER_ID BIGINT NOT NULL, DATE_CREATED TIMESTAMP NOT NULL, TOTAL FLOAT NOT NULL, PR
IMARY KEY (ID)) "; expected "identifier"; SQL statement:
create table order (id bigint generated by default as identity, version bigint not null, c
ustomer_id bigint not null, date_created timestamp not null, total float not null, primary
key (id)) [42001-173]
Error |
2015-04-23 11:07:37,004 [main] ERROR hbm2ddl.SchemaUpdate - Unsuccessful: alter table ord
er add constraint FK651874E6A961CB1 foreign key (customer_id) references customer
Error |
2015-04-23 11:07:37,004 [main] ERROR hbm2ddl.SchemaUpdate - Syntax error in SQL statement
"ALTER TABLE ORDER[*] ADD CONSTRAINT FK651874E6A961CB1 FOREIGN KEY (CUSTOMER_ID) REFERENC
ES CUSTOMER "; expected "identifier"; SQL statement:
alter table order add constraint FK651874E6A961CB1 foreign key (customer_id) references cu
stomer [42001-173]
Error |
2015-04-23 11:07:37,005 [main] ERROR hbm2ddl.SchemaUpdate - Unsuccessful: alter table ord
er_item add constraint FK2D110D6455275AA3 foreign key (order_id) references order
Error |
2015-04-23 11:07:37,005 [main] ERROR hbm2ddl.SchemaUpdate - Syntax error in SQL statement
"ALTER TABLE ORDER_ITEM ADD CONSTRAINT FK2D110D6455275AA3 FOREIGN KEY (ORDER_ID) REFERENC
ES ORDER[*] "; expected "identifier"; SQL statement:
alter table order_item add constraint FK2D110D6455275AA3 foreign key (order_id) references
order [42001-173]
.......
|Compiling 1 source files
..
|Tests PASSED - view reports in C:\Users
当我打开 HTML 测试结果页面时,它说没有执行任何测试。我什至试过 grails clean-all
。此时我的项目才刚刚开始,所以我可以轻松地创建一个新的应用程序并将我的代码复制到该应用程序中,但我很想知道这个应用程序有什么问题。昨天这个测试 运行 很好并通过了,我所做的只是关闭我的 IDE 并在今天重新启动它。我什至关闭了 ide 并尝试从命令提示符 运行 进行测试,结果同样糟糕。
如果有人想看代码,请 here
在测试环境下 DataSource.groovy
中将 dbCreate = "update"
修改为 dbCreate = "create-drop"
(准确地说是 here)应该可以解决这个问题。
基本上它会在测试之间重新创建数据库,这将是测试期间更干净的方法。
我开始编写一个简单的 grails 应用程序。到目前为止,我只有几个域 类,没有其他人工制品。昨天我 运行 进行了唯一一次集成测试,并且通过了。今天,当我 运行 它时,我得到了这个输出:
2015-04-23 11:07:37,000 [main] ERROR hbm2ddl.SchemaUpdate - Unsuccessful: create table or
der (id bigint generated by default as identity, version bigint not null, customer_id bigi
nt not null, date_created timestamp not null, total float not null, primary key (id))
Error |
2015-04-23 11:07:37,002 [main] ERROR hbm2ddl.SchemaUpdate - Syntax error in SQL statement
"CREATE TABLE ORDER[*] (ID BIGINT GENERATED BY DEFAULT AS IDENTITY, VERSION BIGINT NOT NU
LL, CUSTOMER_ID BIGINT NOT NULL, DATE_CREATED TIMESTAMP NOT NULL, TOTAL FLOAT NOT NULL, PR
IMARY KEY (ID)) "; expected "identifier"; SQL statement:
create table order (id bigint generated by default as identity, version bigint not null, c
ustomer_id bigint not null, date_created timestamp not null, total float not null, primary
key (id)) [42001-173]
Error |
2015-04-23 11:07:37,004 [main] ERROR hbm2ddl.SchemaUpdate - Unsuccessful: alter table ord
er add constraint FK651874E6A961CB1 foreign key (customer_id) references customer
Error |
2015-04-23 11:07:37,004 [main] ERROR hbm2ddl.SchemaUpdate - Syntax error in SQL statement
"ALTER TABLE ORDER[*] ADD CONSTRAINT FK651874E6A961CB1 FOREIGN KEY (CUSTOMER_ID) REFERENC
ES CUSTOMER "; expected "identifier"; SQL statement:
alter table order add constraint FK651874E6A961CB1 foreign key (customer_id) references cu
stomer [42001-173]
Error |
2015-04-23 11:07:37,005 [main] ERROR hbm2ddl.SchemaUpdate - Unsuccessful: alter table ord
er_item add constraint FK2D110D6455275AA3 foreign key (order_id) references order
Error |
2015-04-23 11:07:37,005 [main] ERROR hbm2ddl.SchemaUpdate - Syntax error in SQL statement
"ALTER TABLE ORDER_ITEM ADD CONSTRAINT FK2D110D6455275AA3 FOREIGN KEY (ORDER_ID) REFERENC
ES ORDER[*] "; expected "identifier"; SQL statement:
alter table order_item add constraint FK2D110D6455275AA3 foreign key (order_id) references
order [42001-173]
.......
|Compiling 1 source files
..
|Tests PASSED - view reports in C:\Users
当我打开 HTML 测试结果页面时,它说没有执行任何测试。我什至试过 grails clean-all
。此时我的项目才刚刚开始,所以我可以轻松地创建一个新的应用程序并将我的代码复制到该应用程序中,但我很想知道这个应用程序有什么问题。昨天这个测试 运行 很好并通过了,我所做的只是关闭我的 IDE 并在今天重新启动它。我什至关闭了 ide 并尝试从命令提示符 运行 进行测试,结果同样糟糕。
如果有人想看代码,请 here
在测试环境下 DataSource.groovy
中将 dbCreate = "update"
修改为 dbCreate = "create-drop"
(准确地说是 here)应该可以解决这个问题。
基本上它会在测试之间重新创建数据库,这将是测试期间更干净的方法。