You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test Smell: it is not a good test practice to use the loop in the test #1038
We notice that you use the loop structure in your test cases.
For example, testQualityScoresIntArray() in FastqToolsTest.java
However, using the loop in test cases is not a good test practice.
We analyzed the relevant Stack Overflow posts and summarized four potential negatives it brings:
Loops make the test case more complex
In most cases, a loop can be replaced with a data-driven test that is more readable.
Loops break the assert-for-one-thing thumb rule. I don't mean a single assert statement.
When a test fails, knowing the reason is more complicated.
Solution:
To avoid using the loop in the test, JUnit provides an annotation (i.e., @ParameteredTest), enabling a test case to run multiple times with different parameters.
We provide a usage example here:
@josemduarte I would like to work on this. We are using Junit4 is there any chance to migrate Junit5. So this type of test case are easy to write in Junit5
I've created two merge requests for the genome module:
this one #1125 includes migration to junit5 only for the FastqToolsTest.java
And this one #1126 migrates all genome module tests to junit5
MRs can be reviewed separately or we can merge only the last one because it includes all changes
Activity
josemduarte commentedon Aug 26, 2022
Good point, thanks! Would you be able to provide a pull request?
tmrpavan commentedon Apr 26, 2023
@josemduarte I would like to work on this. We are using Junit4 is there any chance to migrate Junit5. So this type of test case are easy to write in Junit5
josemduarte commentedon Apr 26, 2023
Yes we have in fact converted some tests to junit5 and the agreement is that new tests should be junit5.
tmrpavan commentedon Apr 27, 2023
can you assign this issue to me. I will work on this
arkanar611 commentedon May 27, 2026
I've created two merge requests for the genome module:
this one #1125 includes migration to junit5 only for the FastqToolsTest.java
And this one #1126 migrates all genome module tests to junit5
MRs can be reviewed separately or we can merge only the last one because it includes all changes