Skip to content

getIdentifierForLastFailedInstruction (Team Notifications, Alerts and Collaboration)

Compatible with:
  • Purpose
  • This command gets the test instruction identifier for the last failed test instruction within the test run that this command is executing as part of.
    • The 'target' for this command has to be a 'variable' (name string) into which the 'instructionIdentifier' for the last failed test instruction within the test run will be stored.
    • The optional 'value' for this command is the 'name of the command' for which you want the 'instructionIdentifier'. When you pass a command name into the 'value' field for this command, Worksoft SaaS will return the identifier for the test instruction that involves the 'command' you passed into the 'value' field AND corresponds to the last failure experienced for that specific command during execution. If you had several instructions that failed before the instruction that executes this command but you are interested in attaching or embedding inline a screenshot that corresponds to a specific command (say 'verifyText') that is not necessarily the immediately preceding test instruction, then this optional input parameter will of great value to you.
    The 'instructionId' stored into the variable can then be used as input to the command 'setAttachmentScreenshot' (to attach the screenshot as an attachment to the email) or the command 'createBodyPartFromScreenshot' in combination with the command 'appendBodyPartToBody' to get the screenshot embedded inline into the email body.  
    The returned InstructionIdentifier can be used in setAttachmentScreenshot command.
    If the name of the command passed as optional input into the 'value' field of the test instruction does not exist in the test run (may be because you accidentally had a typo in the value passed into the 'value' field), then the instruction with fail in the test but the test will not be aborted. The error message will be "Name of the Command passed into the 'value' field of this test instruction does not exist in this test run."
  • Syntax
  • getIdentifierForLastFailedInstruction(variableName, CommandName(Optional))
  • Target
  • Variable Name
  • Value
  • Command Name (Optional)
  • Return Value
  • N/A

Example(s):

Click here to see the example


 

Feedback and Knowledge Base