# Automated Testing of Action Bindings in Enhanced Input: Issue with Execute Function for Enhanced Input

**URL:** <https://forums.unrealengine.com/t/automated-testing-of-action-bindings-in-enhanced-input-issue-with-execute-function-for-enhanced-input/1806880>\
**Category:** Programming & Scripting\
**Tags:** Input, automated-testing, unreal-engine\
**Created:** [April 16, 2024, 6:46pm UTC](https://forums.unrealengine.com/t/automated-testing-of-action-bindings-in-enhanced-input-issue-with-execute-function-for-enhanced-input/1806880 "2024-04-16T18:46:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pabloerizo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pabloerizo](https://forums.unrealengine.com/u/Pabloerizo)\
**Post date:** [April 16, 2024, 6:46pm UTC](https://forums.unrealengine.com/t/automated-testing-of-action-bindings-in-enhanced-input-issue-with-execute-function-for-enhanced-input/1806880/1 "2024-04-16T18:46:57Z")

</div>

I’m writing automated tests where a character needs to perform various actions like jumping or running using the Enhanced Input system in Unreal Engine. Previously, in the old input system, testing `BindAction` could be done with a simple `Execute(Key)` function call. However, in Enhanced Input, this approach doesn’t work because the `Execute` function expects an `InputActionInstance` structure where no values can be changed.

Example 1:

```auto
void DoInputAction(UInputComponent* Input, const FString& ActionName, const FKey& Key)
{
    if (!Input) return;

    const int32 ActionIndex = GetActionBindingIndexByName(Input, ActionName, EInputEvent::IE_Pressed);
    if (ActionIndex != INDEX_NONE)
    {
        const auto ActionBind = Input->GetActionBinding(ActionIndex);
        ActionBind.ActionDelegate.Execute(Key); // This approach doesn't work for Enhanced Input
    }
}

```

Example 2:

```auto
for (auto& ActionBinding : InputComp->GetActionEventBindings())
{
    const ETriggerEvent TriggerEvent = ActionBinding->GetTriggerEvent();
    const FString ActionName = ActionBinding->GetAction()->GetName();

    if (TriggerEvent == ETriggerEvent::Triggered && ActionName == "IA_Move")
    {
        FInputActionInstance InputActionInstance;
        ActionBinding->Execute(InputActionInstance); // This code doesn't work due to InputActionInstance structure limitations
    }
}

```

How to elegantly write automated tests for Action Bindings in Enhanced Input, considering the constraints of the `InputActionInstance` structure and the inability to use `Execute` to trigger actions?
