我正在尝试使用 pact jvm 对消费者驱动程序合同测试进行测试,并能够生成消费者端合同文件。在提供者端验证期间,如何提供公共 API 而不是 localhost 大多数示例仅使用 localhost 作为提供者,请提供任何帮助
@RunWith(PactRunner.class) // Say JUnit to run tests with custom Runner
@Provider("WeatherProvider") // Set up name of tested provider
@PactFolder("D:\Workspace\pactConsumer\pactConsumer_v2\pacts") // Point where to find pacts (See also section Pacts source in documentation)
@VerificationReports(value = {"markdown","json"}, reportDir = "D:\Workspace\pactConsumer\pactConsumer_v2\target")
public class ProviderVerifyer {
@State("Weather information is available for Chennai") // Method will be run before testing interactions that require "with-data" state
public void getWeather() {
System.out.println("Weather information is available for Chennai" );
}
@TestTarget // Annotation denotes Target that will be used for tests
public final Target target = new HttpTarget(8114); // Out-of-the-box implementation of Target (for more information take a look at Test Target section)
}