Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timing is wrong for some Nested classes #62

Open
fabriciorby opened this issue Dec 2, 2024 · 0 comments
Open

Timing is wrong for some Nested classes #62

fabriciorby opened this issue Dec 2, 2024 · 0 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@fabriciorby
Copy link
Owner

I did a small analysis on NestedExampleTest output for timing

When running the tests in IntelliJ this was the outcome:
image

As we can see, the times are quite similar to what classResults prints to us. But there is one small catch, let's compare both directly in some kind of a table:

Class Thread.sleep Intellij Output Maven Output
NestedSample (main test class) 1.600 1.630 1.671
NestedSample.Should pass (test) 100 105 114
NestedSample.Should pass2 (test) 500 507 507
NestedSample.InnerTest (class) 900 915 106
NestedSample.InnerTest.Should pass (test) 200 206 205
NestedSample.InnerTest.InnerTest (class) 700 709 932
NestedSample.InnerTest.InnerTest.Should pass (test) 300 304 305
NestedSample.InnerTest.InnerTest.InnerTest (class) 400 405 723
NestedSample.InnerTest.InnerTest.InnerTest.Should pass (test) 400 405 403
NestedSample.FirstInnerTest (class) 100 103 106
NestedSample.FirstInnerTest.ShouldPass (test) 100 103 105

As we can see, IntelliJ prints everything as expected but then the plugin does some weird thing while printing NestedSample.InnerTest (class) timing. But the tests timings are correct (from testResult)

I also noticed that the timing is the same as NestedSample.FirstInnerTest (class) and it could be that something got overwritten so I ran it again, but now changing its Thread.sleep to 600ms

After running the test it's possible to see the assumption was true.

[INFO] ├─ Nested Sample - 2.165 s
[INFO] │  ├─ ✔ Should pass - 0.113 s
[INFO] │  └─ ✔ Should pass2 - 0.507 s
[INFO] ├─ ┬─ Nested Sample Inner Test - 0.604 s
[INFO] │  │  └─ ✔ Inner test should pass - 0.202 s
[INFO] │  └─ ┬─ Nested Sample Inner Test Inner Inner Test - 0.929 s
[INFO] │     │  └─ ✔ Inner Inner Test should pass - 0.304 s
[INFO] │     └─ ┬─ Nested Sample Inner Test Inner Inner Test Inner Inner Inner Test - 0.720 s
[INFO] │        │  └─ ✔ Inner Inner Inner Test should pass - 0.402 s
[INFO] ├─ ── Nested Sample First Inner Test - 0.604 s
[INFO] │     └─ ✔ FirstInnerTest should show up - 0.602 s

As we can see, it's classResults.get(treeLength) points to NestedSample.FirstInnerTest (class), which king of makes sense (?) since they both have the same treeLength. But the output is wrong.

@fabriciorby fabriciorby added bug Something isn't working help wanted Extra attention is needed labels Dec 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant