Exemplo n.º 1
0
    void GitCloneAndBuild(ExplorationTestDescription testDescription)
    {
        if (Framework != null && !testDescription.IsFrameworkSupported(Framework))
        {
            throw new InvalidOperationException($"The framework '{Framework}' is not listed in the project's target frameworks of {testDescription.Name}");
        }

        var depth      = testDescription.IsGitShallowCloneSupported ? "--depth 1" : "";
        var submodules = testDescription.IsGitSubmodulesRequired ? "--recurse-submodules" : "";
        var source     = ExplorationTestCloneLatest ? testDescription.GitRepositoryUrl : $"-b {testDescription.GitRepositoryTag} {testDescription.GitRepositoryUrl}";
        var target     = $"{ExplorationTestsDirectory}/{testDescription.Name}";

        var cloneCommand = $"clone -q -c advice.detachedHead=false {depth} {submodules} {source} {target}";

        GitTasks.Git(cloneCommand);

        var projectPath = $"{ExplorationTestsDirectory}/{testDescription.Name}/{testDescription.PathToUnitTestProject}";

        if (!Directory.Exists(projectPath))
        {
            throw new DirectoryNotFoundException($"Test path '{projectPath}' doesn't exist.");
        }

        DotNetBuild(
            x => x
            .SetProjectFile(projectPath)
            .SetConfiguration(BuildConfiguration)
            .SetProcessArgumentConfigurator(arguments => arguments.Add("-consoleLoggerParameters:ErrorsOnly"))
            .When(Framework != null, settings => settings.SetFramework(Framework))
            );
    }
Exemplo n.º 2
0
    void RunUnitTest(ExplorationTestDescription testDescription, Dictionary <string, string> envVariables)
    {
        Logger.Info($"Running exploration test {testDescription.Name}.");

        if (Framework != null && !testDescription.IsFrameworkSupported(Framework))
        {
            throw new InvalidOperationException($"The framework '{Framework}' is not listed in the project's target frameworks of {testDescription.Name}");
        }

        DotNetTest(
            x =>
        {
            x = x
                .SetProjectFile(testDescription.GetTestTargetPath(ExplorationTestsDirectory, Framework, BuildConfiguration))
                .EnableNoRestore()
                .EnableNoBuild()
                .SetConfiguration(BuildConfiguration)
                .When(Framework != null, settings => settings.SetFramework(Framework))
                .SetProcessEnvironmentVariables(envVariables)
                .SetIgnoreFilter(testDescription.TestsToIgnore)
                .WithMemoryDumpAfter(1)
            ;

            return(x);
        });
    }