shivadorepally / junitparams

Automatically exported from code.google.com/p/junitparams
0 stars 0 forks source link

Be lenient when no params #11

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I use environment vars to figure out what params to return.

In some cases there will be no params returned.
Instead of failing with 
"Tests in error: 
  initializationError(com.mypackage.ParameterizedSoapUiTest): No parameters found, even though the method is defined as Prameterised. There aren't any params in the annotation, there's no test class method providing the params and no external provider..."

I think the framework should just print a warning and return as there are no 
tests to execute.

Actually I used junit Assumptions 
(http://junit.sourceforge.net/javadoc/org/junit/Assume.html) in my @Before 
method - but that doesn't seem to be called when using junitparams

Original issue reported on code.google.com by davidkar...@gmail.com on 13 Oct 2011 at 4:06

GoogleCodeExporter commented 8 years ago
Could you give an example?
I don't think that printing a warning is good enough - I wouldn't like to miss 
this kind of issue, and it could be easy to miss if tests are executed in a CI.

Original comment by lipinski...@gmail.com on 17 Nov 2011 at 10:33

GoogleCodeExporter commented 8 years ago
Create a parameterized method and return an empty array.
That's fully legal - and one would wish for it in certain situations (we don't 
always wanna run all tests - it depends on the environment).

When writing the parameterized method this is pretty obvious and I don't need 
the framework to blow up. At least make it parameterized to blow up?

Original comment by davidkar...@gmail.com on 17 Nov 2011 at 11:09

GoogleCodeExporter commented 8 years ago
Ok, you're right. It was stupid the way it was.
I've removed the check, now there's an error only if the method is expecting 
params, but there aren't any.
Thanks!

Original comment by lipinski...@gmail.com on 17 Nov 2011 at 3:16

GoogleCodeExporter commented 8 years ago
Great - when will the next release be?

Original comment by davidkar...@gmail.com on 17 Nov 2011 at 3:38

GoogleCodeExporter commented 8 years ago
It's already released. Will be in the central maven repo soon (they say it's 1 
hour, but it never is...) For now you can get it from the Downloads section

Original comment by lipinski...@gmail.com on 17 Nov 2011 at 3:42