-
Hello, When trying to execute individual tests created with a ITestDataSource, all the tests execute instead. Why is this happening? This is the public class TenantDataSourceAttribute : Attribute, ITestDataSource
{
private readonly string _filePath;
public TenantDataSourceAttribute(string filePath) => _filePath = filePath;
[Delimiter(";")]
[CultureInfo("es-ES")]
public record Fila
{
public string USERNAME { get; set; }
public string APPNAME { get; set; }
public string Dominio { get; set; }
}
public IEnumerable<object[]> GetData(MethodInfo methodInfo)
{
using var reader = new StreamReader(_filePath);
using var csv = new CsvReader(reader, CsvConfiguration.FromAttributes<Fila>());
return csv.GetRecords<Fila>().Select(fila => new[] { fila.USERNAME, fila.APPNAME, fila.Dominio }).ToList();
}
public string GetDisplayName(MethodInfo methodInfo, object[] data) => $"Tenant: {data[2]}";
} Packages: <ItemGroup>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.14.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.Testing.Extensions.CodeCoverage" Version="17.14.2" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="Microsoft.Testing.Extensions.TrxReport" Version="1.8.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="MSTest.Analyzers" Version="3.10.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Update="MSTest.TestAdapter" Version="3.10.1" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="MSTest.TestFramework" Version="3.10.1" />
</ItemGroup> Thank you. Regards. |
Beta Was this translation helpful? Give feedback.
Answered by
elgatov
Aug 6, 2025
Replies: 2 comments
-
After upgrading the following packages they will be reset to previous versions when running tests again: ![]() |
Beta Was this translation helpful? Give feedback.
0 replies
-
Fixed it by changing the project header to <Project Sdk="MSTest.Sdk/3.10.1">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
</Project> And reexecuting. Now only one the selected test executes. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
elgatov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fixed it by changing the project header to
And reexecuting. Now only one the selected test executes.