Skip to main content
Version: 6.1.0

Track Feature failures

Frame can track code-level functions and report issues that may arise during its execution. Please refer Function Tracking section, before continuing with this section.

Feature tracking allows developers to track any feature in the iOS app by chaining two or more functions.

Take the example of Chat feature in any e-commerce android application. Consider that the function at the time of tapping the Send button is 'sendChat' and 'onChatSent' is the function that gets called after the text is successfully sent.

Follow the next steps to enable tracking Chat feature for failure,

  1. First function sendChat need to be invoked either using Fn.call() API or using Fn.start() and Fn.end() APIs.
  2. Second function onChatSent needs to be invoked using the same API used in step 1.
  3. Next, chain both the functions using nextFunctionSignature and inClass fields of Observe class of the first function.
  4. Use expectedChainedExecutionTime field in Observe class to set the expected time it will take to execute the second function after the first function.

Once done, framework monitors if second function 'onChatSent' is executed after the execution of first function 'sendChat'. If the 'onChatSent' is not executed within expectedChainedExecutionTime in milliseconds (default value is 2000 milliseconds) then a corresponding issue will be raised.

Method 1 - Using Fn.call() API


#import <FinotesCore/Observer.h>
#import <FinotesCore/Fn.h>


- (void) sendChatClicked:(UITapGestureRecognizer *)recognizer {

// Here function 'onChatSent:' is
// expected to be called in under '10000' milliseconds.
Observer *observer = [[[Fn observe] expectedChainedExecutionTime:10000]
nextFunctionSignature:
@selector(onChatSent:)
inClass:[self class]];
[Fn call:@selector(sendChat:) target:self observer:observer withParameters:chatMessage];
}

- (Boolean) sendChat:(NSString *) message {
if([self isValid:message]){
[self syncMessage:message];
}
return false;
}

- (void) onChatSent:(NSString *)chatMessageId {
[self chatSyncConfirmed:chatMessageId];
}

Things to Note:

  1. Here both functions 'sendChat' and 'onChatSent' are invoked using Fn.call() API.
  2. Both functions are chained using 'nextFunctionId' and 'nextFunctionClass' fields of Observe class in the first function.
  3. Here 'nextFunctionSignature' is the @selector of the second function and 'inClass' is the class where the second function is defined.
  4. 'expectedChainedExecutionTime' in first function 'sendChat' overrides time needed to execute second function after execution of first function.

Method 2 - Using Fn.start() and Fn.end() APIs


#import <FinotesCore/Observer.h>
#import <FinotesCore/Fn.h>


- (void) sendChatClicked:(UITapGestureRecognizer *)recognizer {

[self sendChat:chatMessage];
}

- (Boolean) sendChat:(NSString *) message {
// Here function 'onChatSent:' is
// expected to be called in under '10000' milliseconds.
Observer *observer = [[[Fn observe] expectedChainedExecutionTime:10000]
nextFunctionSignature:
@selector(onChatSent:)
inClass:[self class]];
[Fn start:observer withParams:[NSArray arrayWithObjects:message]];


if([self isValid:message]){
[self syncMessage:message];

[Fn end:true];
return true;
}

[Fn end:false];
return false;
}

- (void) onChatSent:(NSString *)chatMessageId {
[Fn start:[[Observer alloc] init] withParams:[NSArray arrayWithObjects:chatMessageId]];

[self chatSyncConfirmed:chatMessageId];

[Fn end];
}

Things to Note:

  1. Both functions are chained using 'nextFunctionSignature' and 'inClass' fields of Observe class in the first function.
  2. Here 'nextFunctionSignature' is the @selector of the second function and 'inClass' is the class where the second function is defined.
  3. 'expectedChainedExecutionTime' in first function 'sendChat' overrides time (default is 2000 milliseconds) expected to execute second function after execution of first function.

Observe fields

Chain two functions using nextFunctionSignature, inClass, expectedChainedExecutionTime fields in Observe.

Expected Chained Execution Time

When two functions are chained, expectedChainedExecutionTime field in Observe determines the expected time between the execution of two functions.
Issue will be reported to the dashboard if the second function is not called within the expected time after the execution of the first function. Default time is 2000 milliseconds.