The Power of Acceptance Testing

Learn the downsides of a real-time distributed application and how testing can fix them.

Acceptance tests

Although Phoenix handles many complex parts, writing and running real-time systems is a challenge. Real-time systems use persistent connections to optimize the speed and efficiency of sending data to clients. We covered in Design for Unreliable Connections that persistent connections are less forgiving than traditional web requests. They require additional code to cover scenarios that can happen to users.

Let’s look at why this is the case and how acceptance tests can help us gain confidence in our application. Acceptance tests use the entire application stack, from browser to server. They can be manual or automated, which we’ll cover later in this section. We can recreate the following challenging scenarios with acceptance tests.

An application open for long periods

Users can leave web pages open for hours, days, or weeks. Browsers vary in how they handle this, but many will leave the page resident in memory and restore without fetching a new copy of the page from the server. If our application uses Channels to provide new data to users as it is available, users are even less likely to refresh the page because their view updates in real-time. We want to ensure that an application we build works just as well after being open for five hours as it does after being open for five seconds.

Get hands-on with 1000+ tech skills courses.