Forum Discussion

alibaba82's avatar
alibaba82
Super Contributor
16 years ago

Adding a test request via groovy

Hello,
I have a some groovy function that adds a test request during test execution and then deletes it. My code looks like this

def iface = testRunner.testCase.testSuite.project.getInterfaceByName( "UserProfileServiceSoap12" )
def request = iface.getOperationByName( "VerifyAccount" ).getRequestByName( "Request 1" )
def config = WsdlTestRequestStepFactory.createConfig(request,"VerifyAccount_Temp - Request 1");
def testStep = testRunner.testCase.insertTestStep( config, -1 )
def result = testStep.run(testRunner,context);
testRunner.testCase.removeTestStep(testStep); 


so currently the test steps that gets inserted takes the username/password as specified in the serviceendpoint definition.

I want to be able to specify a different username/password for this test step. can you help me with some groovy code so that the test step has the username/password that I specify and not the one from service endpoints config.

Thanks

Ali

3 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Ali,

    sure.. after inserting the TestStep, you should be able to set these properties with

    testStep.testRequest.username = ...
    testStep.testRequest.password = ...

    works ok?

    regards!

    /Ole
    eviware.com
  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Ali,

    for example

    testStep.testRequest.wssPasswordType = "PasswordText"

    valid values are also "None" and "PasswordDigest".

    regards!

    /Ole
    eviware.com