All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.nishadc.automationtestingframework.testinginterface.soapapi.stepdefinitions.PayloadHandlingSteps Maven / Gradle / Ivy

There is a newer version: 2.2.1
Show newest version
package io.nishadc.automationtestingframework.testinginterface.soapapi.stepdefinitions;

import io.cucumber.java.en.Given;
import io.nishadc.automationtestingframework.filehandling.FlatFileHandling;
import io.nishadc.automationtestingframework.filehandling.exceptions.FlatFileHandlingException;
import io.nishadc.automationtestingframework.testngcustomization.TestFactory;

public class PayloadHandlingSteps {
	private static final String PAYLOAD_FILE_LOCATION="src/test/resources/PayloadTemplates/";
	
	@Given("Payload template is loaded from file {string}")
	public void payload_template_is_loaded_from_file(String payloadFileName) throws FlatFileHandlingException {
	    String payload=FlatFileHandling.getFileContents(PAYLOAD_FILE_LOCATION + payloadFileName);
	    SOAPAPIComponents.setPayload(payload);
	    TestFactory.recordTestStep(String.format("Payload template is loaded from file %s", payloadFileName));
	}
	
	@Given("In Payload template, replace {string} with {string}")
	public void in_payload_template_replace_with(String placeholder, String actualValue) {
		SOAPAPIComponents.setPayload(SOAPAPIComponents.payloads.get().replace(placeholder, actualValue));
		TestFactory.recordTestStep(String.format("In Payload template, replace %s with %s", placeholder, actualValue));
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy