Athena strongly suggests following the SOLID design principles; especially the Dependency inversion principle in order to create types that are easy to test. See the Dependency Injection component for a more detailed look.

If these principles are followed then any controller/service can easily be unit tested on their own as you would any Crystal type, possibly utilizing ASPEC::TestCase to provide helpful abstractions around common testing/helper logic for sets of common types.

However, Athena also comes bundled with ART::Spec::APITestCase to allow for easily creating integration tests for ART::Controllers; which is the more ideal way to test a controller.

require "athena"
require "athena/spec"

class ExampleController < ART::Controller
  def add(value1 : Int32, value2 : Int32, negative : Bool = false) : Int32
    sum = value1 + value2
    negative ? -sum : sum

struct ExampleControllerTest < ART::Spec::APITestCase
  def test_add_positive : Nil
    self.request("GET", "/add/5/3").body.should eq "8"

  def test_add_negative : Nil
    self.request("GET", "/add/5/3?negative=true").body.should eq "-8"

# Run all test case tests.

Integration tests allow testing the full system, including event listeners, param converters, etc at once. These tests do not utilize an HTTP::Server which results in more performant specs.