Esempio n. 1
0
 public void Setup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml, ITestConfiguration config)
 {
     configuration = config;
     BaseSetup(sutXml, ctrXml);
     SpecificSetup(sutXml, ctrXml);
     isSetup = true;
 }
Esempio n. 2
0
 public TestCaseFactory(ITestConfiguration configuration, IDictionary <string, ITestVariable> variables)
 {
     this.configuration = configuration;
     this.variables     = variables;
     registrations      = new List <BuilderRegistration>();
     RegisterDefault();
 }
Esempio n. 3
0
 public static void BeforeTestRunInjection(IISWebServerDriver webServerDriver)
 {
     _webServerDriver = webServerDriver;
     _config          = ConfigBuilder.Configuration;
     _config.SiteUrl  = webServerDriver.SiteUrl;
     webServerDriver.StartWebServer();
 }
 public void Setup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml, ITestConfiguration config)
 {
     configuration = config;
     BaseSetup(sutXml, ctrXml);
     SpecificSetup(sutXml, ctrXml);
     isSetup = true;
 }
Esempio n. 5
0
        public void UpdateConfigToSuites(string suiteId, string configIds, string status, string recursive, string testFieldsFile, bool overWrite = false)
        {
            int id = Int32.Parse(suiteId);

            string[]         ids        = configIds.Split('+');
            List <IdAndName> idAndNames = new List <IdAndName>();

            foreach (var i in ids)
            {
                ITestConfiguration config = TfsService.ConfigManager.GetTestConfigurationById(Int32.Parse(i));
                if (config != null)
                {
                    idAndNames.Add(new IdAndName(config.Id, config.Name));
                }
            }
            if ("true".Equals(recursive, StringComparison.InvariantCultureIgnoreCase))
            {
                ICollection <ITestSuiteBase> testSuites = new List <ITestSuiteBase>();
                GetAllTestSuitesFromSuiteNode(id, testSuites);
                foreach (ITestSuiteBase testSuiteBase in testSuites)
                {
                    UpdateConfigToSuite(testSuiteBase.Id, idAndNames, status, testFieldsFile, overWrite);
                }
            }
            else
            {
                UpdateConfigToSuite(id, idAndNames, status, testFieldsFile, overWrite);
            }
        }
Esempio n. 6
0
 internal TestContext(SettingsBag settings, TestLogger logger, ITestConfiguration config, TestName name)
 {
     Name          = name;
     this.settings = settings;
     this.config   = config;
     this.logger   = logger;
 }
Esempio n. 7
0
 /// <inheritdoc />
 public override void ApplyConfigurationOverrides(ITestConfiguration testConfiguration)
 {
     foreach (var configurationOverride in configurationOverrides)
     {
         configurationOverride(testConfiguration);
     }
 }
