public override TCObject Execute(TCObject objectToExecuteOn, TCAddOnTaskContext taskContext) { if (objectToExecuteOn is TCFolder) { AddExecutionEntries(objectToExecuteOn as TCFolder); } if (objectToExecuteOn is ExecutionEntryFolder) { AddExecutionEntries(objectToExecuteOn as ExecutionEntryFolder); } if (objectToExecuteOn is ExecutionList) { AddExecutionEntries(objectToExecuteOn as ExecutionList); } TFSConnector tfs = new TFSConnector(); foreach (ExecutionEntry ee in entries) { if (IsInteger(ee.ActualLog.ChangeRequestId)) { DefectResult dr = tfs.GetDefect(ee.ActualLog.ChangeRequestId); ee.ActualLog.ChangeRequestState = dr.status; } } tfs.GetTFSDefectsWithToscaDefects(); tfs.DisposeTFS(); return null; }
public override TCObject Execute(TCObject objectToExecuteOn, TCAddOnTaskContext taskContext) { ExecutionEntry ee = objectToExecuteOn as ExecutionEntry; TFSConnector tfs = new TFSConnector(); DefectResult dr = tfs.GetDefect(ee.ActualLog.ChangeRequestId); tfs.DisposeTFS(); if (!String.IsNullOrEmpty(dr.status)) { ee.ActualLog.Comment = dr.status; } return null; }
public override TCObject Execute(TCObject objectToExecuteOn, TCAddOnTaskContext taskContext) { if (objectToExecuteOn is TCFolder) { AddExecutionEntries(objectToExecuteOn as TCFolder); } if (objectToExecuteOn is ExecutionEntryFolder) { AddExecutionEntries(objectToExecuteOn as ExecutionEntryFolder); } if (objectToExecuteOn is ExecutionList) { AddExecutionEntries(objectToExecuteOn as ExecutionList); } TFSConnector tfs = new TFSConnector(); List<Defect> TFSDefects = tfs.GetTFSDefectsWithToscaDefects(); foreach (ExecutionEntry ee in entries) { if (IsInteger(ee.ActualLog.ChangeRequestId)) { DefectResult dr = tfs.GetDefect(ee.ActualLog.ChangeRequestId); ee.ActualLog.ChangeRequestState = dr.status; } else { Defect defect = TFSDefects.Find(d => d.uniqueid == ee.UniqueId); if (defect != null) { ee.ActualLog.ChangeRequestState = defect.status; ee.ActualLog.ChangeRequestId = defect.id.ToString(); } } } tfs.DisposeTFS(); return null; }
public override TCObject Execute(TCObject objectToExecuteOn, TCAddOnTaskContext taskContext) { //klasse aanmaken om het resultaat van het defect in op te slaan DefectResult dr = new DefectResult(); List<String> uidList = new List<String>(); List<String> files = new List<String>(); IEnumerable<DirectoryInfo> directories; ExecutionEntry ee = objectToExecuteOn as ExecutionEntry; // plaatjes van foutieve testcases ophalen. //var dirinfo = new DirectoryInfo(@"C:\TOSCA_PROJECTS\ToscaCommander\Screenshots\failedTestSteps"); var dirinfo = new DirectoryInfo(DefectTrackerSettings.Default.ToscaScreenshotFolder); if (dirinfo.Exists) { directories = dirinfo.GetDirectories().Where(d => d.LastWriteTime > DateTime.Now.AddDays(-1)); } else { directories = null; } foreach (var ts in ee.TestCase.Items) { if (ts is TestStep) { TestStep ts2 = ts as TestStep; foreach (TestStepValue tsv in ts2.TestStepValues) { if (directories != null) { var result = directories.Where(b => b.Name == "surrogate " + tsv.UniqueId.ToString() && b.CreationTime > DateTime.Now.AddDays(-1)).Select(a => (tsv.UniqueId.ToString())); foreach (string r in result) { uidList.Add("surrogate " + tsv.UniqueId.ToString()); } } } } } foreach (string dir in uidList) { files = Directory.GetFiles(DefectTrackerSettings.Default.ToscaScreenshotFolder + @"\" + dir).ToList(); } SetTFSProject(ee); Defect defect; if (files.Count != 0) { defect = SetDefect(ee, files); } else { defect = SetDefect(ee); } TFSConnector tfs = new TFSConnector(); dr = tfs.CreateBug(defect); tfs.DisposeTFS(); if (dr.id != 0) { ee.ActualLog.ChangeRequestId = dr.id.ToString(); ee.ActualLog.ChangeRequestState = dr.status; } //// start IE om de bevinding in TFS te bekijken Process.Start(DefectTrackerSettings.Default.TFSuri + DefectTrackerSettings.Default.TFSwebUri + dr.id.ToString()); return null; }
public override TCObject Execute(TCObject objectToExecuteOn, TCAddOnTaskContext taskContext) { DefectResult dr = new DefectResult(); List<String> uidList = new List<String>(); List<String> files = new List<String>(); IEnumerable<DirectoryInfo> directories; ExecutionEntry ee = objectToExecuteOn as ExecutionEntry; // get images from failed tests var dirinfo = new DirectoryInfo(DefectTrackerSettings.Default.ToscaScreenshotFolder); if (dirinfo.Exists) { directories = dirinfo.GetDirectories().Where(d => d.LastWriteTime > DateTime.Now.AddDays(-1)); } else { directories = null; } foreach (var ts in ee.TestCase.Items) { if (ts is TestStep) { TestStep ts2 = ts as TestStep; foreach (TestStepValue tsv in ts2.TestStepValues) { if (directories != null) { var result = directories.Where(b => b.Name == "surrogate " + tsv.UniqueId.ToString() && b.CreationTime > DateTime.Now.AddDays(-1)).Select(a => (tsv.UniqueId.ToString())); foreach (string r in result) { uidList.Add("surrogate " + tsv.UniqueId.ToString()); } } } } } foreach (string dir in uidList) { files = Directory.GetFiles(DefectTrackerSettings.Default.ToscaScreenshotFolder + @"\" + dir).ToList(); } SetTFSProject(ee); Defect defect; if (files.Count != 0) { defect = SetDefect(ee, files); } else { defect = SetDefect(ee); } TFSConnector tfs = new TFSConnector(); dr = tfs.CreateBug(defect); if (dr.id != 0) { ee.ActualLog.ChangeRequestId = dr.id.ToString(); ee.ActualLog.ChangeRequestState = dr.status; // open browser to view work item/defect in TFS Process.Start(tfs.GetWorkItemUrl(dr.id).ToString()); } tfs.DisposeTFS(); return null; }