diff --git a/Migrators/TestLinkExporter/Client/Client.cs b/Migrators/TestLinkExporter/Client/Client.cs index 15843ed..423faf5 100644 --- a/Migrators/TestLinkExporter/Client/Client.cs +++ b/Migrators/TestLinkExporter/Client/Client.cs @@ -53,6 +53,8 @@ public TestLinkProject GetProject() throw new Exception($"Project {_projectName} is not found"); } + _logger.LogDebug("Received project by name {ProjectName}: {@Project}", _projectName, project); + return new TestLinkProject { Id = project.id, @@ -73,6 +75,8 @@ public List GetSuitesByProjectId(int id) throw new Exception($"Test suites from {_projectName} is not found"); } + _logger.LogDebug("Received test suites by id {Id}: {@TestSuites}", id, testSuites); + foreach ( var suite in testSuites) { suites.Add(new TestLinkSuite { @@ -91,6 +95,8 @@ public List GetSharedSuitesBySuiteId(int id) var testSuites = _client.GetTestSuitesForTestSuite(id); + _logger.LogDebug("Received shared test suites by test suite id {Id}: {@TestSuites}", id, testSuites); + foreach (var suite in testSuites) { suites.Add(new TestLinkSuite @@ -106,9 +112,11 @@ public List GetSharedSuitesBySuiteId(int id) public List GetTestCaseIdsBySuiteId(int id) { - var testCaseIds = new List(); + var testCaseIds = _client.GetTestCaseIdsForTestSuite(id, false); - return _client.GetTestCaseIdsForTestSuite(2, true); + _logger.LogDebug("Received test case ids by test suite id {Id}: {@TestCaseIds}", id, testCaseIds); + + return testCaseIds; } public TestLinkTestCase GetTestCaseById(int id) @@ -122,6 +130,8 @@ public TestLinkTestCase GetTestCaseById(int id) throw new Exception($"Test case with id {id} is not found"); } + _logger.LogDebug("Received test case by id {Id}: {@TestCase}", id, testCase); + return new TestLinkTestCase { Id = id, @@ -151,6 +161,8 @@ public List GetAttachmentsByTestCaseId(int id) { var attachments = _client.GetTestCaseAttachments(id); + _logger.LogDebug("Received attachments by test case id {Id}: {@Attachments}", id, attachments); + return attachments.Select(attachment => new TestLinkAttachment { diff --git a/Migrators/TestLinkExporter/Services/AttachmentService.cs b/Migrators/TestLinkExporter/Services/AttachmentService.cs index a4255a4..62307ba 100644 --- a/Migrators/TestLinkExporter/Services/AttachmentService.cs +++ b/Migrators/TestLinkExporter/Services/AttachmentService.cs @@ -1,4 +1,3 @@ -using TestLinkExporter.Models; using JsonWriter; using Microsoft.Extensions.Logging; using TestLinkExporter.Client; @@ -20,7 +19,7 @@ public AttachmentService(ILogger logger, IClient client, IWri public async Task> DownloadAttachments(int id, Guid workItemId) { - _logger.LogInformation("Downloading attachment: {Id}", id); + _logger.LogInformation("Getting attachments by test case id: {Id}", id); var attachments = _client.GetAttachmentsByTestCaseId(id); diff --git a/Migrators/TestLinkExporter/Services/TestCaseService.cs b/Migrators/TestLinkExporter/Services/TestCaseService.cs index 1ae6805..cbd317f 100644 --- a/Migrators/TestLinkExporter/Services/TestCaseService.cs +++ b/Migrators/TestLinkExporter/Services/TestCaseService.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.Logging; using Models; -using System; using System.Text.RegularExpressions; using TestLinkExporter.Client; using TestLinkExporter.Models; @@ -82,7 +81,7 @@ private static PriorityType ConvertPriority(int priority) 3 => PriorityType.High, 2 => PriorityType.Medium, 1 => PriorityType.Low, - _ => throw new Exception($"Failed to convert priority {priority}") + _ => PriorityType.Medium }; }