Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ internal sealed class PlatformCommandLineProvider : ICommandLineOptionsProvider
public const string TestHostControllerPIDOptionKey = "internal-testhostcontroller-pid";
public const string ExitOnProcessExitOptionKey = "exit-on-process-exit";
public const string ConfigFileOptionKey = "config-file";
public const string FilterUidOptionKey = "filter-uid";

public const string ServerOptionKey = "server";
public const string ClientPortOptionKey = "client-port";
Expand Down Expand Up @@ -57,6 +58,7 @@ internal sealed class PlatformCommandLineProvider : ICommandLineOptionsProvider
new(IgnoreExitCodeOptionKey, PlatformResources.PlatformCommandLineIgnoreExitCodeOptionDescription, ArgumentArity.ExactlyOne, false, isBuiltIn: true),
new(ExitOnProcessExitOptionKey, PlatformResources.PlatformCommandLineExitOnProcessExitOptionDescription, ArgumentArity.ExactlyOne, false, isBuiltIn: true),
new(ConfigFileOptionKey, PlatformResources.PlatformCommandLineConfigFileOptionDescription, ArgumentArity.ExactlyOne, false, isBuiltIn: true),
new(FilterUidOptionKey, PlatformResources.PlatformCommandLineFilterUidOptionDescription, ArgumentArity.OneOrMore, false, isBuiltIn: true),

