我正在使用 TESTNG 执行 CITRUS 测试类,同时使用以下 citrus 代码执行正确,并且最后关闭了 spring 容器。
TestNG testng = new TestNG();
List<String> suites = Lists.newArrayList();
suites.add("C:/Users/mounika/citrusrest/CitrusDemoServices/src/test/java/com/citrus/samples/TestSuit.xml");//path to testng xml..
testng.setTestSuites(suites);
testng.run();
测试类执行得很好,但是在将上述代码公开为休息服务时,柑橘弹簧容器没有关闭。通常,在正常运行且最后不暴露于休息服务的情况下,我得到以下日志
18:26:08.459 [Thread-0] INFO
org.springframework.context.support.GenericApplicationContext - Closing
org.springframework.context.support.GenericApplicationContext@6b1274d2:
startup date [Mon Nov 27 18:26:02 IST 2017]; root of context hierarchy
18:26:08.459 [Thread-0] DEBUG
org.springframework.beans.factory.support.DefaultListableBeanFactory -
Returning cached instance of singleton bean 'lifecycleProcessor'
18:26:08.459 [Thread-0] DEBUG
org.springframework.beans.factory.support.DefaultListableBeanFactory -
Destroying singletons in org.springframework.beans.factory.support.
DefaultListableBeanFactory@25d250c6: defining beans
[org.springframework.context.annotation.
internalConfigurationAnnotationProcessor,org.springframework.context.
annotation.internalAutowiredAnnotationProcessor,org.springframework.
context.annotation.internalRequiredAnnotationProcessor,org.
springframework.
context.annotation.internalCommonAnnotationProcessor,
org.springframework.context.event.internalEventListenerProcessor,
org.springframework.context.event.internalEventListenerFactory,
citrusSpringConfig,com.consol.citrus.functions.FunctionConfig,
functionRegistry,citrusFunctionLibrary,
com.consol.citrus.validation.matcher.ValidationMatcherConfig,
validationMatcherRegistry,xmlValidationMatcher,
citrusValidationMatcherLibrary,
com.consol.citrus.validation.MessageValidatorConfig,
defaultXmlMessageValidator,defaultMessageHeaderValidator,
defaultXpathMessageValidator,defaultJsonMessageValidator,
defaultJsonPathMessageValidator,defaultPlaintextMessageValidator,
defaultBinaryBase64MessageValidator,defaultGzipBinaryBase64MessageValidator,
defaultXhtmlMessageValidator,defaultXhtmlXpathMessageValidator,
defaultGroovyXmlMessageValidator,defaultGroovyJsonMessageValidator,
defaultGroovyTextMessageValidator,citrusMessageValidatorRegistry,
testContextFactory,endpointFactory,referenceResolver,
messageConstructionInterceptors,loggingReporter,htmlReporter,
testListeners,testActionListeners,testSuiteListeners,messageListeners,
failureStackTestListener]; root of factory hierarchy
但是,在作为休息服务调用时,由于在第一次休息后没有显示上述日志,在第二次休息中,柑橘也在执行相同的 xml 测试用例。我想为每个 Rest 命中更改测试用例 xml 名称。