Conversation
|
What is your suggestion to invite new contributions to use JUnit 5 rather than 4? |
src/core/src/test/java/org/apache/jmeter/threads/TestUnmodifiableJMeterVariables.java
Outdated
Show resolved
Hide resolved
|
I prefer Spock, because I find it often more expressive and convenient (e.g. accessing private methods). |
which is a code smell anyway, isn't it? |
It looks like my intention was not well understood. The current build script allows writing new tests with JUnit4 style. |
Correct; most of the code here hasn't been TDD'd and it feels too much effort for such large restructuring of code so the smells go away? |
How about a check somewhere, checkstyle?, for |
Codecov Report
@@ Coverage Diff @@
## master #524 +/- ##
============================================
- Coverage 56.16% 56.15% -0.02%
+ Complexity 10017 10014 -3
============================================
Files 1024 1024
Lines 62913 62918 +5
Branches 7064 7064
============================================
- Hits 35337 35333 -4
- Misses 25101 25108 +7
- Partials 2475 2477 +2
Continue to review full report at Codecov.
|
Tests that peek onto the implementation details might become hard to maintain.
I'm about to add https://github.com/apiguardian-team/apiguardian so we could do things like |
checkstyle is bad because its messages are not actionable. I suggest two options: |
True, however based on my experience so far, you can only (easily) auto-correct Test/Before/After etc. Assertions and Rules etc. require more complexity.
I'm not sure I like the idea of yet more libraries and code, I think I prefer adding the simple cases to Spotless so it can correct the majority but also some documentation somewhere obvious... |
This PR contains such cases, when simple package update was enough.
I don't suggest to implement a tool that automatically converts any JUnit4 code to JUnit5. |
|
It looks like this PR reduces the code coverage. @ham1 , have you analyzed why is that? |
I had a quick look but I don't understand because there isn't and hasn't been a unit test for it before. |
|
Wasn't it covered through integration tests ? |
@pmouawad , I've added @ham1 , could you try adding the same |
|
Ah, now I know why I disabled the test in Too many threads? Even running |
|
@ham1 , can you please rebase and verify if |
Ignored -> Disabled. @test(expected ...) -> Assertions.assertThrows(...) A few Assert -> Assertions. Removed error collector. Some whitespace.
Also some formatting and simplification of throws.
|
Works for me now 😄 |
| @BeforeEach | ||
| public void setup(@TempDir Path keystoreDir) throws IOException { | ||
| keystore = keystoreDir.resolve("dummy-keystore.jks").toFile(); | ||
| password = JOrphanUtils.generateRandomAlphanumericPassword(32); |
There was a problem hiding this comment.
There was a problem hiding this comment.
I don't remember this change, given its single thread and still has static fields, it doesn't look a required change.
There was a problem hiding this comment.
What might have happened is some global find/replace broke this but I fixed it incorrectly and didn't notice it.
* org.junit.Test/Before/After -> ...jupiter.api.Test/BeforeEach/AfterEach Ignored -> Disabled. @test(expected ...) -> Assertions.assertThrows(...) A few Assert -> Assertions. Removed error collector. Some whitespace. * Added method for repeated code * TestStringtoFile: Migrated to JUnit5 * BasicCurlParserTest: Migrated to JUnit 5 * ParseCurlCommandActionTest: JUnit 5 + tidy ParseCurlCommandAction * ResourcesDownloader: Formatting and guard clause * ParseCurlCommandActionTest: Use TmpDir only where required. Also some formatting and simplification of throws.
Ignored->Disabled.@Test(expected ...)->Assertions.assertThrows(...)Assert->Assertions