Search code examples
javajunitpropertiesannotationscontiperf

JUnit and Contiperf: Properties file to dynamically create contiperf annotation values


I am currently in the middle of some performance testing using contiperf, annotation based performance testing, with JUnit.

I am loading JUnit tests from a properties file and wanted to be able to also load annotations values from these properties file.

I have searched online and cannot find a way to dynamically create annotation values for Contiperf. If anyone knows how to do this, can they point me in the right direction?

Thank you in advance!


Solution

  • I would first check out this link and understand how contiperf works internally:

    It is essentially a JUnit rule that creates its own threadpool based on the extracted annotation values, with each test invocation running on a single thread. It reads these annotation values from the FramworkMethod reference in the apply method.

    A hack to go around this is to understand this link

    Then you change the contiperf rule itself by creating a constructor to the rule taking in your "property values", updating the annotation values of the "Framework method" before it is passed into the PerfTestStatement().

    I hope this small workaround is what you were looking for!