Day Sleeper

My coffee lies in front of me, cold and untouched I’ll go back, it’s there when I hang my head I take a belt to help migraines from the onset He winced at the sting lingering in my jargon…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Tests Call the API as a User Would

Designing Elixir Systems with OTP — Pragmatic Programmers (77 / 81)

👈 Chapter 10 Test the Boundary | TOC | Isolate the Proctor’s Boundary Concerns 👉

Our test will deal with the entire Mastery API. This whole book has been building up to this point. This test will not exercise our code as an interior function might, rather, it will test the whole API as an end user of the dependency. If we’ve done our job well, we’ll be able to express the entire test in a few short pages of code.

Our plan is to cover tests for the overarching API, and then move on to more specific tests within the poncho project. In this chapter, we won’t provide an exhaustive test to cover every corner condition. Instead, we’ll give you the strategies you might use to meet the testing strategies you’re likely to face to build effective boundary tests. Let’s write the first test.

We start with the module definition, the use directive for the ExUnit test case for running tests, and the use directive for our helper fixtures. We establish these tests as async: false because they should not run concurrently. We have a single QuizManager GenServer that’s bound to the module so running a concurrent version of this test would interfere with our test. Luckily, this file will be pretty thin so we won’t pay too much of a penalty.

We follow our use directives up with more than a few aliases for all of the services we plan to use. It’s an integration test, after all. Now, we can turn our attention to persistence:

Add a comment

Related posts:

Carta Aberta

Recomendaram-me que lhe escrevesse, aproveitei que hoje acordei pensando em você. Me demorei no sono, me demorei no leito, me demorei em escrever-lhe. Não é novidade que periodicamente seu semblante…

Parameterized Types

Our industry is moving toward functional programming, but your object-oriented experience is still valuable. Scala combines the power of OO and functional programming, and Pragmatic Scala shows you how to work effectively with both. Updated to Scala 2.11, with in-depth coverage of new features such as Akka actors, parallel colle

Talking to your computer.

Everyone uses a computer. There were over 1.5 billion computers estimated to be in use in 2015, and we can definitely believe that number has risen 5 years later. However not many people interact…