diff --git a/Allure.SpecFlowPlugin/AllureTestTracerWrapper.cs b/Allure.SpecFlowPlugin/AllureTestTracerWrapper.cs index 6d99fd18..a56ec182 100644 --- a/Allure.SpecFlowPlugin/AllureTestTracerWrapper.cs +++ b/Allure.SpecFlowPlugin/AllureTestTracerWrapper.cs @@ -127,7 +127,8 @@ private void StartStep(StepInstance stepInstance) // add csv table for multi-row table if was not processed as params already if (isTableProcessed) return; - using var sw = new StringWriter(); + using var ms = new MemoryStream(); + using var sw = new StreamWriter(ms, System.Text.Encoding.UTF8); using var csv = new CsvWriter(sw, CultureInfo.InvariantCulture); foreach (var item in table.Header) csv.WriteField(item); csv.NextRecord(); @@ -137,8 +138,8 @@ private void StartStep(StepInstance stepInstance) csv.NextRecord(); } - allure.AddAttachment("table", "text/csv", - Encoding.ASCII.GetBytes(sw.ToString()), ".csv"); + sw.Flush(); + allure.AddAttachment("table", "text/csv", ms.ToArray(), ".csv"); } private static void FailScenario(Exception ex) @@ -151,4 +152,4 @@ private static void FailScenario(Exception ex) }); } } -} \ No newline at end of file +}