Skip to main content
Version: Next

Metadata & Instance Test Cases

You will need to pre-populate the AppDirectory with the following items:

AppRequired Metadata
AGeneric AppD Record which contains at least the following fields:
- name
- version
- title
- tooltip
- description
- icons (Array<Icon>)
- screenshots (Array<Image>)
- interop.intents.listensFor (aTestingIntent with at least context type testContextX)

Retrieve AppMetadata

AppStepDetails
Test1. getAppMetadataRetrieve metadata for the configured app A with
const metadata1 = await fdc3.getAppMetadata({appId:"<A's-appId>"})
Test2. ConfirmCompare the AppMetadata object to the expected definition for the fields provided above during setup and ensure that the metadata matches. An instanceId should NOT be set
  • GetAppMetadata 2.0+: perform the above steps.

Instance Metadata

AppStepDetails
Test1. Open1Open a first instance of App A using
const appIdentifier1 = await fdc3.open({appId: "<A's-appId>"})
and confirm that its AppIdentifier contains an instanceId.
Test2. Open2Open a second instance of App A using
const appIdentifier2 = await fdc3.open({appId: "<A's-appId>"})
and confirm that its AppIdentifier contains an instanceId and that its value differs from that returned for the first instance.
Test3. getAppMetadata1Retrieve metadata for the first instance of the app with
const metadata1 = fdc3.getAppMetadata(appIdentifier1)
Test4. Confirm1Compare the AppMetadata object to the expected definition for the fields provided above during setup and ensure that the metadata matches.
Test5. getAppMetadata2Retrieve metadata for the second instance of the app with
const metadata2 = fdc3.getAppMetadata(appIdentifier2)
Test6. Confirm2An instanceId should be provided, confirm that it matches the one in appIdentifier2
  • AppInstanceMetadata 2.0+: Perform the above steps.

Finding Instances

AppStepDetails
Test1. Open1Open the first instance of App A using
const appIdentifier1 = await fdc3.open({appId:"<A's-appId>"})
and confirm that its AppIdentifier contains an instanceId.
Test2. Open2Open a second instance of App A using
const appIdentifier2 = await fdc3.open({appId:"<A's-appId>"})
and confirm that its AppIdentifier contains an instanceId and that its value differs from that returned for the first instance.
Test3. FindInstancesRetrieve details of open instances of app A with
let instances = await fdc3.findInstances({appId:"<A's-appId>"})
confirm that both appIdentifier1 and appIdentifier2 are both present in the array.
Test4. RaiseIntentUse appIdentifier1 to raise an intent and target that instance, with
const resolution = fdc3.raiseIntent("aTestingIntent",{"type":"testContextX"},appIdentifier1)
Test5. Confirm1Check that resolution.source matches appIdentifier1
A6. ConfirmReceiptEnsure that the instance of app A represented by appIdentifier1 received the raised intent
  • FindInstances 2.0+: Perform the above steps.

Getting Info For The Agent