Esempio n. 8
0
        private async Task <ITestResult> RunTest(ITestPlan testPlan, ITestConfiguration testConfiguration)
        {
            var stepResults = new List <IStepRunResult>();
            var asyncSteps  = new List <Task <IStepRunResult> >();

            foreach (var testStep in testPlan.Setps)
            {
                if (stepResults.Any(x => !x.Pass) && testConfiguration.StopOnFirstError)
                {
                    break;
                }

                if (testStep.CanBeRunInParallel)
                {
                    Task <IStepRunResult> taskStep = this.RunStep(testStep);
                    asyncSteps.Add(taskStep);
                    continue;
                }

                if (asyncSteps.Any())
                {
                    IStepRunResult[] collectiveResults = await Task.WhenAll(asyncSteps);

                    stepResults.AddRange(collectiveResults);
                }

                IStepRunResult result = await this.RunStep(testStep);

                stepResults.Add(result);
            }

            return(new TestResult(stepResults));
        }
        public void TestPrg()
        {
            // 2 tests for integer interval and 2 tests for unit interval.
            var prgTests = new ITestConfiguration[4];

            for (uint i = 0; i < prgTests.Length; i++)
            {
                prgTests[i] = new PrgTestConfiguration
                {
                    Seed            = i,
                    Iterations      = 1000,
                    UniformInterval = i < 2 ? new Tuple <uint, uint>(i * 10, (i + 10) * 10) : null,
                };
            }
            Run(outputFilePatternExpected, outputFilePatternActual, outputJsonConfigFile, prgTests);

            for (uint i = 0; i < 2; i++)
            {
                // integer content so should be exact match
                CompareExactMatch(FormatPath(outputFilePatternExpected, i), FormatPath(outputFilePatternActual, i));
            }

            for (uint i = 2; i < 4; i++)
            {
                float[] expected = File.ReadAllLines(FormatPath(outputFilePatternExpected, i)).Select(l => Convert.ToSingle(l)).ToArray();
                float[] actual   = File.ReadAllLines(FormatPath(outputFilePatternActual, i)).Select(l => Convert.ToSingle(l)).ToArray();

                Assert.AreEqual(expected.Length, actual.Length);
                for (int j = 0; j < expected.Length; j++)
                {
                    // allow slightly different float precision
                    Assert.IsTrue(Math.Abs(expected[j] - actual[j]) < PrecisionOffset);
                }
            }
        }
Esempio n. 10
0
        /// <inheritdoc />
        public IDictionary <string, string> GetConfigurationVariables(TfsTestRunProperties runProperties)
        {
            if (runProperties == null)
            {
                throw new ArgumentNullException("runProperties");
            }

            TfsTeamProjectCollection teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(runProperties.TfsServerCollectionUrl));

            teamProjectCollection.Credentials = this.credentials;

            TestManagementService testService = teamProjectCollection.GetService <TestManagementService>();

            ITestManagementTeamProject teamProject = testService.GetTeamProject(runProperties.TeamProject);

            if (teamProject == null)
            {
                throw new InvalidOperationException(String.Format("Failed to find team project named '{0}'", runProperties.TeamProject));
            }

            ITestConfiguration testConfiguration = teamProject.TestConfigurations.Find(runProperties.TestConfigurationId);

            if (testConfiguration == null)
            {
                throw new InvalidOperationException(String.Format("Failed to find test configuration with ID '{0}'. If you're running this tool in a test run managed by VSTS, you make need to upgrade your license for the user executing the test run.", runProperties.TestConfigurationId));
            }

            return(testConfiguration.Values);
        }
Esempio n. 11
0
 public static void CheckEquals(ITestConfiguration x, ITestConfiguration y)
 {
     foreach (var p in typeof(ITestConfiguration).GetProperties())
     {
         Assert.AreEqual(p.GetValue(y), p.GetValue(x), "Property " + p.Name);
     }
 }
Esempio n. 12
0
 public TestClient(ITestConfiguration configuration, HttpClient client, IReadOnlyPolicyRegistry <string> policyRegistry, ILogger <TestClient> logger)
 {
     _client             = client;
     _policyRegistry     = policyRegistry;
     _logger             = logger;
     _client.BaseAddress = new Uri(configuration.BaseAddress);
 }
Esempio n. 13
0
        public TestContext(ITestConfiguration configuration, IOktaSdkHelper oktaHelper)
        {
            _oktaHelper    = oktaHelper;
            _configuration = configuration;

            TestUserProfile = new TestUserProfile();
        }
