citrusframework / citrus

Framework for automated integration tests with focus on messaging integration
https://citrusframework.org
Apache License 2.0
457 stars 134 forks source link

Document also JUnit theories not only TestNG DataProviders please #165

Closed Ernesto-Maserati-CH closed 6 years ago

Ernesto-Maserati-CH commented 7 years ago

I want to make a suggestion to the Citrus documentation.

For TestNG DataProviders are mentioned in "7. Run". Nothing like that is mentioned for JUnit, although the same can be done with JUnit's Theories which many people don't know.

See an example: http://www.jitblog.net/junit-theory-tests/

There is also a way with the @Parameters annotation: https://github.com/junit-team/junit4/wiki/parameterized-tests

Maybe you can add that to the documentation? Minimum would be to just mention it.

christophd commented 7 years ago

I believe this is more than just documentation issue. I think we need to add some additional glue code in order to enable the JUnit Parameters in Citrus tests. Did you manage to have a running Citrus test with JUnit Parameters enabled out-of-the-box?

Ernesto-Maserati-CH commented 7 years ago

You are right, I should provide something. But I am now not so sure if Theories and Parameters of JUnit 4 are compatible with Citrus. Perhaps it isn't. I tried it with Parameters a few weeks ago, not sure if I remember it correctly, I think the Parameter-Runner threw an Exception because it refused to pass a Citrus runner and resource as test paramters, and I did not find a working workaround for it. Theories are as far as I know not exactly comparable to TestNG's test data provider feature.

It would be worth investigating if data driven tests can be made to work with JUnit 5 and Citrus, since version 4 will be quickly becoming out of date. If there is a problem, it would be time to influence the design of JUnit 5. I will take a look into it when I find time.

I saw a real test code base with JUnit and Citrus which suffers that there is no such support for data driven tests, lots of test code duplications because of that.

christophd commented 6 years ago

JUnit5 integration with Citrus is done. You can use data driven approach with JUnit5 and Citrus then.