naturalintelligence / stubmatic Goto Github PK
View Code? Open in Web Editor NEWMock HTTP calls without coding. Designed specially for testing and testers.
Home Page: https://naturalintelligence.github.io/Stubmatic/
License: Other
Mock HTTP calls without coding. Designed specially for testing and testers.
Home Page: https://naturalintelligence.github.io/Stubmatic/
License: Other
Currently stubmatic can be used to debug a HTTP request without setting up any workspace;
$ stubmatic -v --debug [-p XXXX]
It also supports proxy a request to other server.
- request:
url: /someurl/.*
response:
proxy: http://google.com:8003
The combined feature can be used to debug HTTP response;
$ stubmatic -v --debug [-p XXXX] --to http://google.com
Requirement : When a user runs stubmatic with argument to
, it should ignore any request response mapping. and should work as a proxy. if the --debug
parameter is passed then it should log everything to the console or output stream.
Index.html on gh-pages
branch need to be updated to add a code example about how to stub an endpoint which is expected to return msgpack
or nimn data.
Please refer mapping page for response.parser
property which will be used in the example.
Feel free to discuss any doubt regarding this issue.
First time contributors may check how to guide about how to clone a repo, create PR etc.
Currently, a user can create the mapping to serve the response from random files or in a round-robin fashion. (wiki)
- request:
url: /stubs/employee/([0-9]+)
response:
strategy: random
files: ["<% url.1 %>.xml","file2.xml","file3.xml"]
Or
- request:
url: /stubs/employee/([0-9]+)
response:
strategy: random
files: ["<% url.1 %>.xml","file2.xml",{"name":"file3.xml","status":500}]
But what if a user wants the same behavior but without any response in the body? He can create an empty file and do a hack like this;
- request:
url: /stubs/employee/([0-9]+)
response:
strategy: random
files: [{"name":"empty","status":500}, {"name":"empty","status":503}]
We're looking for some meaningful mapping
- request:
url: /stubs/employee/([0-9]+)
response:
strategy: random
status: [ 500, 503 ]
Unit tests need to be fixed. Possible reasons
Grapes : Flexible Regular expression engine (for java) which can be applied on char stream. (maintainers are needed)
It points to https://github.com/amitguptagwl/grapes which is broken as of today.
After switching node version from 8.9.4 to 10.13.0, dynamic features (evaluating keys at the response) is not working well. What I got in the response is just the evaluated key, not the entire response.
After debugging, I found the problem in lib/expressions/engine.js line 30
expressions[i]=new Expression(match[match.length-2], match[1]);
The problem is that match.length is different with node.js 10 and node.js 8.
So for start index you get a string and not a number.
Please see attached screenshots.
Index.html on gh-pages
branch need to be updated to add a code example about how to stub a secure endpoint.
Please refer SSL handshaking page for step wise step guide.
Feel free to discuss any doubt regarding this issue.
First time contributors may check how to guide about how to clone a repo, create PR etc.
I want to create a rest API and I want to validate the request and respond with proper error message If a specific field is not available or empty or invalid .
Can I do this using Stubmatic ?
Hi,
Can I perform error handling on the validation errors, aroused due to the wrong input of post data?
For example I created an endpoint in response.yaml which accepts XML and returns a set of XML file already saved in project path.Still, it was fine was and working as expected, but I wanted to perform validations also on XML post body provided and throw error respectively can I do such things stubmatic.
Regards.
We're currently working on new features in Stubmatic. Your suggestion would help us to lead in the correct direction.
Targeted major features
<% url.1 %>
, [[dumpspath:file1,file2]]
, {{ TODAY }}
. Now we'll be using a single handler: {{ include("file1", "file2") }}
. [ Done ]I have create a mock that work fine when its called from SoapUI, but fail when its called from a generated java web service client. I thing that the body is not recognizing propertly, because in the log, resolved is null.
In current version of Stubmatic, we use regular expressions to match & catch HTTP request. Writing regular expression can be an easy task for a developer, but reading and understanding it later is complex.
To solve this we're planning to use named regular expressions. E.g.
\authorize\(admin|staff|user)
can be replaced with
\authorize\:role:
role : (admin|staff|user)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.