cancel
Showing results for 
Search instead for 
Did you mean: 

In funkload, is it possible to do set up variables in setUpCycle() and have it accessible in the test itself?

ians_
Champ in-the-making
Champ in-the-making

I'm trying to write some performance tests in funkload. I would like to do some service discovery in the test setUpCycle() and then have that information passed to every thread the benchmark starts. However setting a variable in the setUpCycle() or setupBench() does not propagate to the test itself. Is there any way to do this?

class PerfTest(FunkLoadTestCase):
  def setUpCycle(self):
    self.service = service_discover() # this is a costly operation

  def test_Get(self):
    print self.service

Running fl-run-bench on this test fails with "'PerfTest' has no attribute 'service'.

1 REPLY 1

ben_
Confirmed Champ
Confirmed Champ

Hi, yes this is correct, setUpBench and setUpCycle are called with a private instance of the testcase.

If you need to share data between the running threads you can put your data in a file during the setUpCycle and read the file from the setUp method.

Thanks for your feedback, I will update the docs to make this clear.

ben

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.