wiremock

CODING DevOps 系列第五课:微服务测试——微服务下展开体系化的微服务测试

﹥>﹥吖頭↗ 提交于 2020-08-12 00:16:57
微服务测试的痛点与挑战 这张图可以形象地展示单体服务和微服务的对比,单体应用就像左边巨大的集装箱,软件模块和应用都包括其中;而微服务就像是由一个小集装箱组成,微小的服务组成一个庞大、完整的系统。单体服务是一个大而全的应用体,而微服务由拆分成出来的很多小服务来组成一个庞大而完整的系统。 微服务是一种架构模式,是面向服务型架构 SOA 的一种变体,提倡将单一应用程序逐渐还原划分成小的服务,服务间互相协调、互相配合,为用户提供最终价值。微服务架构风格就是一些小而自治的服务协同工作形成松耦合的系统。另外,我们需要尽量避免一个统一的、集中式的服务管理机制,对具体的一个服务而言,应该根据上下文选择合适的语言工具对其进行构建。 结合下方的这张图,我们可以理解微服务构建的核心其实是中间领域的业务逻辑,围绕着这个领域业务逻辑,会有一些微服务去进行拆分构建。 微服务具有专注、自治、独立进程、独立部署和技术异构的特点,即每个服务只限定于特定的业务而专注做一件事情,每个服务承担的是单一职责,但是它也需要达到一定规模能够完整的处理特定的领域业务。很多人都会被微服务的“微”这个词所误导,认为微服务就是要拆分的越小越好。但是其实为了“微”而将同一领域的业务拆分到不同的服务,只会徒劳增加软件的复杂度和维护困难。 我们可以围绕应用的业务能力进行分组,每个小组的开发组人员开发微服务的技术可以不受限制

How to enable HTTPS for standalone Wiremock

。_饼干妹妹 提交于 2020-04-29 09:48:56
问题 Overview: I used wiremock standalone 2.1.11 and did the following to enable HTTPS URL for my request but to no avail: Studying the doc http://wiremock.org/docs/running-standalone/ Adding --https-port but nothing happened Adding keystore but again no progress The command for running the wiremock is as follows: java -jar wiremock-standalone-2.1.11.jar --port 8920 --https-port 8921 --https-keystore /home/wiremock/keystore/clientkeystore --verbose Note: I can connect via http port correctly Now I

Unit Testing - Wiremock verify failing with connection error

孤者浪人 提交于 2020-04-14 05:05:10
问题 I'm testing a spring-boot application and using wiremock stubs to mock external API. In one test case I want to make sure that my stub gets called exactly once but it's failing with connection error. My Test File: @SpringBootTest @AutoConfigureWebTestClient @ActiveProfiles("test") class ControllerTest { @Autowired private lateinit var webClient: WebTestClient private lateinit var wireMockServer: WireMockServer @BeforeEach fun setup() { wireMockServer = WireMockServer(8081) wireMockServer

Spring-Boot WireMock Server - Request was not matched error

旧城冷巷雨未停 提交于 2020-01-25 10:21:07
问题 We are running WireMock on Spring-boot with its embedded Tomcat 9, I am able to stub the request using WM if the stub request/response are available in mappings/__files directory respectively. The issue is when trying to query the list of available stubs using http://localhost:8080/__admin/mappings we get the below error. ERROR 19332 --- [ultThreadPool-1] WireMock : Request was not matched ======================= --------------------------------------------------------------------------------

Using WireMock with SOAP Web Services in Java

为君一笑 提交于 2020-01-09 18:23:42
问题 I am totally new to WireMock. Until now, I have been using mock responses using SOAPUI. My use case is simple: Just firing SOAP XML requests to different endpoints (http://localhost:9001/endpoint1) and getting canned XML response back. But MockWrire has to be deployed as a standalone service onto a dedicated server which will act a central location from where mock responses will be served. Just wanted some starting suggestions. As I can see WireMock is more suitable towards REST web services.

Can I specify a --proxy-all parameter to WireMock to match any web site when recording?

我是研究僧i 提交于 2020-01-04 04:20:07
问题 I am building a proxy service to record and play responses from the web using WireMock. I have recently discovered that these two modes are separate, so am attempting to build a small set of Docker containers to run these services in parallel. Briefly, my plan is to set up one WireMock for recording, and then have another instance (on a different port) for playback. I'll periodically copy the mappings from one to the other on a cron, and then send the reset API call to the playback instance

Tomakehurst Wiremock. Tries to connect to 8080. Connection refused

痴心易碎 提交于 2019-12-25 01:25:55
问题 @Test void resourceTo_Wired_ClientCall() { wireMockServer = new WireMockServer(options().port(10021)); wireMockServer.start(); final MappingBuilder stubBuilder = get(urlMatching("http://demo1096495.mockable.io/client1")); stubFor(stubBuilder .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json") .withBody("{\"something\":\"test-wired\"}"))); ; Got error: org.apache.http.conn.HttpHostConnectException: Connect to localhost:8080 [localhost/127.0.0.1] failed:

Wiremock not matching regex

本秂侑毒 提交于 2019-12-24 17:53:21
问题 I'm using wiremock to mock certain requests and their respective response, but I'm trying to add a regex. Unfortunately, this just throws an exception stating that the request was not matched. { "request" : { "method": "GET", "urlPattern": "/my/service/url?^.*(specificParam.*(M[0-9]{9})).*$" }, "response": { ... } } I also tried it with "urlPattern": "/my/service/url\\?^.*(specificParam.*(M[0-9]{9})).*$" The request I'm sending is /my/service/url?saml2=disabled&filter=specificParam%20eq%20