Squadron - First public release
Last month we have released our first Open Source version of Squadron. ๐ Squadron is a testing framework which makes ist extremely easy to write integration & system tests against resources that run in a container or in the cloud.
The tool has been internally developed at Swiss Life and was heavily used to write tests against SQL Server and MongoDB for more than one year now.
With the new Open Source version 0.5 we have now added many more providers and plan do add even more.
Supported resources
Provider | Nuget Package |
---|---|
Mongo | Squadron.MongoDb |
Mongo Replica Set | Squadron.MongoDb |
SQL Server | Squadron.SqlServer |
Elastic Search | Squadron.ElasticSearch |
PostgreSQL | Squadron.PostgreSql |
Redis | Squadron.Redis |
RabbitMQ | Squadron.RabbitMQ |
Azure Storage | Squadron.AzureStorage |
Azure ServiceBus | Squadron.AzureCloudServiceBus |
Generic | Squadron.Core |
Compose | Squadron.Compose |
Azure Cloud resources
Whenever possible we recommend to use a container resource to use with Squadron, but there are some cases when there is no container replacement for a cloud service. An an example is Azure Storage where the basic features are available using the Azurite emulator, but some more advanced features like leases are only available where using the "Real" cloud service.
For this we have build the functionality the manage Azure services using the management API's. Squadron will automatically provision new resources and delete them when the test has completed. Another way is to use an existing azure resource and provision some entities for the test and remove them after. This can save some time as creating resource is usually a expensive operation. The first resource we have implemented for Azure is Azure Service Bus.
Getting started
- Create a new xUnit Project
dotnet new xunit -name squadron-quickstart
- Install the Squadron nuget package Mongo for within your test project:
dotnet add package Squadron.Mongo
Inject and use the MongoResource into your test class constructor:
public class UserRepositoryTests : IClassFixture<MongoResource>
{
private readonly MongoResource _mongoResource;
public UserRepositoryTests(MongoResource mongoResource)
{
_mongoResource = mongoResource;
}
[Fact]
public async Task UserRepository_Add_AddedUser()
{
//arrange
var user = User.CreateSample();
IMongoDatabase db = _mongoResource.CreateDatabase();
var repo = new UserRepository(db);
//act
await repo.AddAsync(user);
//assert
User createdUser = await GetUserAsync(db, user.Id);
createdUser.Should().BeEquivalentTo(user);
}
}
You can find more quick starts and samples in our docs.
Roadmap
More resources
With future releases we plan to add the following resources to squadron:
- Kafka
- RavenDB
- MySQL
- Azure Storage
- Azure Event Hub
Testing framework support
The current release only supports xUnit as the testing framework. We are now in the process of abstracting the initialization of resources to make it framework independent. NUnit is the next framework on our list to be supported, and of course with the new abstraction you can use Squadron in any .NET Core app.
Samples
We are building a sample solution to show some more complex scenarios using Squadron. Especially using the Compose Resource and integration with Selenium tests.
If you have some ideas for improvements or you'd like to see other integrations in Squadron feel free to create an issue or submit a pull request.
You can also reach out to us using Slack channel.