Running UnrealBuildTool unit tests

What is the correct way to run the UnrealBuildTool unit tests?

When I try to run them from visual studio the “SourceFileTests” test always fails with the error “System.Exception: This code requires that applications using it are launched from a path containing “Engine/Source/Programs”. This application was launched from D:\Polaris\Game\Engine\Binaries\DotNET\UnrealBuildTool.Tests\net8.0”

I have not been able to find any documentation about how to run these unit tests from a specific working directory. They always bring up and run the Test Explorer.

Steps to Reproduce
Open Engine/Source/Programs/UnrealBuildTool/UnrealBuildTool.sln solution.

right click on UnrealBuildTool.Tests and select Run Tests

Hi,

There is a bug in the test’s code. You can fix by removing the call to UnrealHelper.InitializePath().

`namespace UnrealBuildToolTests
{
///


/// Tests for reading source file markup
///

[TestClass]
public class SourceFileTests
{
[TestMethod]
public void Run()
{
// UnrealHelper.InitializePath();

List baseDirectories = new List();
baseDirectories.Add(DirectoryReference.Combine(Unreal.EngineSourceDirectory, “Runtime”));`

Regards,

Martin