Esempio n. 14
0
        public static ITestRun CreateTestRun(int testId)
        {
            NetworkCredential        cred = new NetworkCredential("UserName", "Password");
            TfsTeamProjectCollection tfs  = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("VSTSSiteBase"));

            tfs.Credentials = cred;
            tfs.Authenticate();
            tfs.EnsureAuthenticated();

            ITestManagementTeamProject project = tfs.GetService <ITestManagementService>().GetTeamProject("Schwans Company");

            // find the test case.
            ITestCase testCase = project.TestCases.Find(testId);
            string    title    = testCase.Title.ToString();

            // find test plan.
            int planId = Int32.Parse("testPlanId");
            //ConfigurationManager.AppSettings["TestPlanId"]);
            ITestPlan plan = project.TestPlans.Find(planId);

            // Create test configuration. You can reuse this instead of creating a new config everytime.
            ITestConfiguration config = CreateTestConfiguration(project, string.Format("My test config {0}", DateTime.Now));

            // Create test points.
            IList <ITestPoint> testPoints = CreateTestPoints(project, plan, new List <ITestCase>()
            {
                testCase
            }, new IdAndName[] { new IdAndName(config.Id, config.Name) });

            // Create test run using test points.
            ITestRun run = CreateRun(project, plan, testPoints, title);

            return(run);
        }
Esempio n. 15
0
 public TestErrorOccuredEventArgs(ITestConfiguration configuration, ITestInformation information, Exception ex = null, ResultState state = ResultState.FAILED)
     : base(ex)
 {
     TestConfiguration = configuration;
     TestInformation   = information;
     Exception         = ex;
     ResultState       = state;
 }
Esempio n. 16
0
 public void Setup(AbstractSystemUnderTestXml sutXml, AbstractConstraintXml ctrXml, ITestConfiguration config, IDictionary <string, ITestVariable> variables)
 {
     configuration = config;
     Variables     = variables ?? new Dictionary <string, ITestVariable>();
     BaseSetup(sutXml, ctrXml);
     SpecificSetup(sutXml, ctrXml);
     isSetup = true;
 }
Esempio n. 17
0
 public NodeConfiguration(ITestConfiguration configuration)
 {
     this.Mode = configuration.Mode;
     this.ElasticsearchVersion = configuration.ElasticsearchVersion;
     this.ForceReseed          = configuration.ForceReseed;
     this.TestAgainstAlreadyRunningElasticsearch = configuration.TestAgainstAlreadyRunningElasticsearch;
     this.RunIntegrationTests = configuration.RunIntegrationTests;
     this.RunUnitTests        = configuration.RunUnitTests;
 }
Esempio n. 18
0
        public TestContext(ITestConfiguration configuration, IA18nClient a18nClient, IOktaSdkHelper oktaHelper, WebDriverDriver webDriver)
        {
            _oktaHelper    = oktaHelper;
            _a18nClient    = a18nClient;
            _webDriver     = webDriver;
            _configuration = configuration;

            _a18nProfile = Task.Run(() => _a18nClient.GetProfileAsync()).Result;
        }
        public virtual void SetUp()
        {
            collection = new NameValueCollection
            {
                {TestConfiguration.LIB_KEY, "Caliberweb.Core.Tests"}
            };

            configuration = new TestConfiguration(collection);
        }
Esempio n. 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Context"/> class.
 /// </summary>
 /// <param name="testConfiguration">The test configuration.</param>
 /// <param name="dataContext">The data context.</param>
 /// <param name="userInterfaceContext">The User interface context.</param>
 public Context(
     ITestConfiguration testConfiguration,
     IDataContext dataContext,
     IUserInterfaceContext userInterfaceContext)
 {
     Data          = dataContext;
     UserInterface = userInterfaceContext;
     Config        = testConfiguration;
 }
Esempio n. 21
0
        public static bool AreEqualAllProperties(ITestConfiguration x, ITestConfiguration y)
        {
            var equals = true;

            foreach (var p in typeof(ITestConfiguration).GetProperties())
            {
                equals = equals && p.GetValue(y).Equals(p.GetValue(x));
            }
            return(equals);
        }
Esempio n. 22
0
        private static ITestConfiguration CreateTestConfiguration(ITestManagementTeamProject project, string title)
        {
            ITestConfiguration configuration = project.TestConfigurations.Create();

            configuration.Name        = title;
            configuration.Description = "DefaultConfig";
            configuration.Values.Add(new KeyValuePair <string, string>("Browser", "IE"));
            configuration.Save();
            return(configuration);
        }