// Hidden options
new(HelpOptionQuestionMark, PlatformResources.PlatformCommandLineHelpOptionDescription, ArgumentArity.Zero, true, isBuiltIn: true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.Testing.Platform.CommandLine;
using Microsoft.Testing.Platform.Extensions.Messages;
using Microsoft.Testing.Platform.Helpers;
using Microsoft.Testing.Platform.Resources;

Expand All @@ -21,8 +22,18 @@ internal sealed class ConsoleTestExecutionFilterFactory(ICommandLineOptions comm

public Task<bool> IsEnabledAsync() => Task.FromResult(true);

public Task<(bool Success, ITestExecutionFilter? TestExecutionFilter)> TryCreateAsync() =>
_commandLineService.TryGetOptionArgumentList(TreeNodeFilterCommandLineOptionsProvider.TreenodeFilter, out string[]? filter)
? Task.FromResult((true, (ITestExecutionFilter?)new TreeNodeFilter(filter[0])))
: Task.FromResult((true, (ITestExecutionFilter?)new NopFilter()));
public Task<(bool Success, ITestExecutionFilter? TestExecutionFilter)> TryCreateAsync()
{
bool hasTreenodeFilter = _commandLineService.TryGetOptionArgumentList(TreeNodeFilterCommandLineOptionsProvider.TreenodeFilter, out string[]? treenodeFilter);
bool hasTestNodeUidFilter = _commandLineService.TryGetOptionArgumentList(PlatformCommandLineProvider.FilterUidOptionKey, out string[]? uidFilter);
ITestExecutionFilter filter = (hasTreenodeFilter, hasTestNodeUidFilter) switch
{
(true, true) => throw new NotSupportedException(PlatformResources.OnlyOneFilterSupported),
(true, false) => new TreeNodeFilter(treenodeFilter![0]),
(false, true) => new TestNodeUidListFilter([.. uidFilter!.Select(x => new TestNodeUid(x))]),
(false, false) => new NopFilter(),
};

return Task.FromResult<(bool, ITestExecutionFilter?)>((true, filter));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ namespace Microsoft.Testing.Platform.Requests;

internal interface ITestExecutionFilterFactory : IExtension
{
public Task<(bool Success, ITestExecutionFilter? TestExecutionFilter)> TryCreateAsync();
Task<(bool Success, ITestExecutionFilter? TestExecutionFilter)> TryCreateAsync();
}
Original file line number Diff line number Diff line change
Expand Up @@ -707,4 +707,10 @@ Takes one argument as string in the format &lt;value&gt;[h|m|s] where 'value' is
<data name="AbortForMaxFailedTestsCapabilityNotAvailable" xml:space="preserve">
<value>The current test framework does not implement 'IGracefulStopTestExecutionCapability' which is required for '--maximum-failed-tests' feature.</value>
</data>
<data name="PlatformCommandLineFilterUidOptionDescription" xml:space="preserve">
<value>Provides a list of test node UIDs to filter by.</value>
</data>
<data name="OnlyOneFilterSupported" xml:space="preserve">
<value>Passing both '--treenode-filter' and '--filter-uid' is unsupported.</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@
<target state="translated">Nenalezeno</target>
<note />
</trans-unit>
<trans-unit id="OnlyOneFilterSupported">
<source>Passing both '--treenode-filter' and '--filter-uid' is unsupported.</source>
<target state="new">Passing both '--treenode-filter' and '--filter-uid' is unsupported.</target>
<note />
</trans-unit>
<trans-unit id="OutOfProcessArtifactsProduced">
<source>Out of process file artifacts produced:</source>
<target state="translated">Vytvořené artefakty souboru mimo proces:</target>
Expand Down Expand Up @@ -533,6 +538,11 @@ Dostupné hodnoty jsou Trace, Debug, Information, Warning, Error a Critical.</ta
<target state="translated">„ --{0}“ očekává jeden argument int PID.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineFilterUidOptionDescription">
<source>Provides a list of test node UIDs to filter by.</source>
<target state="new">Provides a list of test node UIDs to filter by.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineHelpOptionDescription">
<source>Show the command line help.</source>
<target state="translated">Umožňuje zobrazit nápovědu příkazového řádku.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@
<target state="translated">Nicht gefunden</target>
<note />
</trans-unit>
<trans-unit id="OnlyOneFilterSupported">
<source>Passing both '--treenode-filter' and '--filter-uid' is unsupported.</source>
<target state="new">Passing both '--treenode-filter' and '--filter-uid' is unsupported.</target>
<note />
</trans-unit>
<trans-unit id="OutOfProcessArtifactsProduced">
<source>Out of process file artifacts produced:</source>
<target state="translated">Nicht verarbeitete Dateiartefakte erstellt:</target>
Expand Down Expand Up @@ -533,6 +538,11 @@ Die verfügbaren Werte sind "Trace", "Debug", "Information", "Warning", "Error"
<target state="translated">"--{0}" erwartet ein einzelnes int-PID-Argument.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineFilterUidOptionDescription">
<source>Provides a list of test node UIDs to filter by.</source>
<target state="new">Provides a list of test node UIDs to filter by.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineHelpOptionDescription">
<source>Show the command line help.</source>
<target state="translated">Zeigen Sie die Hilfe zur Befehlszeile an.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@
<target state="translated">No se encontró</target>
<note />
</trans-unit>
<trans-unit id="OnlyOneFilterSupported">
<source>Passing both '--treenode-filter' and '--filter-uid' is unsupported.</source>
<target state="new">Passing both '--treenode-filter' and '--filter-uid' is unsupported.</target>
<note />
</trans-unit>
<trans-unit id="OutOfProcessArtifactsProduced">
<source>Out of process file artifacts produced:</source>
<target state="translated">Artefactos de archivo fuera de proceso producidos:</target>
Expand Down Expand Up @@ -533,6 +538,11 @@ Los valores disponibles son 'Seguimiento', 'Depurar', 'Información', 'Advertenc
<target state="translated">'--{0}' espera un único argumento PID entero</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineFilterUidOptionDescription">
<source>Provides a list of test node UIDs to filter by.</source>
<target state="new">Provides a list of test node UIDs to filter by.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineHelpOptionDescription">
<source>Show the command line help.</source>
<target state="translated">Muestre la ayuda de la línea de comandos.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@
<target state="translated">Introuvable</target>
<note />
</trans-unit>
<trans-unit id="OnlyOneFilterSupported">
<source>Passing both '--treenode-filter' and '--filter-uid' is unsupported.</source>
<target state="new">Passing both '--treenode-filter' and '--filter-uid' is unsupported.</target>
<note />
</trans-unit>
<trans-unit id="OutOfProcessArtifactsProduced">
<source>Out of process file artifacts produced:</source>
<target state="translated">Artefacts de fichier hors processus produits :</target>
Expand Down Expand Up @@ -533,6 +538,11 @@ Les valeurs disponibles sont « Trace », « Debug », « Information »,
<target state="translated">« --{0} » attend un seul argument PID int</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineFilterUidOptionDescription">
<source>Provides a list of test node UIDs to filter by.</source>
<target state="new">Provides a list of test node UIDs to filter by.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineHelpOptionDescription">
<source>Show the command line help.</source>
<target state="translated">Afficher l’aide de la ligne de commande.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@
<target state="translated">Non trovato</target>
<note />
</trans-unit>
<trans-unit id="OnlyOneFilterSupported">
<source>Passing both '--treenode-filter' and '--filter-uid' is unsupported.</source>
<target state="new">Passing both '--treenode-filter' and '--filter-uid' is unsupported.</target>
<note />
</trans-unit>
<trans-unit id="OutOfProcessArtifactsProduced">
<source>Out of process file artifacts produced:</source>
<target state="translated">Artefatti file non in elaborazione prodotti:</target>
Expand Down Expand Up @@ -533,6 +538,11 @@ I valori disponibili sono 'Trace', 'Debug', 'Information', 'Warning', 'Error' e
<target state="translated">'--{0}' prevede un singolo argomento PID int</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineFilterUidOptionDescription">
<source>Provides a list of test node UIDs to filter by.</source>
<target state="new">Provides a list of test node UIDs to filter by.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineHelpOptionDescription">
<source>Show the command line help.</source>
<target state="translated">Mostra la Guida della riga di comando.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@
<target state="translated">見つかりません</target>
<note />
</trans-unit>
<trans-unit id="OnlyOneFilterSupported">
<source>Passing both '--treenode-filter' and '--filter-uid' is unsupported.</source>
<target state="new">Passing both '--treenode-filter' and '--filter-uid' is unsupported.</target>
<note />
</trans-unit>
<trans-unit id="OutOfProcessArtifactsProduced">
<source>Out of process file artifacts produced:</source>
<target state="translated">アウトプロセスのファイル成果物が生成されました:</target>
Expand Down Expand Up @@ -534,6 +539,11 @@ The available values are 'Trace', 'Debug', 'Information', 'Warning', 'Error', an
<target state="translated">'--{0}' には 1 つの int PID 引数が必要です</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineFilterUidOptionDescription">
<source>Provides a list of test node UIDs to filter by.</source>
<target state="new">Provides a list of test node UIDs to filter by.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineHelpOptionDescription">
<source>Show the command line help.</source>
<target state="translated">コマンド ラインヘルプを表示します。</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@
<target state="translated">찾을 수 없음</target>
<note />
</trans-unit>
<trans-unit id="OnlyOneFilterSupported">
<source>Passing both '--treenode-filter' and '--filter-uid' is unsupported.</source>
<target state="new">Passing both '--treenode-filter' and '--filter-uid' is unsupported.</target>
<note />
</trans-unit>
<trans-unit id="OutOfProcessArtifactsProduced">
<source>Out of process file artifacts produced:</source>
<target state="translated">생성된 Out of process 파일 아티팩트:</target>
Expand Down Expand Up @@ -533,6 +538,11 @@ The available values are 'Trace', 'Debug', 'Information', 'Warning', 'Error', an
<target state="translated">'--{0}'에는 단일 int PID 인수가 필요합니다.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineFilterUidOptionDescription">
<source>Provides a list of test node UIDs to filter by.</source>
<target state="new">Provides a list of test node UIDs to filter by.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineHelpOptionDescription">
<source>Show the command line help.</source>
<target state="translated">명령줄 도움말을 표시합니다.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@
<target state="translated">Nie znaleziono</target>
<note />
</trans-unit>
<trans-unit id="OnlyOneFilterSupported">
<source>Passing both '--treenode-filter' and '--filter-uid' is unsupported.</source>
<target state="new">Passing both '--treenode-filter' and '--filter-uid' is unsupported.</target>
<note />
</trans-unit>
<trans-unit id="OutOfProcessArtifactsProduced">
<source>Out of process file artifacts produced:</source>
<target state="translated">Wygenerowane artefakty pliku poza procesem:</target>
Expand Down Expand Up @@ -533,6 +538,11 @@ Dostępne wartości to „Trace”, „Debug”, „Information”, „Warning
<target state="translated">„--{0}” oczekuje pojedynczego argumentu int identyfikatora PID</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineFilterUidOptionDescription">
<source>Provides a list of test node UIDs to filter by.</source>
<target state="new">Provides a list of test node UIDs to filter by.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineHelpOptionDescription">
<source>Show the command line help.</source>
<target state="translated">Pokaż pomoc wiersza polecenia.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@
<target state="translated">Não encontrado</target>
<note />
</trans-unit>
<trans-unit id="OnlyOneFilterSupported">
<source>Passing both '--treenode-filter' and '--filter-uid' is unsupported.</source>
<target state="new">Passing both '--treenode-filter' and '--filter-uid' is unsupported.</target>
<note />
</trans-unit>
<trans-unit id="OutOfProcessArtifactsProduced">
<source>Out of process file artifacts produced:</source>
<target state="translated">Artefatos de arquivo fora do processo produzidos:</target>
Expand Down Expand Up @@ -533,6 +538,11 @@ Os valores disponíveis são 'Rastreamento', 'Depuração', 'Informação', 'Avi
<target state="translated">"--{0}" espera um único argumento int PID</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineFilterUidOptionDescription">
<source>Provides a list of test node UIDs to filter by.</source>
<target state="new">Provides a list of test node UIDs to filter by.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineHelpOptionDescription">
<source>Show the command line help.</source>
<target state="translated">Mostrar a ajuda da linha de comando.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@
<target state="translated">Не найдено</target>
<note />
</trans-unit>
<trans-unit id="OnlyOneFilterSupported">
<source>Passing both '--treenode-filter' and '--filter-uid' is unsupported.</source>
<target state="new">Passing both '--treenode-filter' and '--filter-uid' is unsupported.</target>
<note />
</trans-unit>
<trans-unit id="OutOfProcessArtifactsProduced">
<source>Out of process file artifacts produced:</source>
<target state="translated">Созданные вне процесса артефакты файлов:</target>
Expand Down Expand Up @@ -533,6 +538,11 @@ The available values are 'Trace', 'Debug', 'Information', 'Warning', 'Error', an
<target state="translated">"--{0}" ожидает один аргумент int PID</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineFilterUidOptionDescription">
<source>Provides a list of test node UIDs to filter by.</source>
<target state="new">Provides a list of test node UIDs to filter by.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineHelpOptionDescription">
<source>Show the command line help.</source>
<target state="translated">Показать справку по командной строке.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@
<target state="translated">Bulunamadı</target>
<note />
</trans-unit>
<trans-unit id="OnlyOneFilterSupported">
<source>Passing both '--treenode-filter' and '--filter-uid' is unsupported.</source>
<target state="new">Passing both '--treenode-filter' and '--filter-uid' is unsupported.</target>
<note />
</trans-unit>
<trans-unit id="OutOfProcessArtifactsProduced">
<source>Out of process file artifacts produced:</source>
<target state="translated">Üretilen işlem dışı dosya yapıtları:</target>
Expand Down Expand Up @@ -533,6 +538,11 @@ Kullanılabilir değerler: 'Trace', 'Debug', 'Information', 'Warning', 'Error' v
<target state="translated">'--{0}', tek bir int PID bağımsız değişkeni bekliyor</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineFilterUidOptionDescription">
<source>Provides a list of test node UIDs to filter by.</source>
<target state="new">Provides a list of test node UIDs to filter by.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineHelpOptionDescription">
<source>Show the command line help.</source>
<target state="translated">Komut satırı yardımını gösterir.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@
<target state="translated">未找到</target>
<note />
</trans-unit>
<trans-unit id="OnlyOneFilterSupported">
<source>Passing both '--treenode-filter' and '--filter-uid' is unsupported.</source>
<target state="new">Passing both '--treenode-filter' and '--filter-uid' is unsupported.</target>
<note />
</trans-unit>
<trans-unit id="OutOfProcessArtifactsProduced">
<source>Out of process file artifacts produced:</source>
<target state="translated">生成的进程外文件项目:</target>
Expand Down Expand Up @@ -533,6 +538,11 @@ The available values are 'Trace', 'Debug', 'Information', 'Warning', 'Error', an
<target state="translated">“--{0}”需要单个 int PID 参数</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineFilterUidOptionDescription">
<source>Provides a list of test node UIDs to filter by.</source>
<target state="new">Provides a list of test node UIDs to filter by.</target>
<note />
</trans-unit>
<trans-unit id="PlatformCommandLineHelpOptionDescription">
<source>Show the command line help.</source>
<target state="translated">显示命令行帮助。</target>
Expand Down
Loading
Loading