Forum Discussion

ruhirm's avatar
ruhirm
Occasional Contributor
7 months ago

2 TestSuites with diff auth/jwt clientID/secret. How do I configure it in Event handler?

Hi,

I have 2 TestSuites and each uses diff auth/jwt (clientID/secret). How do I configure it in Event handler - RequestFilter.filterRequest to use depending on TestSuite name?

 

I tried this but it does not work - 

def get_testsuitename = context.testCase.testSuite.name
log.info(get_testsuitename)

 

if get_testsuitename == "TestSuite1"{

def CLIENT_ID = "aaa";
def SECRET = "bbb";

}

else if 

get_testsuitename == "TestSuite2"{

def CLIENT_ID = "cc";
def SECRET = "ddd";

}

Then I tried using TestSuiteRunListener.beforeRun but no luck 😞

Any help would be appreciated!

Thanks

2 Replies

  • Hello ruhirm 

     

    Is it a requirement that you need to use 'Events' mechanism to control those variables?

     

    It seems like the 'Custom Test Suite Properties' feature attached to each test suite would be a more appropriate location to store test suite specific values.  The reference code in each test case could just use the property expansion to consume the variables.

     

    Regards,

    Todd

    • ruhirm's avatar
      ruhirm
      Occasional Contributor

      Hi Todd,

      Thanks for your reply. I think it is a specific req. we have our own .jar files that we use.  

      I tried to add the same auth code in TestSuite Setup Script but it doesnt work. I get 'Failed JWT' error.