AppStepDetails
Test1. getInfoRetrieve the ImplementationMetadata for the DesktopAgent with
- fdc3.getInfo().then((implMetadata) => { subsequent steps }
Note that the use of then is deliberate and intended to confirm that a promise returned (as this function switched from synchronous to asynchronous in 2.0)
Test2. CheckVersionCheck that the fdc3Version variable is present and at or greater than:
- 2.0
(which you can do with the versionIsAtLeast function from FDC3's Methods.ts:
const isFDC3v2 = versionIsAtLeast(implMetadata, "2.0")
Test3. CheckProviderCheck that the provider variable is present and not an empty string
Test4. CheckFeaturesCheck that the optionalFeatures and optionalFeatures.UserChannelMembershipAPIs variables are present and that the latter provides a boolean value. 3.0 Also check that optionalFeatures.DesktopAgentBridging is present and provides a boolean value.
  • GetInfo1 2.0+: Perform the above steps.
AppStepDetails
Test1. Open1Start an instance of App A with
const appIdentifier1 = await fdc3.open({appId:"<A's-appId>"})
retrieve its AppIdentifier with instance details. Confirm that the AppIdentifier contains both an appId and instanceId
A2 .getInfoRetrieve the ImplementationMetadata for the DesktopAgent with:
fdc3.getInfo().then((implMetadata) => { ... subsequent steps ...}
This should include AppMetadata for the retrieving app.
A + Test3. ConfirmCheck that implMetadata.appMetadata contains an appId and instanceId matching that retrieved in the first step (will require transmission of the details from A to Test or vice-versa). Also compare the AppMetadata object to the expected definition for the fields provided above during setup and ensure that the metadata matches.
  • GetInfo2 2.0+: Perform the above steps.

Context Metadata on Broadcast

3.0 In FDC3 3.0, ContextMetadata was introduced as a required second argument to ContextHandler and IntentHandler callbacks. The Desktop Agent MUST provide source and timestamp fields. If the broadcasting app provides a traceId, the Desktop Agent MUST forward it; if not, the Desktop Agent MAY generate one. The signature and custom fields, if provided by the broadcasting app, MUST be forwarded.

AppStepDetails
A1. addContextListenerA adds a typed Context Listener using addContextListener("fdc3.instrument",handler). The handler should accept both context and metadata arguments.
A2. joinUserChannelA joins the first available (non-global) user channel.
B3. joinUserChannelB joins the same channel as A.
B4. BroadcastB broadcasts an fdc3.instrument context to the channel using fdc3.broadcast(<fdc3.instrument>).
A5. Receive Context & MetadataA receives the instrument context matching that sent by B. A also receives a ContextMetadata object as the second argument to the handler.
A6. Validate MetadataCheck that metadata.source is an AppIdentifier with at least appId set, matching B's identity. Check that metadata.timestamp is a valid Date.
  • UCContextMetadataOnBroadcast 3.0+: Perform above test.

Context Metadata with App-Provided traceId

AppStepDetails
A1. addContextListenerA adds a typed Context Listener using addContextListener("fdc3.instrument",handler).
A2. joinUserChannelA joins the first available (non-global) user channel.
B3. joinUserChannelB joins the same channel as A.
B4. Broadcast with metadataB broadcasts an fdc3.instrument context with metadata: fdc3.broadcast(<fdc3.instrument>, { traceId: "test-trace-123" }).
A5. Receive & ValidateA receives the context and metadata. Check that metadata.traceId equals "test-trace-123". Check that metadata.source and metadata.timestamp are also present.
  • UCContextMetadataTraceId 3.0+: Perform above test.

Context Metadata with signature and custom fields

AppStepDetails
A1. addContextListenerA adds a typed Context Listener using addContextListener("fdc3.instrument",handler).
A2. joinUserChannelA joins the first available (non-global) user channel.
B3. joinUserChannelB joins the same channel as A.
B4. Broadcast with metadataB broadcasts with metadata: fdc3.broadcast(<fdc3.instrument>, { signature: "sig-abc", custom: { region: "EMEA" } }).
A5. Receive & ValidateA receives the context and metadata. Check that metadata.signature equals "sig-abc". Check that metadata.custom.region equals "EMEA". Check that metadata.source and metadata.timestamp are present.
  • UCContextMetadataSignatureCustom 3.0+: Perform above test.

Context Metadata on App Channel Broadcast

AppStepDetails
A1. Retrieve ChannelRetrieve a Channel object representing an 'App' channel called test-channel using:
const testChannel = await fdc3.getOrCreateChannel("test-channel")
A2. Add Context ListenerAdd a typed context listener: await testChannel.addContextListener("fdc3.instrument", handler) where handler accepts (context, metadata).
B3. Retrieve ChannelRetrieve the same 'App' channel (test-channel).
B4. BroadcastB broadcasts an fdc3.instrument context to the channel.
A5. Receive & ValidateA receives the context and metadata. Check that metadata.source is an AppIdentifier matching B. Check that metadata.timestamp is a valid Date.
  • ACContextMetadataOnBroadcast 3.0+: Perform above test.

Context Metadata on Intent

AppStepDetails
Test1. Raise Intentfdc3.raiseIntent("lTestingIntent", testContextX) starts app L.
L2. Receive Intent & MetadataAfter starting, L runs fdc3.addIntentListener("lTestingIntent", handler). The handler receives (context, metadata).
L3. Validate MetadataCheck that metadata.source is an AppIdentifier matching Test's identity. Check that metadata.timestamp is a valid Date.
  • IntentContextMetadata 3.0+: Perform above test.

Context Metadata on Intent with App-Provided Metadata

AppStepDetails
Test1. Raise Intent with metadatafdc3.raiseIntent("lTestingIntent", testContextX, undefined, { traceId: "intent-trace-456", signature: "intent-sig", custom: { priority: "high" } }) starts app L.
L2. Receive Intent & MetadataL receives the intent with context and metadata.
L3. Validate MetadataCheck that metadata.traceId equals "intent-trace-456". Check that metadata.signature equals "intent-sig". Check that metadata.custom.priority equals "high". Check that metadata.source and metadata.timestamp are present.
  • IntentContextMetadataWithAppMetadata 3.0+: Perform above test.

getCurrentContextWithMetadata

3.0 In FDC3 3.0, getCurrentContextWithMetadata() was added to the Channel interface to allow retrieval of both the current context and its associated metadata.

AppStepDetails
B1. Retrieve ChannelRetrieve a Channel object representing an 'App' channel called test-channel.
B2. BroadcastB broadcasts an fdc3.instrument context to the channel.
A3. Retrieve ChannelRetrieve the same 'App' channel (test-channel).
A4. Get Context With MetadataA calls await testChannel.getCurrentContextWithMetadata("fdc3.instrument").
A5. ValidateCheck that the result is a ContextWithMetadata object. Check that result.context matches the instrument broadcast by B. Check that result.metadata.source is an AppIdentifier matching B. Check that result.metadata.timestamp is a valid Date.
  • ACGetCurrentContextWithMetadata 3.0+: Perform above test.
AppStepDetails
A1. Retrieve ChannelRetrieve a Channel object representing an 'App' channel called test-channel.
A2. Get Context With MetadataA calls await testChannel.getCurrentContextWithMetadata("fdc3.instrument") on a channel with no prior broadcasts.
A3. ValidateCheck that the result is null.
  • ACGetCurrentContextWithMetadataNull 3.0+: Perform above test.