FIX Session Layer Test Cases
Test Cases
Table of Contents
Scope
This document provides a set of mandatory and optional compliance tests applicable to all versions of the FIX session layer standard.
Normative references
The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.
— Financial Information eXchange – FIX TagValue Encoding Technical Specification
— Financial Information eXchange – FIX Session Layer Technical Specification
— FIX 4.2 Specification with 20010501 Errata https://staging.fixtrading.org/standards/fix-4-2/
— FIX 4.4 Specification with 20030618 Errata https://staging.fixtrading.org/standards/fix-4-4/
Terms and definitions
For the purposes of this document, the terms and definitions given in ISO/IEC 11404:2007 Information technology – General-Purpose Datatypes (GPD) and the following apply.
ISO and IEC maintain terminological databases for use in standardization at the following addresses:
— IEC Electropedia: available at http://www.electropedia.org/
— ISO Online browsing platform: available at https://www.iso.org/obp
FIX session layer test cases
Applicability
This document was last revised September 20, 2002 at which time FIX version 4.3 with Errata 20020930 was the latest version of the FIX Protocol. Note that future amendments to this document may be found on the FIX website and any version of this document published on a later date takes precedence over this version of the document. This document is applicable to all supported versions of the FIX session layer (4.2, 4.4, FIXT) except where explicitly indicated.
Test cases
These test cases are from the perspective of the FIX system being tested. The FIX system receives the “Condition / Stimulus” and is expected to take the appropriate action as defined by “Expected Behavior”.
Buyside-oriented (session initiator) Logon and session initiation test case
Scenario 1B Connect and Send Logon message
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
a. Establish transport layer connection. | Successfully established transport layer connection with peer. |
b. Send Logon(35=A) request message. | Logon(35=A) acknowledgement message sent by peer. |
c. Valid Logon(35=A) acknowledgement message received. | If MsgSeqNum(34) is too high, send ResendRequest(35=2). |
d. Invalid Logon(35=A) acknowledgement message received. |
|
e. Receive any message other than a Logon(35=A) message. |
|
Sellside-oriented (session acceptor) Logon and session initiation test case
Scenario 1S Receive Logon message
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
a. Valid Logon(35=A) request message received. |
|
b. Logon(35=A) message received with duplicate identity (e.g. same IP, port, SenderCompID(49), TargetCompID(56), etc. as existing connection). |
|
c. Logon(35=A) message received with unauthenticated/non-configured identity (e.g. invalid SenderCompID(49), invalid TargetCompID(56), invalid source IP address, etc. vs. system configuration). |
|
d. Invalid Logon(35=A) message. |
|
Scenario 2S. Receive any message other than a Logon message
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
First message received is not a Logon(35=A) message. |
|
Test cases applicable to all FIX systems
Scenario 2 Receive Message Standard Header
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
a. MsgSeqNum(34) received as expected. | Accept MsgSeqNum(34) for the message. |
b. MsgSeqNum(34) higher than expected. | Respond with ResendRequest(35=2) message. |
c. MsgSeqNum(34) lower than expected without PossDupFlag(43) set to Y.
Exception: SequenceReset(35=4). |
|
d. Garbled message received. |
|
e. PossDupFlag(43) set to Y; OrigSendingTime(122) specified is less than or equal to SendingTime(52) and MsgSeqNum(34) lower than expected.
Note: OrigSendingTime(122) should be earlier than SendingTime(52) unless the message is being resent within the same second during which it was sent. |
|
f. PossDupFlag(43) set to Y; OrigSendingTime(122) specified is greater than SendingTime(52) and MsgSeqNum(34) as expected.
Note: OrigSendingTime(122) should be earlier than SendingTime(52) unless the message is being resent within the same second during which it was sent. |
|
g. PossDupFlag(43) set to Y and OrigSendingTime(122) not specified.
Note: Always set OrigSendingTime(122) to the time when the message was originally sent-not the present SendingTime(52) and set PossDupFlag(43)=Y when responding to a ResendRequest(35=2). |
|
h. BeginString(8) value received as expected and specified in testing profile and matches BeginString(8) on outbound messages. | Accept BeginString(8) for the message. |
i. BeginString(8) value received did not match value expected and specified in testing profile or does not match BeginString(8) on outbound messages. |
|
j. SenderCompID(49) and TargetCompID(56) values received as expected and specified in testing profile. | Accept SenderCompID(49) and TargetCompID(56) for the message. |
k. SenderCompID(49) and TargetCompID(56) values received did not match values expected and specified in testing profile. |
|
l. BodyLength(9) value received is correct. | Accept BodyLength(9) for the message. |
m. BodyLength(9) value received is not correct. |
|
n. SendingTime(52) value received is specified in UTC (Universal Time Coordinated) also known as GMT) or is not within SendingTimeThreshold seconds of a synchronized time source. | Accept SendingTime(52) for the message. |
o. SendingTime(52) value received is either not specified in UTC (Universal Time Coordinated) or is not GMT) or is not within a within SendingTimeThreshold seconds of a synchronized time source.
Rationale: Verify system clocks on both sides are in sync and that SendingTime(52) is current time. |
|
p. MsgType(35) value received is valid (defined in spec or classified as user-defined). | Accept MsgType(35) for the message. |
q. MsgType(35) value received is not valid (defined in spec or classified as user-defined). |
|
r. MsgType(35) value received is valid (defined in spec or classified as user-defined) but not supported or registered in testing profile. |
|
s. BeginString(8), BodyLength(9), and MsgType(35) are first three fields of message. | Accept the message. |
t. BeginString(8), BodyLength(9), and MsgType(35) are not the first three fields of message. |
|
Scenario 3 Receive Message Standard Trailer
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
a. Valid CheckSum(10). | Accept message |
b. Invalid CheckSum(10). |
|
c. Garbled message. |
|
d. CheckSum(10) is last field of message, value has length of 3, and is delimited by <SOH> . |
Accept message. |
e. CheckSum(10) is not the last field of message, value does not have length of 3, or is not delimited by <SOH> . |
|
Scenario 4 Send Heartbeat message
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
a. No data sent during preset heartbeat interval (HeartBtInt(108) field). | Send Heartbeat(35=0) message. |
b. TestRequest(35=1) message received. | Send Heartbeat(35=0) messsage with TestRequest(35=1) message’s TestReqID(112). |
Scenario 5 Receive Heartbeat message
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
Valid Heartbeat(35=0) message. | Accept Heartbeat(35=0) message. |
Scenario 6 Send Test Request
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
No data received during preset heartbeat interval (HeartBtInt(108)) + “some reasonable period of time” (use 20% of HeartBtInt(108)). |
|
Scenario 7 Receive Reject message
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
Valid Reject(35=3) message. |
|
Scenario 8 Receive Resend Request message
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
Valid ResendRequest(35=2) | Respond with application layer messages and SequenceReset(35=4) with GapFillFlag(123)=Y for session layer messages in request range according to message recovery rules. |
Scenario 9 Synchronize sequence numbers
Optional
Condition/Stimulus | Expected Behavior |
---|---|
Application failure that caused loss of session state. |
OR
|
Scenario 10 Receive Sequence Reset (Gap Fill)
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
a. Receive SequenceReset(35=4) with GapFillFlag(123)=Y message with NewSeqNo(36) > MsgSeqNum(34)
and MsgSeqNum(34) > NextNumIn |
Issue ResendRequest(35=2) to fill gap between last expected MsgSeqNum(34) & received MsgSeqNum(34). |
b. Receive SequenceReset(35=4) with GapFillFlag(123)=Y message with NewSeqNo(36) > MsgSeqNum(34)
and MsgSeqNum(34) = NextNumIn |
Set next expected sequence number = NewSeqNo(36). |
c. Receive SequenceReset(35=4) with GapFillFlag(123)=Y message with NewSeqNo(36) > MsgSeqNum(34)
and MsgSeqNum(34) < NextNumIn and PossDupFlag(43)=Y. |
Ignore message. |
d. Receive SequenceReset(35=4) with GapFillFlag(123)=Y message with NewSeqNo(36) > MsgSeqNum(34)
and MsgSeqNum(34) < NextNumIn and without PossDupFlag(43)=Y. |
|
e. Receive SequenceReset(35=4) with GapFillFlag(123)=Y message with NewSeqNo(36) <= MsgSeqNum(34)
and MsgSeqNum(34) = NextNumIn |
Send Reject(35=3) message with message “attempt to lower sequence number, invalid value NewSeqNo(36)=<x>”. |
Scenario 11 Receive Sequence Reset (Reset)
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
a. Receive SequenceReset(35=4) with GapFillFlag(123)=N message with NewSeqNo(36) > NextNumIn |
|
b. Receive SequenceReset(35=4) with GapFillFlag(123)=N message with NewSeqNo(36) = NextNumIn |
|
c. Receive SequenceReset(35=4) with GapFillFlag(123)=N message with NewSeqNo(36) < NextNumIn |
|
Scenario 12 Initiate logout process
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
Initiate logout. |
|
Scenario 13 Receive Logout message
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
a. Receive valid Logout(35=5) acknowledgement in response to a Logout(35=5) request. | Disconnect without sending a message. |
b. Receive valid Logout(35=5) request message unsolicited. |
|
Scenario 14 Receive application or session layer message
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
a. Receive field identifier (tag number) not defined in specification.
Exception: undefined tag used is specified in testing profile as user-defined. |
|
b. Receive message with a required field identifier (tag number) missing. |
|
c. Receive message with field identifier (tag number) which is defined in the specification but not defined for this message type.
Exception: undefined tag used is specified in testing profile as user-defined for this message type. |
|
d. Receive message with field identifier (tag number) specified but no value (e.g. “55=<SOH> ” vs. “55=IBM<SOH> ”). |
|
e. Receive message with incorrect value (out of range or not part of valid list of enumerated values) for a particular field identifier (tag number).
Exception: undefined enumeration values used are specified in testing profile as user-defined. |
|
f. Receive message with a value in an incorrect data format (syntax) for a particular field identifier (tag number). |
|
g. Receive a message in which the following is not true: Standard Header fields appear before Body fields which appear before Standard Trailer fields. |
|
h. Receive a message in which a field identifier (tag number) which is not part of a repeating group is specified more than once. |
|
i. Receive a message with repeating groups in which the “count” field value for a repeating group is incorrect. |
|
j. Receive a message with repeating groups in which the order of repeating group fields does not match the specification. |
|
k. Receive a message with a field of a data type other than “data” which contains one or more embedded <SOH> values. |
OR
|
l. Receive a message when application layer processing or system is not available (optional). |
|
m. Receive a message in which a conditionally required field is missing. |
|
n. Receive a message in which a field identifier (tag number) appears in both cleartext and encrypted section but has different values. |
|
Scenario 15 Send application or session layer messages to test normal and abnormal behavior/response
Optional
Condition/Stimulus | Expected Behavior |
---|---|
Send more than one message of the same type with header and body fields ordered differently to verify acceptance. (Exclude those which have restrictions regarding order.) | Message accepted and subsequent messages’ MsgSeqNum(34) are accepted. |
Scenario 16 Queue outgoing messages
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
a. Message to send/queue while disconnected. | Queue outgoing messages. Note there are two valid approaches:
Note: SendingTime(52) must contain the time the message is sent, not the time the message was queued. |
b. Reconnect with queued messages. |
Note: SendingTime(52) must contain the time the message is sent, not the time the message was queued. |
Scenario 17 Support encryption
Optional
Condition/Stimulus | Expected Behavior |
---|---|
a. Receive Logon(35=A) request message with valid, supported EncryptMethod(98). |
|
b. Receive Logon(35=A) message with invalid or unsupported EncryptMethod(98). |
|
c. Receive message with valid SignatureLength(93) and Signature(89) values. | Accept the message. |
d. Receive message with invalid SignatureLength(93) value. |
|
e. Receive message with invalid Signature(89) value. |
Or consider decryption error or message out of order, ignore message (do not increment inbound MsgSeqNum(34)) and continue accepting messages. |
f. Receive message with a valid SecureDataLen(90) value and a SecureData(91) value that can be decrypted into valid, parsable cleartext. | Accept the message. |
g. Receive message with invalid SecureDataLen(90) value. |
|
h. Receive message with a SecureData(91) value that cannot be decrypted into valid, parsable cleartext. |
|
i. Receive message with one or more fields not present in the unencrypted portion of the message that “must be unencrypted” according to the spec. |
|
j. Receive message with incorrect handling of “leftover” characters (e.g. when length of cleartext prior to encryption is not a multiple of 8) according to the specified EncryptMethod(98).1 |
|
Scenario 18 Support third party addressing
Optional
Condition/Stimulus | Expected Behavior |
---|---|
a. Receive messages with OnBehalfOfCompID(115) and
DeliverToCompID(128) values expected as specified in testing profile and with correct usage. |
Accept messages. |
b. Receive messages with OnBehalfOfCompID(115) or
DeliverToCompID(128) values not specified in testing profile or incorrect usage. |
|
Scenario 19 Test PossResend handling
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
a. Receive message with PossResend(97)=Y and application layer check of message-specific ID indicates that it has already been seen on this session. |
|
b. Receive message with PossResend(97)=Y and application layer check of message-specific ID indicates that it has NOT yet been seen on this session. | Accept and process the message normally. |
Scenario 20 Simultaneous Resend request test
Mandatory
Condition/Stimulus | Expected Behavior |
---|---|
Receive a ResendRequest(35=2) message while having sent and awaiting complete set of responses to a ResendRequest(35=2) message. |
|
- For block ciphers which transform a fixed-size block of data (usually 64 bits) into another fixed-size block (possibly 64 bits long again) using a function selected by the key.↩︎