Forum Discussion

harinadha's avatar
harinadha
Occasional Contributor
8 years ago
Solved

Any thought on how to set Authentication type to Basic over the run programmatically

I have a following code to create to create Basic profile for specific test step, 

 

def testStep= testRunner.getTestCase().getTestStepByName("RunTimeOperation")
testStep.getTestRequest().addBasicAuthenticationProfile("Basic")
testStep.getTestRequest().setUsername(strUserName)
testStep.getTestRequest().setPassword(strPwd)
testStep.getTestRequest().setDomain(strDomain)
testStep.getTestRequest().setPreemptive(true)

 

However request sent to server with Authorization - No Authorization. any thoughts on how to select the Authorization : Basic using groovy?

  • Thank you for the response. and i have resolved the issue by adding the following code.

     

    testStep.getTestRequest().setSelectedAuthProfileAndAuthType(AbstractHttpRequest.BASIC_AUTH_PROFILE,CredentialsConfig.AuthType.PREEMPTIVE)

     

    and it is the same as you mentioned above.

2 Replies

    • harinadha's avatar
      harinadha
      Occasional Contributor

      Thank you for the response. and i have resolved the issue by adding the following code.

       

      testStep.getTestRequest().setSelectedAuthProfileAndAuthType(AbstractHttpRequest.BASIC_AUTH_PROFILE,CredentialsConfig.AuthType.PREEMPTIVE)

       

      and it is the same as you mentioned above.