2014-07-18 3 views
3

간단한 UI 테스트를 위해 어설 션 조건을 생성 할 수 없기 때문에 SOAP UI를 시작하면서 놀랐습니다. 나는 다음과 같은 XPath 식을 사용하고SOAP UI의 테스트 케이스에서 노드를 가져 오는 중 오류가 발생했습니다. XPATH

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> 
    <soap:Body> 
     <GetCityWeatherByZIPResponse xmlns="http://ws.cdyne.com/WeatherWS/"> 
     <GetCityWeatherByZIPResult> 
      <Success>false</Success> 
      <ResponseText>City could not be found in our weather data. Please contact CDYNE for more Details.</ResponseText> 
      <State/> 
      <City/> 
      <WeatherStationCity/> 
      <WeatherID>-1</WeatherID> 
      <Description/> 
      <Temperature/> 
      <RelativeHumidity/> 
      <Wind/> 
      <Pressure/> 
      <Visibility/> 
      <WindChill/> 
      <Remarks/> 
     </GetCityWeatherByZIPResult> 
     </GetCityWeatherByZIPResponse> 
    </soap:Body> 
</soap:Envelope> 

: 나는 다음과 같은 SOAP 메시지 테스트 할 XPATH 방법을 사용하고

declare namespace i='http://www.w3.org/2001/XMLSchema-instance'; 
//i:GetCityWeatherByZIPResult[1]/i:Success[1] 

을이 오류입니다 :

XPathContains assertion failed for path [declare namespace i='http://www.w3.org/2001/XMLSchema-instance'; 
//i:GetCityWeatherByZIPResult[1]/i:Success[1]] : Exception:Missing content for xpath [declare namespace i='http://www.w3.org/2001/XMLSchema-instance'; 
//i:GetCityWeatherByZIPResult[1]/i:Success[1]] in Response 

답변

8

SoapUI에서 정의 된 네임 스페이스를 사용하면 XPath 어설 션이 불필요하게 작업을 복잡하게 만들고 어떤 경우에는 완전히 작동하지 않습니다. XPath에 대해서만 //*:GetCityWeatherByZIPResult/*:Success으로 시작하고 필요에 따라 거기서 작업하십시오.

+0

작동했습니다! 고마워요. – carlosgmercado

+0

나중에 데이터 혼란에 빠지기 위해서'Get Data'에서 길고 복잡한 네임 스페이스 선언을 권유 한 SoapUI가 너무 싫어요. 이것은 효과가있다. –

관련 문제