Ejemplo n.º 1
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="testjob">the testJob to manage</param>
		public TestJobManager(TestJob testjob)
		{
			if (testjob == null)
				throw new ArgumentNullException("testjob");
			TestJob = testjob;
			WorkItems = new List<WorkItem>();
		}
Ejemplo n.º 2
0
        private Result UpdateResultInfos(WorkItem workItem, TestJob testJob, TestState testState)
        {
            Result result = _resultRepository.Get(workItem.Testsystem, workItem.Testcase,
                workItem.Browser, workItem.Language);

            result.Tester = workItem.Tester;
            result.Testtime = DateTime.Now;
            result.TestJob = testJob;
            result.ResultCode = testState;
            result.Error = null;
            return result;
        }
Ejemplo n.º 3
0
		private static TestJob CreateTestJob(string name, Testsuite testsuite, Testsystem testsystem, Tester tester)
		{
			TestJob testjob = new TestJob
			{
				Name = name,
				ResultCode = TestState.Pending,
				Testsuite = testsuite,
				Testsystem = testsystem,
				Tester = tester,
				StartedAt = DateTime.Now,
				JobType = JobType.Testportal
			};
			return testjob;
		}
Ejemplo n.º 4
0
		int IBuildTaskService.AddRegTestTasks(string testsystemName, string emailReceiver, string testsuiteName, string branch, string commitId, string commitMessage)
		{
			Testsuite testsuite = _testsuiteRepository.GetByName(testsuiteName);
			Testsystem testsystem = _testsystemRepository.GetByName(testsystemName);
			Tester tester = _testerRepository.GetByName(emailReceiver);
			string testjobname;
			if (!String.IsNullOrEmpty(commitId) && !String.IsNullOrEmpty(branch))
			{
				testjobname = "Commit " + commitId + " on " + ParseBranchName(branch);
			}
			else
			{
				testjobname = "Testsuite " + testsuiteName;
			}

			TestJob testjob = new TestJob
			{
				Name = testjobname,
				Description = commitMessage,
				ResultCode = TestState.Pending,
				Testsuite = testsuite,
				Testsystem = testsystem,
				Tester = tester,
				StartedAt = DateTime.Now,
				JobType = JobType.Buildtask
			};

			ITestJobManager testJobManager = new TestJobManager(testjob);

			ICollection<WorkItem> workItems = (from testcase in testsuite.Testcases
												  from browser in testsuite.Browsers
												  from language in testsuite.Languages
												  select new WorkItem(testJobManager)
												  {
													  Testcase = testcase,
													  Browser = browser,
													  Language = language,
													  Testsystem = testsystem,
													  Tester = tester
												  }).ToList();

			_testPool.AddTestJob(testJobManager, workItems);
			return testjob.ID;
		}
Ejemplo n.º 5
0
		void ILocalTestService.AddTestsuiteTask(string userName, string testsystemName, string testsystemUrl, string testsuiteName)
		{
			Testsuite testsuite = _testsuiteRepository.GetByName(testsuiteName);
			Testsystem testsystem = _testsystemRepository.GetByName(testsystemName);
			testsystem.Url = testsystemUrl;
			_testsystemRepository.Store(testsystem);

			Tester tester = _testerRepository.GetByName(userName);
			string testjobname =  "Testsuite " + testsuite.Name + " on " + testsystem.Url;

			TestJob testjob = new TestJob
			{
				Name = testjobname,
				ResultCode = TestState.Pending,
				Testsuite = testsuite,
				Testsystem = testsystem,
				Tester = tester,
				StartedAt = DateTime.Now,
				JobType = JobType.Localtesttool
			};

			ITestJobManager testJobManager = new TestJobManager(testjob);

			ICollection<WorkItem> workItems = (from testcase in testsuite.Testcases
											   from browser in testsuite.Browsers
											   from language in testsuite.Languages
											   select new WorkItem(testJobManager)
											   {
												   Testcase = testcase,
												   Browser = browser,
												   Language = language,
												   Testsystem = testsystem,
												   Tester = tester
											   }).ToList();

			_testPool.AddTestJob(testJobManager, workItems);
		}
Ejemplo n.º 6
0
		void ILocalTestService.AddLocalTestTasks(string userName, string testsystemName, string testsystemUrl, List<string> browsers,
			List<string> testcases, List<string> languages)
		{
			
			Testsystem testsystem = _testsystemRepository.GetByName(testsystemName);
			Tester tester = _testerRepository.GetByName(userName);

			testsystem.Url = testsystemUrl;
			_testsystemRepository.Store(testsystem);

			Testsuite testsuite = new Testsuite { Description = "", Name = "Local " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(), TestsystemFilter = testsystem };
			_testsuiteRepository.Store(testsuite);

			int testsuiteId = testsuite.ID;
			List<int> testcaseIds = testcases.Select(t => _testcaseRepository.GetByType(t).ID).ToList();
			List<int> browserIds = browsers.Select(t => _browserRepository.GetByName(t).ID).ToList();
			List<int> languageIds = languages.Select(t => _languageRepository.GetByLanguageCode(t).ID).ToList();


			_testsuiteRepository.SetTestcasesForTestsuite(testsuiteId, testcaseIds);
			_testsuiteRepository.SetBrowsersForTestsuite(testsuiteId, browserIds);
			_testsuiteRepository.SetLanguagesForTestsuite(testsuiteId, languageIds);


			TestJob testjob = new TestJob
			{
				Name = "A set of tests on " + testsystem.Url,
				ResultCode = TestState.Pending,
				Testsuite = testsuite,
				Testsystem = testsystem,
				Tester = tester,
				StartedAt = DateTime.Now,
				JobType = JobType.Localtesttool
			};

			ITestJobManager testJobManager = new TestJobManager(testjob);

			ICollection<WorkItem> workItems = (from testcase in testsuite.Testcases
												  from browser in testsuite.Browsers
												  from language in testsuite.Languages
												  select new WorkItem(testJobManager)
												  {
													  Testcase = testcase,
													  Browser = browser,
													  Language = language,
													  Testsystem = testsystem,
													  Tester = tester
												  }).ToList();

			_testPool.AddTestJob(testJobManager, workItems);
		}