Example #1
0
        public static ContainerLauncher TryStartLocalCIRemoteContainer(string logDirectory)
        {
            var containerLauncher = new ContainerLauncher("localhost", "test-remotewarewolf", "latest", true);

            containerLauncher.LogOutputDirectory = logDirectory;
            return(containerLauncher);
        }
Example #2
0
        public static ContainerLauncher StartLocalMSSQLContainer(string logDirectory)
        {
            var containerLauncher = new ContainerLauncher("mssql-connector-testing", "test-mssql", "localhost");

            Thread.Sleep(30000);
            containerLauncher.LogOutputDirectory = logDirectory;
            return(containerLauncher);
        }
Example #3
0
        public static ContainerLauncher StartLocalCIRemoteContainer(string logDirectory)
        {
            var containerLauncher = new ContainerLauncher("ciremote", "test-remotewarewolf")
            {
                LogOutputDirectory = logDirectory
            };

            return(containerLauncher);
        }
Example #4
0
        public static ContainerLauncher StartLocalRabbitMQContainer(string logDirectory)
        {
            var containerLauncher = new ContainerLauncher("rabbitmq-connector-testing", "test-rabbitmq", "localhost")
            {
                LogOutputDirectory = logDirectory
            };

            Thread.Sleep(120000);
            return(containerLauncher);
        }
Example #5
0
        public static ContainerLauncher StartLocalMySQLContainer(string logDirectory)
        {
            var containerLauncher = new ContainerLauncher("mysql-connector-testing", "test-mysql", "localhost", "withnewproc")
            {
                LogOutputDirectory = logDirectory
            };
            string sourcePath = Environment.ExpandEnvironmentVariables(@"%programdata%\Warewolf\Resources\Sources\Database\NewMySqlSource.bite");

            File.WriteAllText(sourcePath, InsertServerSourceAddress(File.ReadAllText(sourcePath), $"Server={containerLauncher.IP};Database=test;Uid=root;Pwd=admin;"));
            Thread.Sleep(30000);
            return(containerLauncher);
        }
