Web services 以编程方式进行SoapUI web服务身份验证
我正在使用SOAPUIAPI编写SOAPWeb服务测试。我正在使用SoapUITestCaseRunner来实现这一点。 我的代码看起来像Web services 以编程方式进行SoapUI web服务身份验证,web-services,junit,soapui,Web Services,Junit,Soapui,我正在使用SOAPUIAPI编写SOAPWeb服务测试。我正在使用SoapUITestCaseRunner来实现这一点。 我的代码看起来像 public class MyRunner extends SoapUITestCaseRunner{ public void runTest(){ setProjectFile("pro_file_path"); setEndpoint("endpoint"); setUsername("username");
public class MyRunner extends SoapUITestCaseRunner{
public void runTest(){
setProjectFile("pro_file_path");
setEndpoint("endpoint");
setUsername("username");
setPassword("password");
setTestSuite("testSuiteName");
setTestCase("TestCaseName");
run();
}
}
public class MyTestClass(){
@Test
public void test(){
new MyRunner().runTest();
}
}
但是用户名和密码作为属性传递,我可以在junit失败日志中看到它们。
服务部说我是401未经授权的?我遗漏了什么吗?需要做些什么来传递用户名和密码吗
我得到了答案。问题在于我用来创建project.xml文件的SoapUI版本。如果我们使用低于5.0.0的版本创建项目,并在编写junit时使用5.0.0,它将无法工作。 实际上,SoapUI ahs似乎对5.0.0中的身份验证部分进行了更改,该部分几乎没有NTML这样的选项。因此,我们必须在project.xml中配置身份验证类型,并在project.xml中预先配置或通过junit手动发送用户名和密码