Getting started
Welcome to mock.qa - the ultimate gRPC/HTTP mock server solution for your development and testing needs. Our cloud-based service supports both gRPC and gRPC-web protocols and offers a range of powerful features including rich request matching, response templating, scripting, and stateful scenarios. Whether you need a mock server for front-end development, API prototyping, manual or automated testing, or even education and research, mock.qa has you covered. Try it out today and see the difference it can make for your workflow.
Installation
Choose your plan on GitHub marketplace
Before using the mock.qa you need to set up a plan on GitHub Marketplace. Visit our page on GitHub Marketplace or see the detailed instruction here.
Bootstrap your mock server instance
Once you've set up your plan, all you need to do is create a /greet.proto file and a /.grpc.mock.qa.yaml file in the root of your repository. Our mock server will then be automatically available at the endpoint URL below (learn more here: Endpoint URL):
https://[[instanceName→]repo→]<owner>.grpc.qa
You can also clone one of our hello-world repositories:
With just a few simple steps, you can have your own gRPC mock server up and running on mock.qa. And, when it's time to set your software under test, just use the mock endpoint URL provided. The first call to the mock instance may take a little longer as the server is bootstrapping and warming up, but after that, it's smooth sailing.
So why wait? Start simplifying your testing and debugging process with mock.qa today!
.grpc.mock.qa.yaml file content
---
fileVersion: v1
instanceName: Greet
protoFile: "/greet.proto"
# Incoming request matching is done in the order of definition,
# sequentially, from the first one to the last one,
# once a match is found, the processing stops
calls:
# First, we try to match a call to Joe
- method: greet.Greeter/SayHello
request:
body:
Name: "Joe"
response:
body:
Message: Hello Joe!
status: OK
# Then, we try to match a call to Kelly
- method: greet.Greeter/SayHello
request:
body:
Name: "Kelly"
response:
body:
Message: Hello Kelly!
status: OK
# And if no match, fall back to NotFound
- method: greet.Greeter/SayHello
# "request" section is optional and may be absent
# - if "request" section is absent
# then any call of the method is a match
response:
statusCode: NOT_FOUND
statusDetails: Name not found
greet.proto file content
// Copyright 2019 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package greet;
// The greeting service definition.
service Greeter {
// Sends a greeting
rpc SayHello (HelloRequest) returns (HelloReply);
}
// The request message containing the user's name.
message HelloRequest {
string name = 1;
}
// The response message containing the greetings
message HelloReply {
string message = 1;
}