AWS Developer Tools Blog

Tag: Testing

Mocking modular AWS SDK for JavaScript (v3) in Unit Tests

The AWS SDK for Javascript team would like to highlight the open-source community and it’s contributions. Today we welcome a guest blog written by Maciej Radzikowski on aws-sdk-client-mock, a library that allows easy mocking of AWS SDK for JavaScript (v3). On December 15th, 2020, AWS announced the general availability of the AWS SDK for JavaScript, version 3 […]

Client Response Stubs

We recently added client response stubs to the aws-sdk-core gem. Response stubbing disables network traffic and causes a client to return fake or stubbed data. # no API calls are made s3 = true) #=> [] Custom Response Data By default, stubbed responses return empty lists, empty maps, and placeholder scalars. These empty […]

Using RSpec 3

Using RSpec 3 I have been a long time user of RSpec and many of the Ruby projects I work with use RSpec as the primary testing framework. It provides an expressive specification DSL. As you may know, RSpec 3 is currently in the works. I have blogged a few times recently about using MiniTest. […]

Using SimpleCov with Multiple Test Suites

It can be helpful to generate coverage reports when testing software. While coverage reports do not guarantee well tested software, they can highlight were test coverage is lacking. This is especially true for legacy, or un-tested projects. Recently I ran into a situation where I wanted to generate a coverage report, but the project used […]

Running Your Minitest Unit Test Suite

I have blogged a few times recently about Minitest. With Minitest you need to chose how you will execute your tests. When using other tools, like Rspec, there is a bundled test runner. $ rspec ………… Finished in 0.03324 seconds 12 examples, 0 failures Minitest does not provide a test runner as a command line […]

From Minitest::Spec to Minitest::Test

In a previous blog post, I introduced Minitest from the perspective of RSpec. Some Minitest users prefer to avoid the specification style of Minitest::Spec. Instead they use Minitest::Test. It’s closer to the metal and uses a more vanilla Ruby syntax. Here is an example spec file using Minitest::Spec: require ‘spec_helper’ describe MyClass do describe ‘#some_method’ […]

From RSpec to Minitest

One of my favorite aspects of working with Ruby is how natural it is to write tests for. The Ruby community does an excellent job of encouraging authors to produce well tested code. There is a plethora of well supported tools to choose from. I like to joke that new Ruby developers write Micro test […]

Static Service Client Facades

Version 2.4 of the AWS SDK for PHP adds the ability to enable and use static client facades. These “facades” provide an easy, static interface to service clients available in the service builder. For example, when working with a normal client instance, you might have code that looks like the following: // Get the configured […]

Stubbing AWS Responses

I come across questions frequently about how to test an application that uses the AWS SDK for Ruby (aws-sdk gem). Testing an application that makes use of an external service is always tricky. One technique is to stub the client-level responses returned by the SDK. AWS.stub! Calling the AWS.stub! method in your ruby process configures […]