Example #6
0
        public static TestLauncher PargeArgs(string[] args)
        {
            var testLauncher = new TestLauncher();
            var parser       = new Parser(with => with.EnableDashDash = true);
            var parserResult = parser.ParseArguments <Options>(args);

            if (args.Length > 0 && parserResult.Tag == ParserResultType.NotParsed)
            {
                throw new ArgumentException("Syntax Error in Args \"" + string.Join(" ", args) + "\". Some args take a string value for example: --ServerPath 'C:\\Builds\\Warewolf Server.exe'");
            }
            var result = parserResult.WithParsed(options =>
            {
                if (options.DoServerStart)
                {
                    Console.WriteLine("Doing Server Start.");
                    testLauncher.DoServerStart = "true";
                }
                if (options.DoStudioStart)
                {
                    Console.WriteLine("Doing Studio Start.");
                    testLauncher.DoStudioStart = "true";
                }
                if (options.ServerPath != null)
                {
                    Console.WriteLine("ServerPath: " + options.ServerPath);
                    testLauncher.ServerPath = options.ServerPath;
                }
                if (options.StudioPath != null)
                {
                    Console.WriteLine("StudioPath: " + options.StudioPath);
                    testLauncher.StudioPath = options.StudioPath;
                }
                if (options.ResourcesType != null)
                {
                    Console.WriteLine("ResourcesType: " + options.ResourcesType);
                    testLauncher.ResourcesType = options.ResourcesType;
                }
                if (options.VSTest)
                {
                    Console.WriteLine("Test Runner: VSTest");
                }
                if (options.VSTest || (!options.MSTest && !options.VSTest))
                {
                    testLauncher.TestRunner = new VSTestRunner();
                }
                if (options.MSTest)
                {
                    Console.WriteLine("Test Runner: MSTest");
                    testLauncher.TestRunner = new MSTestRunner();
                }
                if (options.DotCoverPath != null)
                {
                    Console.WriteLine("DotCoverPath: " + options.DotCoverPath);
                    testLauncher.DotCoverPath = options.DotCoverPath;
                }
                if (options.ServerUsername != null)
                {
                    testLauncher.ServerUsername = options.ServerUsername;
                }
                if (options.ServerPassword != null)
                {
                    Console.WriteLine("ServerPassword: ****");
                    testLauncher.ServerPassword = options.ServerPassword;
                }
                if (options.RunAllJobs)
                {
                    Console.WriteLine("RunAllJobs");
                    testLauncher.RunAllJobs = "true";
                }
                if (options.Cleanup)
                {
                    Console.WriteLine("Cleaning Up.");
                    testLauncher.Cleanup = true;
                }
                if (options.AssemblyFileVersionsTest != null)
                {
                    Console.WriteLine("AssemblyFileVersionsTest: " + options.AssemblyFileVersionsTest);
                    testLauncher.AssemblyFileVersionsTest = options.AssemblyFileVersionsTest;
                }
                if (options.RecordScreen)
                {
                    Console.WriteLine("Recording Screen.");
                    testLauncher.RecordScreen = "true";
                }
                if (options.Category != null)
                {
                    Console.WriteLine("Category: " + options.Category);
                    testLauncher.Category = options.Category;
                }
                if (options.ProjectName != null)
                {
                    Console.WriteLine("ProjectName: " + options.ProjectName);
                    testLauncher.ProjectName = options.ProjectName;
                }
                if (options.RunAllUnitTests)
                {
                    Console.WriteLine("Running All Unit Tests.");
                    testLauncher.RunAllUnitTests = "true";
                }
                if (options.RunAllServerTests)
                {
                    Console.WriteLine("Running All Server Tests.");
                    testLauncher.RunAllServerTests = "true";
                }
                if (options.RunAllReleaseResourcesTests)
                {
                    Console.WriteLine("Running All Release Resources Tests.");
                    testLauncher.RunAllReleaseResourcesTests = "true";
                }
                if (options.RunAllDesktopUITests)
                {
                    Console.WriteLine("Running All Desktop UI Tests.");
                    testLauncher.RunAllDesktopUITests = "true";
                }
                if (options.RunAllWebUITests)
                {
                    Console.WriteLine("Running All Web UI Tests.");
                    testLauncher.RunAllWebUITests = "true";
                }
                if (options.RunWarewolfServiceTests)
                {
                    Console.WriteLine("Running Warewolf Service Tests.");
                    testLauncher.RunWarewolfServiceTests = "true";
                }
                if (options.DomywarewolfioStart)
                {
                    Console.WriteLine("Doing my.warewolf.io Start.");
                    testLauncher.DomywarewolfioStart = "true";
                }
                if (options.TestsPath != null)
                {
                    Console.WriteLine("TestsPath: " + options.TestsPath);
                    testLauncher.TestRunner.TestsPath        = options.TestsPath;
                    testLauncher.TestRunner.TestsResultsPath = testLauncher.TestRunner.TestsPath + "\\TestResults";
                }
                if (options.JobName != null)
                {
                    Console.WriteLine("JobName: " + options.JobName);
                    testLauncher.JobName = options.JobName;
                }
                if (options.TestList != null)
                {
                    Console.WriteLine("TestList: " + options.TestList);
                    testLauncher.TestRunner.TestList = options.TestList;
                }
                if (options.MergeDotCoverSnapshotsInDirectory != null)
                {
                    Console.WriteLine("Merging DotCover Snapshots In Directory: " + options.MergeDotCoverSnapshotsInDirectory);
                    testLauncher.MergeDotCoverSnapshotsInDirectory = options.MergeDotCoverSnapshotsInDirectory;
                }
                if (options.TestsResultsPath != null)
                {
                    Console.WriteLine("TestsResultsPath: " + options.TestsResultsPath);
                    testLauncher.TestRunner.TestsResultsPath = options.TestsResultsPath;
                }
                if (options.VSTestPath != null)
                {
                    Console.WriteLine("VSTestPath: " + options.VSTestPath);
                    testLauncher.TestRunner.Path = options.VSTestPath;
                }
                if (options.MSTestPath != null)
                {
                    Console.WriteLine("MSTestPath: " + options.MSTestPath);
                    testLauncher.TestRunner.Path = options.MSTestPath;
                }
                if (options.RetryCount != null)
                {
                    Console.WriteLine("RetryCount: Re-trying failures " + options.RetryCount + " number of times.");
                    if (int.TryParse(options.RetryCount, out int retryCount))
                    {
                        testLauncher.RetryCount = retryCount;
                    }
                    else
                    {
                        Console.WriteLine("RetryCount: Expects a number of times to re-try failing tests. Cannot parse " + options.RetryCount);
                    }
                }
                if (options.RetryFile != null)
                {
                    Console.WriteLine("Retrying all failures in file: " + options.RetryFile);
                    testLauncher.RetryFile = options.RetryFile;
                }
                if (options.ConsoleServer)
                {
                    Console.WriteLine("ConsoleServer: Starting the server in a console window.");
                    testLauncher.StartServerAsConsole = true;
                }
                if (options.AdminMode)
                {
                    testLauncher.AdminMode = true;
                }
                if (options.Parallelize)
                {
                    testLauncher.Parallelize = true;
                }
                if (options.StartContainer != null)
                {
                    Console.WriteLine("Starting Container: " + options.StartContainer);
                    var containerLauncher = new ContainerLauncher(options.StartContainer, $"test-{options.StartContainer.Split('-')[0]}", "localhost");
                    Thread.Sleep(30000);
                    containerLauncher.LogOutputDirectory = testLauncher.TestRunner.TestsResultsPath;
                    testLauncher.StartContainer          = containerLauncher;
                }
                testLauncher.TestCoverageMerger = new TestCoverageMergers.DotCoverSnapshotMerger();
            }).WithNotParsed(errs =>
            {
                foreach (var err in errs)
                {
                    if (err.Tag != ErrorType.MissingValueOptionError)
                    {
                        throw new ArgumentException(err.Tag.ToString());
                    }
                }
            });

            return(testLauncher);
        }