Mystery Guest

Definition:

  • A test case that uses external resources that are not managed by a fixture. A drawback of this approach is that the interface to external resources might change over time necessitating an update of the test case, or that those resources might not be available when the test case is run, endangering the deterministic behavior of the test.

Also Known As:

  • External Data

Code Example:

public void testGetFlightsByFromAirport_OneOutboundFlight_mg() throws Exception {
    loadAirportsAndFlightsFromFile("test-flights.csv");
    // Exercise System
    List flightsAtOrigin = facade.getFlightsByOriginAirportCode( "YYC");
    // Verify Outcome
    assertEquals( 1, flightsAtOrigin.size());
    FlightDto firstFlight = (FlightDto) flightsAtOrigin.get(0);
    assertEquals( "Calgary", firstFlight.getOriginCity());
 }

References:

Quality attributes

  • - Code Example

  • - Cause and Effect

  • - Frequency

  • - Refactoring