You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Thomas Lustig <tm...@gmail.com> on 2018/03/24 10:58:20 UTC
Is it possible to use Junit for Deltaspike Data Module Repository testing?
Dear community,
I really like using the Deltaspikes Datamodule with its Repositories.
To improve in productivity and lower the Errors i am also writing Unittests
via JUnit.
Before i used DBUnit with Plain JPA/Hibernate inside the testcases, but i
would like
to test my deltaspike JPA repositories via JUnit - or maybe enhanced with
DBUnit.
Are there any best practises or ways how to do this?
I found some integration project that combines dbunit with Deltaspike, but
i was not able to getit running with Hibernate JPA Provider.
https://github.com/lbitonti/deltaspike-dbunit
Thanking you very much in advance for any help
Br Tom
Re: Is it possible to use Junit for Deltaspike Data Module Repository testing?
Posted by Luís Alves <lu...@gmail.com>.
Hi Thomas,
I'm using database rider (https://github.com/database-rider/database-rider)
with DS CdiTestRunner. Something like this:
*@RunWith(CdiTestRunner.class)@DBUnitInterceptor*
public class ConfigurationRepositoryTest
{
* @Inject*
private ConfigurationRepository configurationRepository;
*@Test*
* @DataSet(value = "yml/configuration-repository-base.yml")*
public void configurationFindAll()
{
assertNotNull(configurationRepository);
assertThat(configurationRepository.findAll(), hasSize(2));
}
...
I run against an H2 database.
For the service layer I prefer to use Mockito test runner.
Regards,
LA
On Sat, Mar 24, 2018 at 11:26 AM, Gerhard Petracek <gp...@apache.org>
wrote:
> hi tom,
>
> just create junit/cdi-tests with the help of [1].
>
> regards,
> gerhard
>
> [1] http://deltaspike.apache.org/documentation/test-control.html
>
>
>
> 2018-03-24 11:58 GMT+01:00 Thomas Lustig <tm...@gmail.com>:
>
> > Dear community,
> >
> > I really like using the Deltaspikes Datamodule with its Repositories.
> > To improve in productivity and lower the Errors i am also writing
> Unittests
> > via JUnit.
> > Before i used DBUnit with Plain JPA/Hibernate inside the testcases, but i
> > would like
> > to test my deltaspike JPA repositories via JUnit - or maybe enhanced with
> > DBUnit.
> > Are there any best practises or ways how to do this?
> > I found some integration project that combines dbunit with Deltaspike,
> but
> > i was not able to getit running with Hibernate JPA Provider.
> >
> > https://github.com/lbitonti/deltaspike-dbunit
> >
> > Thanking you very much in advance for any help
> >
> > Br Tom
> >
>
Re: Is it possible to use Junit for Deltaspike Data Module Repository testing?
Posted by Gerhard Petracek <gp...@apache.org>.
hi tom,
just create junit/cdi-tests with the help of [1].
regards,
gerhard
[1] http://deltaspike.apache.org/documentation/test-control.html
2018-03-24 11:58 GMT+01:00 Thomas Lustig <tm...@gmail.com>:
> Dear community,
>
> I really like using the Deltaspikes Datamodule with its Repositories.
> To improve in productivity and lower the Errors i am also writing Unittests
> via JUnit.
> Before i used DBUnit with Plain JPA/Hibernate inside the testcases, but i
> would like
> to test my deltaspike JPA repositories via JUnit - or maybe enhanced with
> DBUnit.
> Are there any best practises or ways how to do this?
> I found some integration project that combines dbunit with Deltaspike, but
> i was not able to getit running with Hibernate JPA Provider.
>
> https://github.com/lbitonti/deltaspike-dbunit
>
> Thanking you very much in advance for any help
>
> Br Tom
>