Mock created by designer for custom code action instantly fails in unit test
- Dominant language
- TypeScript
- Stars
- 111
- Forks
- 109
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 20
Description
### Severity
P3 - Medium (Minor functionality affected)
### Describe the Bug with repro steps
**Expected behaviour** is that when creating an example unit test from the toolbar in the workflow design view that the Mocks created should be what the unit testing framework expects,
**Actual behaviour** is that the Mock created for this action just has a constructor and no properties defined. When the workflow is run in the test executor it then fails with
Error UnitTestActionMockDataValidationError In the unit test, the 'Call_My_Function' mock action needs to define the 'body' field.
Repro:
Create a workflow calling a custom code action, go to the designer, click "create unit test" and then run that test
**Possible workaround?**
Adding a property to the class ` public JObject Body { get; set; }` and initialising that in the constructor at least makes the first error go away, But is this the expected implementation for these Mocks? And is it missing any other properties that also should be present?
Additionally can the mock/outputs process creation logic be documented so we can do this ourselves? Having to create all the Mocks for a workflow up front by visiting the UI adds an unwanted manual step. I've also found the UI creation unreliable and it often only creates a subset of the mockable actions in the flow (maybe one of each type rather than one for each action?),
I'd like to be able to just get copilot to write tests for workflows without first needing to either click any buttons in the UI to create mocks or have to, myself, create and maintain an exhaustive list of all possible mock definitions for all possible mockable action / trigger types for copilot to refer to.
### What type of Logic App Is this happening in?
Standard (VSCode)
### Are you experiencing a regression?
_No response_
### Which operating system are you using?
Windows
### Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg
Yes
### Workflow JSON
```json
```
### Screenshots or Videos
_No response_
### Environment
Logic Apps standard extension 5.185.9
VS Code Version: 1.105.1
### Additional context
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.