Git Product home page Git Product logo

Comments (10)

nymanjens avatar nymanjens commented on April 28, 2024

Can you replicate this issue in a minimal example and share that example, please?

from testparameterinjector.

bearxc avatar bearxc commented on April 28, 2024

the test project is running against our internal spring context /bean app , it is very hard to have a simple example.

we found 3-4 mins increase for first test method in Junit test xml , does testparameterinjector overwrite the way calculating test execution time ?

from testparameterinjector.

nymanjens avatar nymanjens commented on April 28, 2024

does testparameterinjector overwrite the way calculating test execution time ?

Not that I know

from testparameterinjector.

bearxc avatar bearxc commented on April 28, 2024

we add time stamp on before/after method , execution time is not different , but execution time from junit report has increased a lot .

from testparameterinjector.

bearxc avatar bearxc commented on April 28, 2024

I take a quick look on PluggableTestRunner ,
getTestMethodProcessors().postProcessTestInstance(testInstance, testInfo);

I think this method would take a longer time to process at the first time , considering there are multiple inherence in test class , and each test class have spring beans such as
@Autowired
private TestA testa;
......
@Autowired
private TestB testb;

It would be slow at beginning when going through on parent classes from java reflection .

from testparameterinjector.

nymanjens avatar nymanjens commented on April 28, 2024

What would you suggest to fix this?

from testparameterinjector.

bearxc avatar bearxc commented on April 28, 2024

Maybe we could exclude parsing /scan effort as part of test case execution itself , that cause confusion .

Also , it looks like PluggableTestRunner is running postProcessTestInstance/scan on every test method which is ver heavy.

Not sure how JUnitParamsRunner handle this .

from testparameterinjector.

bearxc avatar bearxc commented on April 28, 2024

One more suggestion is maybe we need move parse/scan out of methodBlock , otherwise Junit treats that as part of method execution time.

Ideally , we need parse/scan/inject before test class start .

from testparameterinjector.

nymanjens avatar nymanjens commented on April 28, 2024

So if I understand you correctly, this is more about the confusing timings reported by JUnit than it is about the actual slowness?

I do wonder why it is so slow for you though. Do you have many test methods? I'd think that the @Autowired stuff gets done after the TestParameterInjector stuff. It would really be helpful if you have a minimal test that you can share that reproduces this issue, so that I can investigate where all the time is being spent. There is definitely a lot of work that's happening multiple times that could be cached if the need arises.

About the time reporting: I had a look at JUnitParamsRunner, and they seem to be interfacing with JUnit in a completely different way, and it's a bit hard to see which one is best.

If you have a proof of concept of what we could do differently, I'm happy to run it against all Google tests and see if it works.

from testparameterinjector.

bearxc avatar bearxc commented on April 28, 2024

yes, you are right , sorry for confusion , that is not slowness actually , I changed title just now .

Our test classes are inherence from many layers, each layer is spring context with huge @Autowired , there are around 10000 test class/context need to be initialized, it takes 3-4 mins , we compared between JUnitParamsRunner and testparameterinjector , that initialization time is same , only difference is , JUnitParamsRunner trigger initialization before test class start while for testparameterinjector , it happens after test class start .

I think JUnitParamsRunner handle different way as yours for sure .

We will take a look and ping you back once we have good solution .

Thanks for help and support !!!

from testparameterinjector.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.