NightOwl888 commented on issue #768: URL: https://github.com/apache/lucenenet/issues/768#issuecomment-1355952643
Actually, after thinking this through a bit more, rather than wiring up a new console app, it makes more sense to simply fire up `dotnet test` and point it to the assembly that has the test in it with an [NUnit filter](https://docs.nunit.org/articles/nunit/running-tests/Test-Selection-Language.html) to only run the one test. The test framework extends NUnit and contains a lot of plumbing that will be required to get test to set up properly so this will save a lot of work. We don't need to dynamically compile anything because the project this test is in contains the test we need to run. So by the time we run the test there is already a DLL file that we can pass to `dotnet test` to run. The test just needs to use the assembly that it is in to get the full path of the DLL file to execute. See https://stackoverflow.com/a/52956. As for target framework, we have another test where we have done that already. - [InstallationTest](https://github.com/apache/lucenenet/blob/c0c480409e2d3424fbdcc563426c66cacbf72632/src/dotnet/tools/Lucene.Net.Tests.Cli/InstallationTest.cs#L123-L129) reads a custom `MetaDataAttribute` where the moniker for the current target framework is compiled into the assembly. - The build adds the `MetaDataAttribute` [here](https://github.com/apache/lucenenet/blob/c0c480409e2d3424fbdcc563426c66cacbf72632/src/dotnet/tools/Lucene.Net.Tests.Cli/Lucene.Net.Tests.Cli.csproj#L52-L58). Simply use the same approach in the `Lucene.Net.Tests._I-J.csproj` file. The above test also has an example of using `System.Diagnostics.Process` to launch an external command. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