Esempio n. 23
0
 public ClientService(IRequest request, RestClient client, string resource, ITestConfiguration config)
 {
     this.request = request;
     this.client  = client;
     if (client.CookieContainer == null)
     {
         this.client.CookieContainer = _cookieJar;
     }
     this.resource = resource;
 }
Esempio n. 24
0
        //[TestInitialize]
        public static void TestSetupInit()
        {
            Kernel = new StandardKernel(new BDApiTestModule());
            var config = Kernel.Get <ITestConfiguration>();

            testConfiguration = config;

            //helpers
            clientHelper = Kernel.Get <ClientHelper>();
        }
Esempio n. 25
0
        public void AddTestConfig(ITestConfiguration testConfig)
        {
            if (testConfig == null)
            {
                throw new ArgumentNullException(nameof(testConfig));
            }

            this._testConfigurations.Add(testConfig);
            this.TestConfigAdded?.Invoke(this, testConfig);
        }
Esempio n. 26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TfsTestConfiguration"/> class.
 /// </summary>
 /// <param name="originalTestConfiguration">Original test configuration - <see cref="ITestConfiguration"/>.</param>
 public TfsTestConfiguration(ITestConfiguration originalTestConfiguration)
 {
     if (originalTestConfiguration == null)
     {
         throw new ArgumentNullException("originalTestConfiguration");
     }
     OriginalTestConfiguration = originalTestConfiguration;
     Id   = OriginalTestConfiguration.Id;
     Name = OriginalTestConfiguration.Name;
 }
        public static void BaseSetup()
        {
            if (_testCfg == null)
            {
                _testCfg = new AppSettingsCfg();
            }

            ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); };
            Log.Logger = new LoggerConfiguration().CreateLogger();
            Log.Information("Test is configured to point to {0}, {1}", _testCfg.ERApiEndpoint, _testCfg.ImsEndpoint);
        }
Esempio n. 28
0
        public void Copy(ITestConfiguration cfg)
        {
            Int32  = cfg.Int32;
            String = cfg.String;
            Guid   = new Guid("{01F71EC6-76A6-40F8-8910-68E67D753CD4}");

            foreach (var p in typeof(ITestConfiguration).GetProperties())
            {
                p.SetValue(this, p.GetValue(cfg));
            }
        }
		public NodeConfiguration(ITestConfiguration configuration)
		{
			this.Mode = configuration.Mode;
			this.ElasticsearchVersion = configuration.ElasticsearchVersion;
			this.ForceReseed = configuration.ForceReseed;
			this.TestAgainstAlreadyRunningElasticsearch = configuration.TestAgainstAlreadyRunningElasticsearch;
			this.RunIntegrationTests = configuration.RunIntegrationTests;
			this.RunUnitTests = configuration.RunUnitTests;
			this.ClusterFilter = configuration.ClusterFilter;
			this.TestFilter = configuration.TestFilter;
		}
Esempio n. 30
0
 public Worker(ISignalRService signalRService, ILogger <Worker> logger, ITestConfiguration testConfiguration)
 {
     _signalRService          = signalRService;
     _connectionNumber        = testConfiguration.SignalRConcurrentConnections;
     _logger                  = logger;
     _hubsConnections         = new List <HubConnection>();
     _lockClientsConnected    = new object();
     _lockClientsReceivedData = new object();
     _lockAddConnection       = new object();
     _testConfiguration       = testConfiguration;
 }
