简体   繁体   English

为什么 xUnit XML 报告会截断测试名称值

[英]Why is the xUnit XML report truncating the test name value

The complete test name with arguments when executing dotnet test looks like this:执行 dotnet 测试时带有 arguments 的完整测试名称如下所示:

[xUnit.net 00:01:43.16] Successfully commence lease by running a Bookie workflow(BusinessUnit: "Default", businessUnit: "707", vendorPartyNumber: "valid", propertyTaxResponsibility: "DoNotRemit", originationSourceType: "Direct", dealType: "Lease", transactionType: "FMV", lineOfBusiness: "Canada", branch: "666457", invoiceFormat: "English", invoiceLeadDays: "25", invoiceDueDay: "30", contractType: "TL", contractTerm: "12", contractPayment: "96.99", contractCommecementDate: "11/30/2017", legalEntity: "Canada", currency: "CAD", assetBookingCurrency: "CAD", invoiceDate: "11/09/2017", invoiceDueDate: "12/23/2017", equipmentDescription: "Inspiron 5680", assetDeliveryDate: "11/16/2017", equipmentAddress1: "760 HWY BEDFORD", equipmentAddress2: "", equipmentCity: "BEDFORD", equipmentState: "NS", equipmentZip: "B4A 3Z7", countryCode: "CAN", equipmentCost: "300", propertyTaxCost: "0.0", lateFeeTemplate: "CAD Daily Late Fee 1.5%", residualAmount: "0", rPAddressLine1: "", rPCity: "", rPZip: "", rPName: "", tapeAccountNumber: "", paymentsArrears: "0", firstPaymentAmount: "21", hasBlendedItems: "false", numberOfPayments: "12", customerCostCenter: "ccc-fit-no-bi", isBargainPurchaseOption: "false", isTaxLease: "true", exampleTags: []) [FAIL]

In the Xunit report the test name attribute is truncated like this:在 Xunit 报告中,测试名称属性被截断如下:

<test name="Successfully commence lease by running a Bookie workflow(BusinessUnit: "Default", businessUnit: "707", vendorPartyNumber: "valid", propertyTaxResponsibility: "DoNotRemit", originationSourceType: "Direct", dealType: "Lease", transactionType: "Dollar1Out", lineOfBusiness: "Canada", branch: "666457", invoiceFormat: "English", invoiceLeadDays: "25", invoiceDueDay: "30", contractType: "LP", contractTerm: "12", contractPayment: "96.99",..."

Is there a way to have the entire test name with its arguments in the test name in the XML report?有没有办法在 XML 报告的测试名称中包含整个测试名称及其 arguments?

Found the code where xUnit runner truncates the test name:找到 xUnit runner 截断测试名称的代码:

const string Ellipsis = "...";

const int MaximumDisplayNameLength = 447;

applied here:在这里应用:

static string Truncate(string value)
        {
            if (value.Length <= MaximumDisplayNameLength)
                return value;

            return value.Substring(0, MaximumDisplayNameLength - Ellipsis.Length) + Ellipsis;
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM