Wiremock UI - Tool for creating mock servers, proxies servers and proxies servers with the option to save the data traffic from an existing API or Site.
DOWNLOAD LINK: https://github.com/juniorgasparotto/WiremockUI/releases/download/1.1.0/WiremockUI.zip
CHOCOLATEY: choco install wiremockui
Is a project done in .NET Framework 4.5
that creates mock servers using the famous Wiremock
(http://wiremock.org).
The tool is completely visual and features of Wiremock have been enhanced:
TreeView
JSON
/ XML
/ HTML
/ JavaScript
/ C#
/ PHP
/ LUA
/VB.NET
Web Request
TreeView
map.Web Request
: Is a simple executor of HTTP calls that can help debugText Compare
: Is a simple text comparerText editor
: Text Editor with formatting options to JSON or XMLJSON Viewer
: JSON Viewer in the form of a tree.Wiremock.exe
DOWNLOAD LINK: https://github.com/juniorgasparotto/WiremockUI/releases/download/1.1.0/WiremockUI.zip
No need for installation
choco install wiremockui
URL: https://chocolatey.org/packages/wiremockui
Update
choco upgrade wiremockui
Uninstalling
choco uninstall wiremockui
choco install dotnet4.5
When creating a new server, a scenario will also be created, you can have more than one scenario for a same server, switching them as needed using the option Set as Default
that exists in the options of the scenarios.
Servers
and clickAdd Server
Server Port
field will be automatically generated, but you can change it at any time.Target URL
field, because the idea is to create a server from scratch. If you want to generate an initial mass with an existing API, use this field and run the server in write mode Start and Record
.Advanced
Add scenario
: Adds a new scenario. Only one scenario may be active at a time.Start
: Starts a server using the physical mappings
folders and data__files
Start (Only Proxy)
: Starts a server just as proxy bypassing the saved files if any.Start and Record
: Starts a server as a proxy in write modeRestart
: Restarts the server while maintaining the kind of execution that was startedStop
: Stop the serverOpen Server folder
: Opens the folder where are all the scenariosOpen Targer URL in browser
: Opens the original URL in the BrowserOpen Server URL in browser
: Open the wiremock server URL in the BrowserDuplicate
: Duplicates the entire server, including the scenarios and all filesEdit
: Edit Server informationRemove
: Removes the serverAdd scenario
Add map
: Adds a new map, this map will be the basics of a map of the wiremock.Set as Default
: Indicates that the files of this scenario will be used when the server is started.Open scenario folder
: Opens the folder that contains the files for this scenarioDuplicate
: Duplicate this scenario and all your filesEdit
: Edit scenarioRemove
: Removes the scenarioShow URL
: When active, displays the URL of tree mapsShow Name
: When active, displays the name of the file in the treeScenario1
.Rename
: Renames the file, when this occurs, the answer file is also renamed and will stay with the same name, but keeping your original extension.Duplicate
: Duplicates this mapRemove
: Removes the mapEnable
: When disabled, this map will be ignoredView in Web Request
: Opens the map in WebRequest
allowing executes it.View in explorer
: Opens the file manager with the selected file.JSON Viewer
tool.View text editor
: Displays the content in a new windowView as Json
: Displays the content in a new window JSON ViewerExpand all
: Opens all the children of the nodeClose all
: Closes all children of the nodeTools -> JSON Viewer
View in explorer
: Opens the file manager with the selected file.To open the text edit options, click with the right side of the mouse over the desired field. The following options are displayed:
Undo
: Undo a changeRedo
: Redo a changeEdit
Word Wrap
: Turn on or off the automatic line breakSelect all
: Select all textCopy
: Copies the selected textCut
: Cut selected textPaste
: Copy what is on the Clipboard to the text fieldRemove
: Removes the selected textFind
: Opens a new window with the search options or text replacement.Json
: JSON formatting options
Format
: Let the JSON in a more readable formEscape
: "Escapes" the JSON so that he can be used as the value of other JSONUnescape
: Back to normal state when JSON this "escaped"Minify
: Remove the unnecessary spaces from JSONEdit value
: This option only appears when a text is selected, it is used to edit (in separate window) a value of an attribute that contains a "JSON escaped".XML
: Has the same options from JSON, however for the XML formatLanguages
: Change the file Highlight
being edited according to the language selected.Tools -> Text Editor
Start
Open the server in the browser
LISTENER
type, NET.IN
and types NET.OUT
are low level calls made by wiremock and that are also displayed here.LISTENER
type, click the Open in WebRequest
option.Tools -> Web Request
LISTENER
type, click the Compare
option.Tools -> Text Compare
NET.IN
type (column RequestTime
) with the NET.OUT
type (column ResponseTime
) of the desired URL. Unfortunately, there is no option needs to get this information, it would be a desire for the next versions of Wiremock (in Java).NET.OUT
type does not return the URL in the field waited, therefore, the location of this line must be manual, i.e. clean the logs and make the call only the URL that you want to measure the time.Add a new server by filling out the option Target URL
, so the execution options and recording will appear in the Server menu.
Starting the server
When running in record mode, you will see the log match-headers
Options, this means that when generating a map of the route, the headers Content-Type
and SOAPAction
should be part of the filter if any, i.e. URL
, BODY
and these headers
must be the same to be an answer.
+
each map.Stop
and start with the option Start
.Add a new server by filling out the option Target URL
, so the execution options and recording will appear in the Server menu.
Starting the server
Start (Only Proxy)
File
Refresh
: Refreshes the screen to return to the initial state.Open files folder
: Opens the folder where are all the files.Find in Files
: Opens the search tool.Languages
: Supports two languages: English and PortugueseQuit
: Exits the applicationExecute
:
Add Server
: Adds a new serverStart All
: Start all serversStart and record all
: Start all servers in write modeStop all
: Stop all serversTools
:
Web Request
: Opens the WebRequest
tool that makes web requests. This tool is very simple, several settings of the HTTP protocol has not been implemented, it was created for rerun requests or maps.Text Compare
: Opens the tool that compares text. This tool is very simple, it is only to assist in the comparison of requests with maps that did not match.Text Editor
: Opens the text editing tool. The tool is very simple and is designed to help you format some value in JSON or XML format.JSON Viewer
: Opens the JSON Viewer tool which helps in viewing the JSON display in form of TreeViewAbout
: Opens the about screen.Is a project built in java that simulates a web service. Technically it was designed to work in two ways:
mock4net
that has inspired Wiremock.For more information, visit the official website of the tool: http://wiremock.org/
Within the context of tests it is useful to simulate APIs or anything about the HTTP protocol. The server uses, basically, of two folders to work:
.json
, where each file represents a route with your respective answer. There is a lot of settings within each map, all are available in the documentation of the wiremock.Example of map-GET
This map creates a route that will be hearing the http://[SERVER]:5500/user/all
route using the verb GET
. When a request is within these rules the contents of the file response.txt
will be returned:
{
"request": {
"url": "/user/all",
"method": "GET"
},
"response": {
"status": 200,
"bodyFileName": "response.txt",
"headers": {
"Content-Type": "application/json"
}
}
}
Example of map-POST
This map creates a route that will be hearing the http://[SERVER]:5500/user/insert”all
route using the verb POST
and when the body of the request is the same {\"Name\":\"User3\",\"Age\":100}
. When a request is within these rules the contents of the file response.txt
will be returned:
{
"request": {
"url": "/user/insert",
"method": "POST",
"bodyPatterns" : [
{
"equalToJson" : "{\"Name\":\"User3\",\"Age\":100}"
}
]
},
"response": {
"status": 200,
"bodyFileName": "response.txt",
"headers": {
"Content-Type": "application/json"
}
}
}
Response:
The answer is always "raw", without any encapsulation. As in earlier maps, we saw that the response is a file application/json
, then that file will have the JSON content, if it was an image, this answer file would have the image extension, example: response.jpg
and your content would be a binary.
{
"key1": "value"
}
Testing:
java -jar "D:\wm\wiremock-standalone-2.8.0.jar" --port 5500 --root-dir "D:\wm\server1" --verbose
http://localhost:5500/user/all
GET
http://localhost:5500/user/insert
POST
{ "Name": "User3", "Age": 100}
It is very useful to load the first mass, after that, you can edit the generated files and can create several scenarios. To use the generated files need to change the form of execution for mock server.
Testing:
java -jar "D:\wm\wiremock-standalone-2.8.0.jar" --port 5502 --proxy-all "https://www.w3schools.com/" --record-mappings --root-dir "D:\wm\server2" --verbose --match-headers Content-Type
http://localhost:5502
java -jar "D:\wm\wiremock-standalone-2.8.0.jar" --port 5502 --root-dir "D:\wm\server2" --verbose
http://localhost:5502
In our context, it can be useful when you need to use the original service without having to change the URL in the client.
Running:
java -jar "D:\wm\wiremock-standalone-2.8.0.jar" --port 5502 --proxy-all "https://www.w3schools.com/" --verbose
http://localhost:5502
The .JAR
of Wiremock does not run using processes. The .JAR
last version of Wiremock was converted to .NET using the "IKVM". With this, it was possible to increase the use of the tool, having direct access to the main classes.
.app
which is at the root of where's the .exe
.At the moment, I will not add new features due to lack of time, I will be available only for bugs and minor improvements. If you want to contribute with new ideas or fixes, just contact us or access the board of the project.
Important links for the project:
IKVM:
Tool that converts the Java Wiremock for .NET.
PocDatabase:
Framework to facilitate data persistence
https://github.com/juniorgasparotto/PocDatabase
Board:
https://github.com/juniorgasparotto/WiremockUI/projects/1?fullscreen=true
WiremockUI is an open source project. Starting in 2017, many hours have been invested in the creation and evolution of this project.
And all with only one goal: make it a good mock tool to improve the daily lives of the developers. If the WiremockUI was useful for you, or if you want to see it evolve increasingly, consider making a small donation (any amount). Help us also with ideas and possible problems.
Anyway, we appreciate you for have come up here;)
PayPal:
Bitcoin:
19DmxWBNcaUGjm2PQAuMBD4Y8ZbrGyMLzK
The MIT License (MIT)
Copyright (c) 2017 Glauber Donizeti Gasparotto Junior
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute , sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN THE EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This text was translated by a machine