Our work is when nosotros convey several testCases within a testSuite that needs to travel authenticated amongst BASIC. There are three ways equally described here: http://thewonggei.com/2010/08/05/configure-http-basic-auth-once-for-soapui-test-suties/. Method i works, simply method ii as well as three failed for me.
So my workaround is to laid the "Authorization" variable inward the header amongst an encoded username:password value.
Basically what you lot volition come across inward the header is:
Authorization: "BASIC xxx"
Where 30 is equally described above. To encode a username as well as password you lot tin use: https://www.base64encode.org/
import com.eviware.soapui.impl.wsdl.teststeps.* import com.eviware.soapui.support.types.*;  StringToStringMap headers = novel StringToStringMap(); headers.put("Authorization","Basic bWV2ZW8uYWRtaW46bWV2ZW8uYWRtaW4=");  for( testCase inward testSuite.getTestCaseList() ) {  log.info("Setting basic auth for all WSDL exam requests inward exam illustration ["+testCase.getLabel()+"]")  for( testStep inward testCase.getTestStepList() ) {   testStep.getTestRequest().setPreemptive(true);   testStep.getTestRequest().setRequestHeaders(headers);  } } 
0 komentar:
Please comment if there are any that need to be asked.