[
https://issues.jboss.org/browse/ARQ-1883?page=com.atlassian.jira.plugin.s...
]
Rafael Pestano edited comment on ARQ-1883 at 5/1/15 12:05 AM:
--------------------------------------------------------------
Hi there,
I've created a project which you can use to reproduce the problem:
https://github.com/rmpestano/cdi-crud/tree/cdi-crud-it
In this sample project I have a test which calls dbunit api manually and it works fine:
https://github.com/rmpestano/cdi-crud/blob/cdi-crud-it/src/test/java/com/...
and next I have the same tests using arquillian persistence here:
https://github.com/rmpestano/cdi-crud/blob/cdi-crud-it/src/test/java/com/...
We have one cucumber feature (you can [see it
here|https://github.com/rmpestano/cdi-crud/blob/cdi-crud-it/src/test/reso...])
with two scenarios:
*The first scenario:*
{code:java}
@Given("^search car with model \"([^\"]*)\"$")
@UsingDataSet("car.yml")//dataset has car with model = "Ferrari",
@Transactional(TransactionMode.DISABLED)
public void searchCarWithModel(String model) {
assertEquals(4,carService.crud().count());//dataset has 4 cars
Car carExample = new Car().model(model);
carFound = carService.findByExample(carExample);
assertNotNull(carFound); //everything ok with first step
}
@When("^update model to \"([^\"]*)\"$")
@Transactional(TransactionMode.DISABLED)
public void updateModel(String model) {
carFound.model(model);
carService.update(carFound);
}
{code}
here is the error when update method is called:
Caused by: org.hibernate.StaleStateException: Batch update returned unexpected row count
from update [0]; actual row count: 0; expected: 1
[full stacktrace is
here|http://pastebin.com/jbReEjBe].
Looks like database was modified between cucumber steps given|when. In fact when the step
*when* is performed the database is already clean although I set cleanup strategy NONE in
[
arquillian.xml|https://github.com/rmpestano/cdi-crud/blob/cdi-crud-it/src...]
Just let me know if you need any help
was (Author: kwintesencja):
Hi there,
I've created a project which you can use to reproduce the problem:
https://github.com/rmpestano/cdi-crud/tree/cdi-crud-it
In this sample project I have a test which calls dbunit api manually and it works fine:
https://github.com/rmpestano/cdi-crud/blob/cdi-crud-it/src/test/java/com/...
and next I have the same tests using arquillian persistence here:
https://github.com/rmpestano/cdi-crud/blob/cdi-crud-it/src/test/java/com/...
We have one cucumber feature (you can [see it
here|https://github.com/rmpestano/cdi-crud/blob/cdi-crud-it/src/test/reso...])
with two scenarios:
*The first scenario:*
{code:java}
@Given("^search car with model \"([^\"]*)\"$")
@UsingDataSet("car.yml")//dataset has car with model = "Ferrari",
@Transactional(TransactionMode.DISABLED)
public void searchCarWithModel(String model) {
assertEquals(4,carService.crud().count());//dataset has 4 cars
Car carExample = new Car().model(model);
carFound = carService.findByExample(carExample);
assertNotNull(carFound); //everything ok with first step
}
@When("^update model to \"([^\"]*)\"$")
@Transactional(TransactionMode.DISABLED)
public void updateModel(String model) {
carFound.model(model);
carService.update(carFound);//exception is thrown cause
}
{code}
here is the error when update method is called:
Caused by: org.hibernate.StaleStateException: Batch update returned unexpected row count
from update [0]; actual row count: 0; expected: 1
[full stacktrace is
here|http://pastebin.com/jbReEjBe].
Looks like database was modified between cucumber steps given|when. In fact when the step
*when* is performed the database is already clean although I set cleanup strategy NONE in
[
arquillian.xml|https://github.com/rmpestano/cdi-crud/blob/cdi-crud-it/src...]
Just let me know if you need any help
Arquillian Persistence Extension: Cucumber integration
------------------------------------------------------
Key: ARQ-1883
URL:
https://issues.jboss.org/browse/ARQ-1883
Project: Arquillian
Issue Type: Feature Request
Components: Extension - Persistence
Affects Versions: persistence_1.0.0.Alpha7
Reporter: Rafael Pestano
Assignee: Bartosz Majsak
Currently we cannot use persistence extension in a Cucumber test.
Cukespace extension added events that other extensions can observe in order to e.g.: do
something before a step.
see this issue for more details:
https://github.com/cukespace/cukespace/issues/37
Also there this blog post which details the limitations of using both extensions:
http://rpestano.wordpress.com/2014/11/08/arquillian-cucumber-dbunit/
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)