Exemple #1
0
        public void ShouldCreateDefaultExponentialExecuter()
        {
            var configuration = new ConfigurationBuilder().Build();
            var factory       = new RequestExecuterFactory(configuration);
            var executer      = factory.Create();

            executer.Should().BeOfType <ExponentialRetryRequestExecuter>();
            var exponentialExecuter = executer as ExponentialRetryRequestExecuter;

            exponentialExecuter.MaxRetryAttemps.Should().Be(3);
            exponentialExecuter.BaseIndex.Should().Be(2);
        }
Exemple #2
0
        public void ShouldCreateLinearExecuter()
        {
            var configuration = new ConfigurationBuilder().Build();

            configuration.Properties["Server:Retry:Strategy"] = "linear";
            var factory  = new RequestExecuterFactory(configuration);
            var executer = factory.Create();

            executer.Should().BeOfType <LinearRetryRequestExecuter>();
            var exponentialExecuter = executer as LinearRetryRequestExecuter;

            exponentialExecuter.MaxRetryAttemps.Should().Be(3);
            exponentialExecuter.Delay.Should().Be(5000);
        }
Exemple #3
0
        public LaunchReporter Build(int suitesPerLaunch, int testsPerSuite, int logsPerTest)
        {
            var launchReporter = new LaunchReporter(Service, null, RequestExecuterFactory?.Create(), ExtensionManager);

            var launchDateTime = DateTime.UtcNow;

            launchReporter.Start(new StartLaunchRequest
            {
                Name      = "ReportPortal Shared",
                StartTime = launchDateTime,
                Mode      = LaunchMode.Debug
            });

            for (int i = 0; i < suitesPerLaunch; i++)
            {
                var suiteNode = launchReporter.StartChildTestReporter(new StartTestItemRequest
                {
                    Name      = $"Suite {i}",
                    StartTime = launchDateTime.AddMilliseconds(-1),
                    Type      = TestItemType.Suite
                });

                for (int j = 0; j < testsPerSuite; j++)
                {
                    var testNode = suiteNode.StartChildTestReporter(new StartTestItemRequest
                    {
                        Name      = $"Test {j}",
                        StartTime = launchDateTime,
                        Type      = TestItemType.Step
                    });

                    for (int l = 0; l < logsPerTest; l++)
                    {
                        testNode.Log(new CreateLogItemRequest
                        {
                            Level = LogLevel.Info,
                            Text  = $"Log message #{l}",
                            Time  = launchDateTime
                        });
                    }

                    testNode.Finish(new FinishTestItemRequest
                    {
                        EndTime = launchDateTime,
                        Status  = Status.Passed
                    });
                }

                suiteNode.Finish(new FinishTestItemRequest
                {
                    EndTime = launchDateTime,
                    Status  = Status.Passed
                });
            }

            launchReporter.Finish(new FinishLaunchRequest
            {
                EndTime = launchDateTime
            });

            return(launchReporter);
        }