Esempio n. 31
0
        public async Task <ITestResult> Run(ITestPlan testPlan, ITestConfiguration testConfiguration)
        {
            Guard.IsNotNull(testPlan, nameof(testPlan));
            Guard.IsNotNull(testConfiguration, nameof(testConfiguration));

            if (testPlan.Setps.IsNullOrEmpty())
            {
                return(new TestResult("Test has no steps"));
            }

            return(await this.RunTest(testPlan, testConfiguration));
        }
        public void TestHash()
        {
            var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";

            var rand = new Random();

            var hashTests = new ITestConfiguration[5];

            for (uint i = 0; i < hashTests.Length - 1; i++)
            {
                int numValues = rand.Next(10, 20);
                var values    = new string[numValues];

                for (int v = 0; v < numValues; v++)
                {
                    if (rand.NextDouble() < 0.5)
                    {
                        // generate string of numbers only
                        values[v] = rand.Next(1000000).ToString("000000");
                    }
                    else
                    {
                        // generate random string
                        int length = rand.Next(10, 20); // random length (in characters)

                        values[v] = new string(Enumerable
                                               .Repeat(chars, length)
                                               .Select(s => s[rand.Next(s.Length)])
                                               .ToArray());
                    }
                }

                hashTests[i] = new HashTestConfiguration
                {
                    Values = values.ToList()
                };
            }

            hashTests[hashTests.Length - 1] = new HashTestConfiguration
            {
                Values = new[] { "是是asda阿斯顿", " ", "     ", "\t\r\n", "\r", "hô ooaf à ị ẻ ể \r \t \n \\ồ" }.ToList()
            };

            Run(outputFilePatternExpected, outputFilePatternActual, outputJsonConfigFile, hashTests);

            for (uint i = 0; i < hashTests.Length; i++)
            {
                // integer content so should be exact match
                CompareExactMatch(FormatPath(outputFilePatternExpected, i), FormatPath(outputFilePatternActual, i));
            }
        }
Esempio n. 33
0
 internal ExecutorService(
     ITestConfiguration config,
     PythonProjectSettings projectSettings,
     IFrameworkHandle frameworkHandle,
     IRunContext runContext
     )
 {
     _testConfig      = config ?? throw new ArgumentNullException(nameof(config));
     _projectSettings = projectSettings ?? throw new ArgumentNullException(nameof(projectSettings));
     _frameworkHandle = frameworkHandle ?? throw new ArgumentNullException(nameof(frameworkHandle));
     _runContext      = runContext ?? throw new ArgumentNullException(nameof(runContext));;
     _app             = VisualStudioProxy.FromEnvironmentVariable(PythonConstants.PythonToolsProcessIdEnvironmentVariable);
     GetDebugSettings(_app, _runContext, _projectSettings, out _debugMode, out _debugSecret, out _debugPort);
 }
Esempio n. 34
0
 public GoogleBasePage(ITestConfiguration testConfig)
     : base(testConfig)
 {
     EnsureElementLoaded(QueryBox, null, "Google page failed to load.");
 }
Esempio n. 35
0
 public TestCaseFactory(ITestConfiguration configuration)
 {
     this.configuration = configuration;
     registrations = new List<BuilderRegistration>();
     RegisterDefault();
 }
Esempio n. 36
0
 public void ExecuteTestCases(TestXml test, ITestConfiguration configuration)
 {
     base.Configuration = configuration;
     base.ExecuteTestCases(test);
 }
Esempio n. 37
0
        private void Run(string outputFilePatternExpected, string outputFilePatternActual, string outputJsonConfigFile, ITestConfiguration[] tests)
        {
            for (uint i = 0; i < tests.Length; i++)
            {
                tests[i].OutputFile = FormatPath(outputFilePatternExpected, i);
            }

            string jsonConfigFile = Path.Combine(WorkingDir, outputJsonConfigFile);
            File.WriteAllText(jsonConfigFile, JsonConvert.SerializeObject(tests));

            var psi = new ProcessStartInfo();
            psi.FileName = CppExePath;
            psi.Arguments = jsonConfigFile;
            psi.CreateNoWindow = true;
            psi.WindowStyle = ProcessWindowStyle.Hidden;

            Process.Start(psi).WaitForExit();

            for (uint i = 0; i < tests.Length; i++)
            {
                tests[i].OutputFile = FormatPath(outputFilePatternActual, i);
            }
            File.WriteAllText(jsonConfigFile, JsonConvert.SerializeObject(tests));

            psi.FileName = CsharpExePath;
            Process.Start(psi).WaitForExit();
        }
