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


执行dotnet测试时带有参数的完整测试名称如下:
[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]

在Xuit报告中,测试名称属性被截断如下:

<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",..."

有没有一种方法可以在XML报告的测试名称中包含整个测试名称及其参数?

找到xUnit runner截断测试名称的代码:

const string Ellipsis = "...";
const int MaximumDisplayNameLength = 447;

此处应用:

static string Truncate(string value)
{
if (value.Length <= MaximumDisplayNameLength)
return value;
return value.Substring(0, MaximumDisplayNameLength - Ellipsis.Length) + Ellipsis;
}

最新更新