Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jnosql-dev] Tests improvements

Otávio,

To work with JUnit 5 we can create an Extension.

@ExtendWith(JNoSQLExtension.class) 

And before/after each test we can check if is annotated and execute the scripts based on the annotation parameters.

Lucas Furlaneto


Em qui, 7 de jun de 2018 às 09:38, Otávio Gonçalves de Santana <otaviopolianasantana@xxxxxxxxx> escreveu:
Hey Lucas, That would be so useful if we integrate it with JUnit 5 to the TCK.
I like that idea

On Wed, Jun 6, 2018 at 11:58 PM Lucas Furlaneto <lucasfurlaneto.s@xxxxxxxxx> wrote:
Hello guys,

In JNoSQL Drivers, we have to test a lot of things, like inserts, selects, updates and others. When we are testing a select statement we have to insert some records and now a days, we insert with a Template ou Reposity first and then, we test the select/delete feature, but the problem is that the tests are ugly.

For example (Delete with Redis Driver):

@Test

    public void shouldRemoveList() {

        fruits.add(orange);

        fruits.add(banana);

        fruits.add(waterMelon);


        fruits.remove(waterMelon);

        assertThat(fruits, not(contains(waterMelon)));

    }


Now with JNoSQL Aphrodite we can improve ours tests  with an annotation to do something (scripts with queries) before or after the tests. Something like:


@Query(“fruits.jnosql”)

@Test

    public void shouldRemoveList() {

        fruits.remove(waterMelon);

        assertThat(fruits, not(contains(waterMelon)));

    }

For more details, you can see on this issue https://github.com/eclipse/jnosql-diana-driver/issues/88


What do you think?

_______________________________________________
jnosql-dev mailing list
jnosql-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jnosql-dev


--
Otávio Gonçalves de Santana
_______________________________________________
jnosql-dev mailing list
jnosql-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jnosql-dev

Back to the top