1
私はサービスを模擬するためにCitrus静的応答アダプタを使用しています。テストケースごとにペイロードの値を変更する必要があります。理想的には、各テストケースの辞書の使い方を考えます。私の現在のシナリオのサンプルがあります:Citrus静的応答アダプタ応答テンプレートの辞書を適用することは可能ですか?
@Autowired
@Qualifier("checkRegistrationEndpointAdapter")
public StaticResponseEndpointAdapter checkRegistrationEndpointAdapter;
protected void setAdapterResponse(StaticResponseEndpointAdapter adapter, String filenamepath){
URL url = this.getClass().getResource(filenamepath);
String payload = null;
try {
payload = Resources.toString(url, Charsets.UTF_8);
} catch (IOException e) {
e.printStackTrace();
}
adapter.setMessagePayload(payload);
}
@CitrusTest
public void TestCase02() throws IOException {
http()
.client(CLIENT)
.post()
.payload(new ClassPathResource("templates/thisStartRequestMsg.xml", getClass()))
.dictionary("TC02");
http()
.client(CLIENT)
.response()
.messageType("xml")
.payload(new ClassPathResource("templates/thisStartResponseMsg.xml", getClass()));
action(new AbstractTestAction() {
@Override
public void doExecute(TestContext testContext) {
setAdapterResponse(checkRegistrationEndpointAdapter, "templates/check-registration-v1CheckRegistrationResponseMsg.xml");
}
});
http()
.client(CLIENT)
.response()
.messageType("xml")
.payload(new ClassPathResource("templates/check-registration-v1CheckRegistrationRequestMsg.xml", getClass()))
.dictionary("TC02");
}
どのように私は私のsetAdapterResponse方法で設定したペイロードに辞書を適用することができますか? 注:この質問は、Can I use Citrus variable in Citrus static response adapter payload?
お返事ありがとうございます。私は静的レスポンスアダプターを試しました。私はその時にhttps://github.com/christophd/citrus-samples/issues/10に答えなかったからです。 –