2012-07-27 4 views
1

여기서 설명하는대로 속성 파일에서 속성을로드하려고합니다. http://www.soapui.org/Scripting-Properties/working-with-properties.html. testrunner.sh를 사용하여 테스트를 실행합니다. ./testrunner.sh -PServiceEndPoint=${serviceendpointvalue} sample_soapuitest.xml과 같은 작업을하고 싶지만 작동하지 않습니다.속성 파일의 soapui acessing 속성

serviceendpointvalue는 properties.txt에 정의되어 있습니다. testrunner.sh에서 JAVA_OPTS를 수정하여 properties.txt를 포함 시켰습니다.

누군가 이것을 시도한 적이 있습니까? 어떤 수제?

답변

2

testrunner.sh로 전달 된 매개 변수는 파일에서 속성을로드하기 전에 정의해야한다고 생각합니다.

다른 방법으로 원하는 것을 성취 할 수 있는지 99 % 확신합니다.

요청에있는 끝점을 매개 변수화하십시오. 이것이 많은 작업 인 경우 검색을 사용하여 텍스트 편집기에서 바꾸는 것이 좋습니다. 전에 해봤는데 효과가있었습니다.

요청에서 엔드 포인트에 대해 원하는 것은 SOAP를 사용하는지 또는 사용 중인지에 따라 달라집니다 (예 : WSDL/WADL/XSD 참조 등). 휴식.

For SOAP: ${#Project#endpoint} 
(assuming that your endpoint property is a project property) 

For REST: http://${#Project#server} 
나는 그것이 왜 달라야 하는지를 잊어 버렸지 만, 알아 내야하는 고통이었습니다. 당신은 파일을 사용하여 이러한 속성을 설정할 수 있습니다

SOAP: http://server:8080 
REST: server:8080 
(whatever port is relevant) 

: 같은 속성 필드에

는, 데이터가 보일 것이다. 실행이 시작되면 파일이 구문 분석되고 요청은 파일의 속성 값을 사용합니다. 당신은 아직도 내가 언급 한 방법을 사용할 수 있습니다 07/30/12

편집.

이 명령 줄은 test.props 파일을 지정하여 샘플 테스트를 실행합니다. 그 파일은 단지이 있습니다

시험은 1234 내 프로젝트가 test라는 프로젝트 속성이 1234

ndfdXML 이외의 다른 값으로 설정 한

(가 수출 특성에 의한 출력)이다 = 내 프로젝트 이름 .. 샘플 이름.

명령 행 :

C : \ 프로그램 파일 \ SmartBear \ soapUI-4.5.1 \ 빈> testrunner.bat -Dsoapui.properties.ndfdXML = test.props ndfdXML-soapui-있는 project.xml

soapUI 4.5.1 TestCase Runner 
Configuring log4j from [C:\Program Files\SmartBear\soapUI-4.5.1\bin\soapui-log4j.xml] 
14:32:29,283 INFO [DefaultSoapUICore] initialized soapui-settings from  [C:\Users\chris.mead\soapui-settings.xml] 
14:32:30,081 INFO [WsdlProject] Loaded project from [file:/C:/Program%20Files/SmartBear/soapUI-4.5.1/bin/ndfdXML-soapui-project.xml] 
14:32:30,089 INFO [AbstractTestPropertyHolderWsdlModelItem] Overriding 1 properties from [test.props] in [ndfdXML] 
14:32:30,702 INFO [SoapUITestCaseRunner] Running soapUI tests in project [ndfdXML] 
14:32:30,717 INFO [SoapUITestCaseRunner] Running Project [ndfdXML], runType = SEQUENTIAL 
14:32:30,718 INFO [SoapUITestCaseRunner] Running soapUI testcase [TestCase 1] 
14:32:30,718 INFO [SoapUITestCaseRunner] running step [CornerPoints - Request 1] 
14:32:31,132 WARN [AbstractSoapVersion] Ignoring validation error: error: cvc-complex- type.3.2.2: Attribute not allowed: [email protected]://schemas.xmlsoap.o 
rg/soap/envelope/ in element [email protected]://schemas.xmlsoap.org/soap/envelope/ 
14:32:31,449 INFO [SoapUITestCaseRunner] Assertion [SOAP Response] has status VALID 
14:32:31,450 INFO [SoapUITestCaseRunner] Assertion [XPath Match] has status VALID 
14:32:31,450 INFO [SoapUITestCaseRunner] running step [Properties] 
14:32:31,454 INFO [SoapUITestCaseRunner] running step [Property Transfer] 
14:32:31,523 INFO [SoapUITestCaseRunner] running step [Groovy Script] 
14:32:31,912 INFO [log] 1234 

마지막 줄은이 groovy에서 출력합니다.

log.info (context.expand ('$ {# Project # test}'))

+0

답장을 보내 주셔서 감사합니다. testrunner.sh를 사용할 때 -PServiceEndpoint = value를 사용하여 속성을 설정할 수 있다는 것을 알고 있습니다. 내 문제는 내가 설정할 수있는 많은 속성이 있습니다. 그래서 대신 속성 파일을 사용하고 싶습니다. – user1164061

+0

그래도이 작업을 수행 할 수 있습니다. 내 업데이 트를 참조하십시오. – chrismead

+0

도움 주셔서 감사합니다! – user1164061

1

설명서의 예는 다소 불완전합니다. Java System Properties의 값을 다음과 같이 강제 변환 할 수 있습니다.

systemProperty = context.expand('${=System.getProperty("soapui.home")}') 
testRunner.testCase.setPropertyValue("systemProperty", systemProperty) 
log.info("systemProperty="+testRunner.testCase.getPropertyValue("systemProperty"))