ingwarsw / arquillian-suite-extension

Arquillian extension that will force single deployment for all tests
Apache License 2.0
67 stars 20 forks source link

Doesn't work with arquillian-persistence-dbunit #15

Closed perabello closed 10 years ago

perabello commented 10 years ago

Hello,

I use Persistence and DBUnit extension to set (on arquillian.xml) defaultDataSource, defaultDataSeedStrategy, datatypeFactory, defaultDataSetLocation, etc. I do not find how to configure it integrated with ArquillianSuiteExtension. I use @UsingDataSet annotation to bind data before test from xml. I have a diferent xml for each test class or method. But when tests can not find values inserted on BBDD from xml. It seems that properties like "datatypeFactory" are not uset. How I configure persistence dbunit properties? Could I set a @UsingDataSet annotation for every test method?

Thanks Pere

PeterProbst commented 10 years ago

Hello Pere, for getting datasets to work you have to additionally annotate the deployment methods in the suite class with @UsingDataSet. So the dataset annotation have to be there twice, one in your test class and a second on deployment method. Peter

perabello commented 10 years ago

Ok. With your instructions it runs. I was setting @UsingDataSet only in one class. Now I have a big dataset xml. Could I use diferents xml with the same deployment (one xml for each test class)?

perabello commented 10 years ago

I found it!!! All xml files must be defined on deployment class, and then it can be used on every class. Thanks Pere

perabello commented 10 years ago

I have problems with defaultTransactionMode configuration. It does not run and I must to set the annotation on every test. I seems a dependencies versions problems (http://stackoverflow.com/questions/20662548/rollback-transaction-for-arquillian-testing-getting-nullpointerexception), but I can not resolve it.

Furthermore, I can test a delete no tables with a relationship. I have table A that is related to table B. When I delete a register from A, I validate that not exists related registers on B. My test is: managerB.delete(regB); managerA.delete(regA); It fails deleting A, because the validation still finds regB. And it runs when I have a deployment for every test class.

ingwarsw commented 10 years ago

Could you try preparing simple test project on witch i could test it?

ingwarsw commented 10 years ago

Did you tried http://stackoverflow.com/a/24952911/3083920 ?

perabello commented 10 years ago

Yes, I have already copied that link in my comment. But forget it. I try again without arquillian-suite-extension and it still fails.

Now I am trying to prepare a simple project on which you could test the second problem. I think that I will can upload it this afternoon.

m-aslam commented 10 years ago

I have encountered same issue, I just started using 'arquillian-suite-extension' extension. @UsingDataSet annotation is not working. I have tried the solution you said above @PeterProbst but not working :(

perabello commented 10 years ago

You must set the annotation on Deployment method (with a list of all files used on test) and then on every test method. Example

m-aslam commented 10 years ago

I am using @UsingDataSet("abc.yml"); yaml data set. and it's not working.

m-aslam commented 10 years ago

Hey it's working now :+1: Cheers !

m-aslam commented 10 years ago

Don't close the issue, It yet exist in some cases. For example; I have two test classes

@suitDeployment public void mainDeployment(){

// my deployments methods upto 4 in my case

// here @usingDataSet is working // test methods }

public void AnotherTestClass{

// here is this class @UsingDataSet is not working. //test mothods

}

Note: Ignore some of my type errors.