Why is the xUnit XML report truncating the test name value - xunit

The complete test name with arguments when executing dotnet test looks like this:
[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:
<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?

Found the code where xUnit runner truncates the test name:
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;
}

Related

Nifi - Route the JSON based on the Array Name

I am new to Nifi, i hv a requirement where we get multiple JSON inputs with different Header Names. I have to parse the JSON and insert into different tables based on the Header value.
Not sure how to use RouteonContent processor or EvaluateJSON Path processor
Input 1
{
"Location": [
{
"country": "US",
"division": "Central",
"region": "Big South",
"locationID": 1015,
"location_name": "Hattiesburg, MS (XF)",
"location_type": "RETAIL",
"location_sub_type": "COS",
"store_type": "",
"planned_open_date": "",
"planned_close_date": "",
"actual_open_date": "2017-07-26",
"actual_close_date": "",
"new_store_flag": "",
"address1": "2100 Lincoln Road",
"address2": "",
"city": "Hattiesburg",
"state": "MS",
"zip": 39402,
"include_for_planning": "Y"
},
{
"country": "US",
"division": "Central",
"region": "Big South",
"locationID": 1028,
"location_name": "Laurel, MS",
"location_type": "RETAIL",
"location_sub_type": "COS",
"store_type": "",
"planned_open_date": "",
"planned_close_date": "",
"actual_open_date": "",
"actual_close_date": "",
"new_store_flag": "",
"address1": "1225 5th street",
"address2": "",
"city": "Laurel",
"state": "MS",
"zip": 39440,
"include_for_planning": "Y"
}
]
Input 2
{
"Item": [
{
"npi_code": "NEW",
"cifa_category": "XM",
"o9_category": "Accessories"
},
{
"npi_code": "NEW",
"cifa_category": "XM0",
"o9_category": "Accessories"
}
]
Use the website https://jsonpath.com/ to figure out the proper JSON expression. But what you could potentially do is use: if the array contains either $.npi_code then do X and if it contains $. country, then do Y

Validation of each field in JSON response using karate API

I want to validate particular fields in the response whether it is integer or float(ex: fullbathrooms field). I tried below code but getting match failed error. Could you please help here ?.....Thanks
Given path '/property-client'
And request {"address": <address>,"city": <city>,"state": <state>,"zipCode": <zipCode>}
When method post
Then status 200
And print response
And match response == {fullbathrooms:'#number'}
Examples:
|read('testFile1.csv')|
Error : match failed: EQUALS
Actual response:
{
"success": true,
"message": {
"version": "1.0",
"response": {
"id": "94568859",
"type": "express",
"responseheader": null,
"reportdata": {
"property": {
"source": null,
"type": null,
"dom": null,
"propertytype": "Single Family Residence",
"standardtype": null,
"address": {
"documentid": null,
"number": "150",
"directional": null,
"street": "BRIDGE",
"suffix": "RD",
"postdirectional": null,
"unit": "",
"city": "HILLSBOROUGH",
"state": "CA",
"zip": "94010",
"zipplus4": "6908",
"fulladdress": "150 BRIDGE RD, HILLSBOROUGH, CA 94010"
},
"info": {
"type": null,
"fips": "6081",
"county": "San Mateo",
"bedrooms": "5",
"bathrooms": "6.50",
"fullbathrooms": "6.50",
"totalrooms": "0",
"livingarea": "7750",
"totallivingarea": "7750",
"landarea": "41382",
"landareatype": null,
"pool": "true",
"landvalue": "6904800",
"improvementvalue": "3284414",
"assessedvalue": "10189214",
"assessedyear": "2021",
"taxvalue": "11746898",
"taxyear": "2021",
"deliquentyear": null,
"yearbuilt": "2011",
"propertytax": null,
"approxage": "11",
"parcelnumber": "032-400-110",
"titlecompany": null,
"geocode": {
"latitude": "37.563272",
"longitude": "-122.334442",
"geoqualitycode": ""
}
}
Please take some time to read the documentation: https://github.com/karatelabs/karate#match-contains
I'm not going to refer to your response dump (which by the way is not valid JSON), but give you a simple example. Please pay attention to the structure of your JSON. And note that the 6.50 is a string not a number in your response.
* def response = { "foo": { "bar": { "fullbathrooms": "6.50" } } }
* match response.foo.bar == { fullbathrooms: '#string' }
If you want to validate numbers within strings, please refer other answers, for example: https://stackoverflow.com/search?q=%5Bkarate%5D+number+regex

How can I get iso code and name from ruby Money::Currency.all in ruby

How can I get iso code and name from Money::Currency.all in Ruby
How can I get iso code and name from Money::Currency.table in Ruby
Money::Currency.all is Array ,I used map ,but don't work
Money::Currency.table is Hash ,I have not find one method to handle the problem
this is Money::Currency.all
{
"id": "usd",
"alternate_symbols": [
"US$"
],
"decimal_mark": ".",
"disambiguate_symbol": "US$",
"html_entity": "$",
"iso_code": "USD",
"iso_numeric": "840",
"name": "United States Dollar",
"priority": 1,
"smallest_denomination": 1,
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol": "$",
"symbol_first": true,
"thousands_separator": ","
},
{
"id": "eur",
"alternate_symbols": [],
"decimal_mark": ",",
"disambiguate_symbol": null,
"html_entity": "€",
"iso_code": "EUR",
"iso_numeric": "978",
"name": "Euro",
"priority": 2,
"smallest_denomination": 1,
"subunit": "Cent",
"subunit_to_unit": 100,
"symbol": "€",
"symbol_first": true,
"thousands_separator": "."
},
this is Money::Currency.table
"aed": {
"priority": 100,
"iso_code": "AED",
"name": "United Arab Emirates Dirham",
"symbol": "د.إ",
"alternate_symbols": [
"DH",
"Dhs"
],
"subunit": "Fils",
"subunit_to_unit": 100,
"symbol_first": false,
"html_entity": "",
"decimal_mark": ".",
"thousands_separator": ",",
"iso_numeric": "784",
"smallest_denomination": 25
},
This works with money-6.6.1 (the one I currently use). Probably works for the newer versions too.
Money::Currency.all.map { |m| [m.iso_code, m.name] } # => [["USD", "United States Dollar"], ...]
Money::Currency.table.values.map { |m| [m[:iso_code], m[:name]] }
# or
Money::Currency.table.values.map { |m| [m["iso_code"], m["name"]] }
You can use pluck to directly get values from an ActiveRecord Collection
In your case you can do
Money::Currency.all.pluck(:iso_code, :name)
You can read more about pluck from here

create incident through webservice in servicenow not creating incident number

I am creating an incident via web service by reading incident json data from a txt file. The incident gets created but the incident number field is empty in the generated incident in my instance(Fiji). I am setting the incident number in the input json data. I wanted to know if we can specify the incident number in the input json data or have the table auto generate the incident number.
Regards,
Priyank
I was curious about your question so I went ahead a tried making a rest call with just the description in the data payload to see what would happen
var requestBody = "{'description':'oh boy'}";
var client=new XMLHttpRequest();
client.open("post","https://scdevelopment.service- now.com/api/now/table/incident");
client.setRequestHeader('Accept','application/json');
client.setRequestHeader('Content-Type','application/json');
//Eg. UserName="admin", Password="admin" for this code sample.
client.setRequestHeader('Authorization', 'Basic '+btoa('DELETED'+':'+'DELETED'));
client.onreadystatechange = function() {
if(this.readyState = this.DONE) {
document.getElementById("response").innerHTML=this.status + this.response;
}
};
client.send(requestBody);
Here is the default JavaScript help from the REST API Explorer. You can see I am just sending a requestBody with the description field.
And here's the response I get
{"result": {
"skills": "",
"upon_approval": "proceed",
"location": "",
"expected_start": "",
"reopen_count": "0",
"close_notes": "",
"additional_assignee_list": "",
"impact": "3",
"urgency": "3",
"correlation_id": "",
"sys_tags": "",
"sys_domain": {
"link": "DELETED",
"value": "global"
},
"description": "oh boy",
"group_list": "",
"priority": "5",
"delivery_plan": "",
"sys_mod_count": "0",
"work_notes_list": "",
"business_service": "",
"follow_up": "",
"closed_at": "",
"sla_due": "",
"delivery_task": "",
"sys_updated_on": "2016-02-28 22:16:26",
"parent": "",
"work_end": "",
"number": "INC0010233",
"closed_by": "",
"work_start": "",
"calendar_stc": "",
"u_votes": "0",
"category": "",
"business_duration": "",
"incident_state": "1",
"activity_due": "",
"correlation_display": "",
"company": {
"link": "DELETED"
},
"active": "true",
"due_date": "",
"assignment_group": "",
"caller_id": {
"link": "DELETED",
"value": "ef04eb560f46c240d0db715be1050e59"
},
"knowledge": "false",
"made_sla": "true",
"comments_and_work_notes": "",
"parent_incident": "",
"state": "1",
"user_input": "",
"sys_created_on": "2016-02-28 22:16:26",
"approval_set": "",
"reassignment_count": "0",
"rfc": "",
"child_incidents": "0",
"opened_at": "2016-02-28 22:16:26",
"short_description": "",
"order": "",
"sys_updated_by": "aj.siegel",
"resolved_by": "",
"notify": "1",
"upon_reject": "cancel",
"approval_history": "",
"problem_id": "",
"work_notes": "",
"calendar_duration": "",
"close_code": "",
"sys_id": "69258f6e133d5200ca3db1676144b01a",
"approval": "not requested",
"caused_by": "",
"severity": "3",
"sys_created_by": "aj.siegel",
"resolved_at": "",
"assigned_to": "",
"business_stc": "",
"wf_activity": "",
"cmdb_ci": "",
"opened_by": {
"link": "DELETED",
"value": "ef04eb560f46c240d0db715be1050e59"
},
"subcategory": "",
"rejection_goto": "",
"sys_class_name": "incident",
"watch_list": "",
"time_worked": "",
"contact_type": "phone",
"escalation": "0",
"comments": ""
}
}
Notice "number": "INC0010233",
Yay, autogenerated incident number.

jqGrid and jqPivot 4.7: Incorrect names for pivoted columns

This sample uses jqGrid 4.6:
http://jsfiddle.net/aUDHx/1218/
As one can see, regardless of the number of aggregates, the header names are displayed correctly ("A A", "A B", etc.)
However, when I switch to version 4.7, the pivoted columns aren't named correctly when more than one aggregate is used:
http://jsfiddle.net/aUDHx/1219/
If only one aggregate is used, the headers display correctly.
Does 4.7 have a different method of specifying the header names, or is this a bug? If the latter, does an appropriate workaround exist?
This is the code for the yDimension:
yDimension: [{
dataName: 'product',
converter: function (val) {return val.replace(/\s/g, ' ');}
}],
The converter function is used to correctly format the header name. This is not required in 4.7 if you only use one aggregate, but anything more than that causes it to break.
"Gurrido" is now the new name of jqGrid.
The problem is in spaces which you use in names. jqPivot don't support currently spaces in the names. You can fix the problem by replacing the spaces to _ (underscore) for example. I described the workaround here.
By the way Gurrido jqGrid is not the only successor of free open source jqGrid with MIT licence. After starting Gurrido jqGrid some other jqGrid forks of the last free jqGrid is developing. I post my results here. I plan to publish new version probably in the current month. Another fork you can find here. One apply in the fork many changes which I make in my repository, but one make some his own changes too.
UPDATED: The problem with the labels which you described is a bug in jqGrid 4.7. By the way you don't need to use the converter in case of usage spaces in the aggregation values.
I posted the bug fix here in my jqGrid repository. You can see the results on the demo http://jsfiddle.net/OlegKi/b47ocLd7/
The demo uses the following JavaScript code
var mydata = [
{ id: "1", product: "A A", sold: "8", sold2: "8", sold3: "8", emp: "Michelle" },
{ id: "2", product: "A A", sold: "3", sold2: "8", sold3: "8", emp: "Tania" },
{ id: "6", product: "A B", sold: "1", sold2: "8", sold3: "8", emp: "Mark" },
{ id: "3", product: "A B", sold: "5", sold2: "8", sold3: "8", emp: "Tommy" },
{ id: "4", product: "B B", sold: "2", sold2: "8", sold3: "8", emp: "Dave" },
{ id: "5", product: "B B", sold: "5", sold2: "8", sold3: "8", emp: "Carol" }
];
$("#grid").jqGrid("jqPivot", mydata, {
xDimension: [
{ isGroupField: false, width: 40, dataName: "id", label: "ID" },
{ isGroupField: false, width: 80, dataName: "emp", label: "Employee" }
],
yDimension: [
{ dataName: "product" }
],
aggregates: [
{ aggregator: "sum", width: 60, member: "sold", label: "Sold" },
{ aggregator: "sum", width: 60, member: "sold2", label: "Sold 2" }
],
colTotals: true
},
{
height: "auto",
pager: "#pager",
iconSet: "fontAwesome",
resizeStop: function () {
$(this).jqGrid("setGridWidth", this.grid.newWidth, false);
},
caption: "Daily Sales"
}
);

Resources