Esempio n. 38
0
        public void TestPrg()
        {
            // 2 tests for integer interval and 2 tests for unit interval.
            var prgTests = new ITestConfiguration[4];
            for (uint i = 0; i < prgTests.Length; i++)
            {
                prgTests[i] = new PrgTestConfiguration
                {
                    Seed = i,
                    Iterations = 1000,
                    UniformInterval = i < 2 ? new Tuple<uint, uint>(i * 10, (i + 10) * 10) : null,
                };
            }
            Run(outputFilePatternExpected, outputFilePatternActual, outputJsonConfigFile, prgTests);

            for (uint i = 0; i < 2; i++)
            {
                // integer content so should be exact match
                CompareExactMatch(FormatPath(outputFilePatternExpected, i), FormatPath(outputFilePatternActual, i));
            }

            for (uint i = 2; i < 4; i++)
            {
                float[] expected = File.ReadAllLines(FormatPath(outputFilePatternExpected, i)).Select(l => Convert.ToSingle(l)).ToArray();
                float[] actual = File.ReadAllLines(FormatPath(outputFilePatternActual, i)).Select(l => Convert.ToSingle(l)).ToArray();

                Assert.AreEqual(expected.Length, actual.Length);
                for (int j = 0; j < expected.Length; j++)
                {
                    // allow slightly different float precision
                    Assert.IsTrue(Math.Abs(expected[j] - actual[j]) < PrecisionOffset);
                }
            }
        }
Esempio n. 39
0
        public void TestHash()
        {
            var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz";

            var rand = new Random();

            var hashTests = new ITestConfiguration[5];
            for (uint i = 0; i < hashTests.Length - 1; i++)
            {
                int numValues = rand.Next(10, 20);
                var values = new string[numValues];

                for (int v = 0; v < numValues; v++)
                {
                    if (rand.NextDouble() < 0.5)
                    {
                        // generate string of numbers only
                        values[v] = rand.Next(1000000).ToString("000000");
                    }
                    else
                    {
                        // generate random string
                        int length = rand.Next(10, 20); // random length (in characters)

                        values[v] = new string(Enumerable
                            .Repeat(chars, length)
                            .Select(s => s[rand.Next(s.Length)])
                            .ToArray());
                    }
                }

                hashTests[i] = new HashTestConfiguration
                {
                    Values = values.ToList()
                };
            }

            hashTests[hashTests.Length - 1] = new HashTestConfiguration
            {
                Values = new[] { "是是asda阿斯顿", " ", "     ", "\t\r\n", "\r", "hô ooaf à ị ẻ ể \r \t \n \\ồ" }.ToList()
            };

            Run(outputFilePatternExpected, outputFilePatternActual, outputJsonConfigFile, hashTests);

            for (uint i = 0; i < hashTests.Length; i++)
            {
                // integer content so should be exact match
                CompareExactMatch(FormatPath(outputFilePatternExpected, i), FormatPath(outputFilePatternActual, i));
            }
        }
Esempio n. 40
0
 public WebSearchResults(ITestConfiguration testConfig)
     : base(testConfig)
 {
     EnsureElementLoaded(SelectedAllTab, "Google web search page loaded.", "Google web search page failed to load.");
 }
Esempio n. 41
0
 public GoogleSession(ITestConfiguration testConfig)
     : base(testConfig)
 {
 }
Esempio n. 42
0
 internal static void Setup(ITestConfiguration testConfiguration)
 {
     _testConfiguration = testConfiguration;
 }