public virtual void ExecuteCommand(IAutoBotCommand command, string componentName) { _logger.LogVerbose($"Target component key is: { componentName }"); string commandClassName = command.GetType().Name; _logger.LogVerbose($"Current command is: { commandClassName }"); Source source = _navigator.GetCurrentSource(); string sourceClassName = source.GetType().Name; _logger.LogVerbose($"Current source is: { sourceClassName }"); object component = source.GetComponent(componentName); string componentClassName = component.GetType().Name; _logger.LogVerbose($"Current component is: { componentClassName }"); command.Execute(component); _logger.LogVerbose($"{ componentName }::{ commandClassName }::{ sourceClassName }::{ componentClassName } command complete."); }
public override void ExecuteCommand(IAutoBotCommand command, string componentName) { string commandString = $"{ componentName }::{ command.GetType().Name }"; try { Exception[] exceptions = RunIterativelyAndCollectExceptions(commandString, () => { base.ExecuteCommand(command, componentName); }); if (exceptions.Length > 0) { throw new AutoBotCommandFailedException(command, componentName, exceptions); } } catch { _logger.TakeScreenshot($"ERROR: { commandString } Test Failed."); throw; } }
public AutoBotCommandFailedException(IAutoBotCommand command, string componentName, IEnumerable <Exception> innerExceptions) : base($"{command.GetType().Name} command failed on '{componentName}'", innerExceptions) { Command = command; ComponentName = componentName; }