All Projects → NeowayLabs → Wabbit

NeowayLabs / Wabbit

Licence: bsd-2-clause
Golang AMQP mocking library

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Projects that are alternatives of or similar to Wabbit

Stubmatic
Mock HTTP calls without coding. Designed specially for testing and testers.
Stars: ✭ 118 (-13.87%)
Mutual labels:  mock, fake
Amqp
AMQP 1.0 client library for Go.
Stars: ✭ 135 (-1.46%)
Mutual labels:  library, amqp
stub-server
Stub server for REST APIs
Stars: ✭ 14 (-89.78%)
Mutual labels:  mock, fake
fakey-json
This is a utility for mocking json data that pretends the api response data with JSON format.
Stars: ✭ 27 (-80.29%)
Mutual labels:  mock, fake
Sns
Fake Amazon SNS
Stars: ✭ 94 (-31.39%)
Mutual labels:  fake, mock
better-mock
Forked from Mockjs, Generate random data & Intercept ajax request. Support miniprogram.
Stars: ✭ 140 (+2.19%)
Mutual labels:  mock, fake
Mimesis
Mimesis is a high-performance fake data generator for Python, which provides data for a variety of purposes in a variety of languages.
Stars: ✭ 3,439 (+2410.22%)
Mutual labels:  fake, mock
ts-mock-imports
Intuitive mocking library for Typescript class imports
Stars: ✭ 103 (-24.82%)
Mutual labels:  mock, fake
Fakerator
Random fake data generator with localization for Javascript in Node.js and browser
Stars: ✭ 91 (-33.58%)
Mutual labels:  fake, mock
Openapi Sampler
🔠 Tool for generation samples based on OpenAPI(fka Swagger) payload/response schema
Stars: ✭ 83 (-39.42%)
Mutual labels:  fake, mock
Mockaco
🐵 HTTP mock server, useful to stub services and simulate dynamic API responses, leveraging ASP.NET Core features, built-in fake data generation and pure C# scripting
Stars: ✭ 213 (+55.47%)
Mutual labels:  mock, fake
Rabbitmq Mock
Mock for RabbitMQ Java amqp-client
Stars: ✭ 114 (-16.79%)
Mutual labels:  amqp, mock
jest-ts-auto-mock
Jest test utility with automatic mock creation for interfaces and classes
Stars: ✭ 150 (+9.49%)
Mutual labels:  mock, fake
xrm-mock
📚 A fake implementation of the Xrm object model. Written in TypeScript against @types/xrm definitions.
Stars: ✭ 64 (-53.28%)
Mutual labels:  mock, fake
moq.ts
Moq for Typescript
Stars: ✭ 107 (-21.9%)
Mutual labels:  mock, fake
falso
All the Fake Data for All Your Real Needs 🙂
Stars: ✭ 877 (+540.15%)
Mutual labels:  mock, fake
Fake Xrm Easy
The testing framework for Dynamics CRM and Dynamics 365 which runs on an In-Memory context and deals with mocks or fakes for you
Stars: ✭ 216 (+57.66%)
Mutual labels:  fake, mock
Http Fake Backend
Build a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 253 (+84.67%)
Mutual labels:  fake, mock
Generator Http Fake Backend
Yeoman generator for building a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 49 (-64.23%)
Mutual labels:  fake, mock
Impersonator
Ruby library to record and replay object interactions
Stars: ✭ 100 (-27.01%)
Mutual labels:  fake, mock

Wabbit - Go AMQP Mocking Library

GoDoc Go Report Card

Elmer Fudd: Shhh. Be vewy vewy quiet, I'm hunting wabbits

AMQP is a verbose protocol that makes it difficult to implement proper unit-testing on your application. The first goal of this package is provide a sane interface for an AMQP client implementation based on the specification AMQP-0-9-1 (no extension) and then an implementation of this interface using the well established package streadway/amqp (a wrapper).

What are the advantages of this?

Usage

How to use ?

Testing

This package have an AMQP interface and two possible implementations:

In the same way you can use the http package in your software and use the httptest for testing, when using wabbit is recommended to use the wabbit/amqp package on your software and wabbit/amqptest in your tests. Simple test example:

package main

import (
	"testing"
	"github.com/NeowayLabs/wabbit/amqptest"
	"github.com/NeowayLabs/wabbit/amqptest/server"
	"github.com/NeowayLabs/wabbit/amqp"
)


func TestChannelCreation(t *testing.T) {
	mockConn, err := amqptest.Dial("amqp://localhost:5672/%2f") // will fail,

	if err == nil {
		t.Error("This shall fail, because no fake amqp server is running...")
	}

	fakeServer := server.NewServer("amqp://localhost:5672/%2f")
	fakeServer.Start()

	mockConn, err = amqptest.Dial("amqp://localhost:5672/%2f") // now it works =D

	if err != nil {
		t.Error(err)
	}

	//Now you can use mockConn as a real amqp connection.
	channel, err := mockConn.Channel()

    // ...
}

The package amqptest/server implements a mock AMQP server and it can be used to simulate network partitions or broker crashs. To create a new server instance use server.NewServer passing any amqpuri. You can create more than one server, but they need to have different amqpuris. Example below:

    broker1 := server.NewServer("amqp://localhost:5672/%2f")
    broker2 := server.NewServer("amqp://192.168.10.165:5672/%2f")
    broker3 := server.NewServer("amqp://192.168.10.169:5672/%2f")

    broker1.Start()
    broker2.Start()
    broker3.Start()

Calling NewServer with same amqpuri will return the same server instance.

Use broker.Stop() to abruptly stop the amqp server.

There's no fake clustering support yet (maybe never)

It's a very straightforward implementation that need a lot of improvements yet. Take careful when using it.

[]'s

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].