0% found this document useful (0 votes)
30 views

Laboratory Work 4 SystemTesting

The document describes an API function that checks the validity of a connection between two flights. The function validConnection takes two Flight objects as parameters and returns a ValidityCode integer. A Flight object contains fields for flight code, originating/destination airports, and departure/arrival times. The function checks that the arrival airport of the first flight matches the departure airport of the second flight, and that the departure time of the second flight allows enough time after the arrival of the first flight based on minimum connection times in the airport database.

Uploaded by

somewheregrayish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Laboratory Work 4 SystemTesting

The document describes an API function that checks the validity of a connection between two flights. The function validConnection takes two Flight objects as parameters and returns a ValidityCode integer. A Flight object contains fields for flight code, originating/destination airports, and departure/arrival times. The function checks that the arrival airport of the first flight matches the departure airport of the second flight, and that the departure time of the second flight allows enough time after the arrival of the first flight based on minimum connection times in the airport database.

Uploaded by

somewheregrayish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Exercise Session:

System Testing
Airport Connection Check
• API function to check validity of a connection
between two flights.
• If the arrival airport of Flight A
differs from the departure airport
of Flight B, connection is invalid.
• If departure time of Flight B is too
close to the arrival time of Flight A,
connection is invalid.
• If an airport doesn’t exist, the
connection is invalid…

2
Airport Connection Check
validConnection(Flight flightA, Flight flightB)
returns ValidityCode
A Flight is a data structure consisting of:
● A unique identifying flight code
(string, three characters followed by four numbers).
● The originating airport code (three character string).
● The scheduled departure time from the originating airport
(in universal time).
● The destination airport code (three character string).
● The scheduled arrival time at the destination airport (in universal time).

3
Airport Connection Check
There is also a flight database, where each record contains:
● Three-letter airport code (three character string).
● Airport country (string).
○ If in the Schengen Area, this is indicated instead of the home country.
● Minimum domestic connection time
○ (integer, minimum num. minutes that must be allowed for flight connections to be valid).
● Minimum international connection time
○ (more time is required due to need to clear customs and meet regulations)

ValidityCode is an integer with value:


• 0 for OK
• 1 for invalid airport code
• 2 for a connection that is too short
• 3 for flights that do not connect (flightA does not land in same location as flightB)
• 4 for any other errors (malformed input or any other unexpected errors).

4
Creating System-Level Tests
Identify an Independently
Testable Function
Identify a function that can be tested in (relative) isolation.

Identify controllable aspects of the input and environment


Identify Choices that determine the outcome of the function.

Identify Representative Identify types of values for each choice


Input Values that lead to different function outcomes.

Generate Test Case Combine values to form “recipes”


Specifications for test cases.

Generate Test Replace


Cases representative
values with
concrete values.

5
Your Task
validConnection(Flight flightA, Flight flightB)
returns ValidityCode

Identify controllable aspects of the input and environment


Identify Choices that determine the outcome of the function.

Identify Representative Identify types of values for each choice


Input Values that lead to different function outcomes.

Apply Constraints ERROR, SINGLE, IF

6
Hints
• Two explicit parameters (Flight A and B) and one
implicit (airport database).
• Flight has multiple fields (potential choices)
• Database records have multiple fields (potential choices).
• Remember that representative values can interact. This
must be accounted for.
• IF constraints indicate when combinations of values should
be used for different choices.

7
Hints
• Consider how arrival time (flight A), departure time
(flight B), and minimum connection time interact.
• Consider that domestic and international connection
times can differ in length.
• Consider how the database contents can influence
behavior.
• Consider how input can be invalid or malformed
• (don’t just list “invalid input” but give clear examples).
8
Example to Start
FlightA FlightB
Choice: Originating Airport Code Choice: Originating Airport Code

● Valid airport ● Valid airport, same as FlightA’s


● Not in database [error] Destination Airport Code
● Not a correctly formatted airport [error] ● Valid airport, but different from FlightA’s
○ (not a three-letter string) Destination Airport Code [error]
● Not in database [error]
● Not a correctly formatted airport [error]

You might also like