dotnet / dotnet/arcade

Enable write test outputs from test executor

Open
#5,256 0 comments 0 reactions 0 assignees View on GitHub
help wanted
Dominant language
C#
Stars
729
Forks
397
Avg merge
3d 15m
Merged PRs (30d)
149

Description

- [ ] This issue is blocking
- [ ] This issue is causing unreasonable pain

Now it is not easy to output messages to test results from RemoteExecutor callback.

example of a current solution:
```C#
[Fact]
public void TestMethod()
{
var logFilePath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
File.WriteAllText(logFilePath, "");

try
{
RemoteExecutor.Invoke((logFilePath) => {
File.AppendAllText(logFilePath, "Message to log");
}, logFilePath).Dispose();
}
catch {
throw;
}
finally{
_output.WriteLine(File.ReadAllText(logFilePath));
// delete temp file
}
}
```

Proposed:
```C#
[Fact]
public void TestMethod()
{
RemoteExecutor.Invoke((_output) => {
_output.WriteLine("Message to log");
}, _output).Dispose();
}
```

The disadvantage of this proposal is the number of Invoke method overloads.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.