Forum Discussion

chron90's avatar
chron90
Occasional Visitor
9 days ago

LoadTestContext is sometimes null in ReadyAPI Performance

When running performance tests and setting e.g. context.variableName in the setup script, then reading it in a functional test case that is being executed as a performance test scenario (context.LoadTestContext['variableName']), sometimes everything works correctly, other times LoadTestContext is empty.

I have tried adding some sleep time in the functional  test case and/or rearranging things, but it doesn't seem to help. Still, in some runs it is there, in others it isn't.

Could there be any reason for this or is it just a bug in multiple ReadyAPI versions?

1 Reply

  • Humashankar's avatar
    Humashankar
    Champion Level 0

    Hi chron90 

    Dealing with a null LoadTestContext in ReadyAPI Performance can be challenging, especially when it exhibits unpredictable behavior.

    To get to the bottom of the issue, let's examine the LoadTestContext feature.

    Basically, LoadTestContext is a unique object that enables data sharing between the setup script and functional test cases, but only within the scope of a performance test scenario executed through ReadyAPI Performance

    There are few main reasons you may encounter a null LoadTestContext

    • Make sure the setup script that sets the variable (context.variableName = value) is running within the same scenario where you're trying to access it (context.LoadTestContext['variableName']).
    • Also, double-check that the functional test case using LoadTestContext is indeed part of the same performance test scenario
    • Sometimes, timing inconsistencies can occur, causing the functional test case to run before the setup script has finished setting the variable. Even if introducing a delay might seem like a quick fix, it's not a recommended solution as it can compromise the accuracy and reliability of performance test results

    Hope this helps - Happy to help further!!
    Thank you very much and have a great one!
    Warm regards