[arquillian-issues] [JBoss JIRA] (ARQ-1883) Arquillian Persistence Extension: Cucumber integration

Rafael Pestano (JIRA) issues at jboss.org
Fri May 1 00:00:48 EDT 2015


    [ https://issues.jboss.org/browse/ARQ-1883?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13064550#comment-13064550 ] 

Rafael Pestano commented on ARQ-1883:
-------------------------------------

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/cdi/crud/test/CrudBdd.java

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/cdi/crud/test/CrudPersistenceBdd.java
[Atlassian|http://atlassian.com]
We have one cucumber feature (you can [see it here|https://github.com/rmpestano/cdi-crud/blob/cdi-crud-it/src/test/resources/features/search-cars.feature]) 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/test/resources/arquillian.xml#L43] 

*The second scenario:* 

In this scenario database is not being feed by persistence extension, see image below:

!http://s13.postimg.org/5nf85tx93/cucumber_persistence_01.png!

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)


More information about the arquillian-issues mailing list