Forum Discussion

ozsoap's avatar
ozsoap
New Contributor
13 years ago

Use Project Custom Property for an Assertion value?

Is it possible to have for example the following Project Custom Property ${#Project#SLA}, and reference it inside a test step as an SLA assertion value?

Instead of the numeric value for SLA, I typed exactly: ${#Project#SLA}, but it does not work.

Thank you!

4 Replies

  • jazzyekim's avatar
    jazzyekim
    Occasional Contributor
    Yes you can. I always do it in my tests.
    What kind of test step do you have problem with?
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    Just to be sure, you don't have ${#Project#SLA} as the actual project property? The property should just be SLA in the Project properties tab, and then expanded where you want to use it with ${#Project#SLA}.
  • ozsoap's avatar
    ozsoap
    New Contributor
    Here are the steps to reporduce:

    - Create a project custom property called SLA.
    - Create a HTTP test step.
    - Go to Assertions for the test step.
    - Add a new one called SLA with value of 300.
    - Edit the added SLA and replace its value 300 with ${#Project#SLA}.
    - Click on the SLA again and you will see that the value is set incorectly to 300.
  • M_McDonald's avatar
    M_McDonald
    Super Contributor
    Ah, yes that seems to be a bug...

    Here's a workaround. Put this code in the Setup script of the test case or a Groovy script step before the request:

    testRunner.testCase.getTestStepByName('HTTP Test Request').getAssertionByName('Response SLA').setSLA(context.expand('${#Project#SLA}'))