How to print only test summary in jest and testing-library? - jestjs

Running jest results in summary of failed and passed tests like:
✕ displays no result message if they are no results (5101 ms)
✕ displays too many results message if they are too many results (5030 ms)
✓ displays too short message if the phrase is too short (60 ms)
...
But then it prints a very long description of why each test failed like:
● displays no result message if they are no results
Unable to find an element with the text: No results found. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
Ignored nodes: comments, script, style
<body>
<div>
<div
...
These details can have more then thousand lines for each tests
I don't want that, summary is enough. Can I turn off the details somehow?

Related

How do I get the field 'subsidiary.federalidnumber' in an Advanced PDF/HTML Template printed from Item Fulfillment?

In the template I have the following code;
<p>1-${record.subsidiary.federalIdNumber}</p>
<p>2-${record.subsidiary.custrecord_invoice_company_email}</p>
<p>3-${record.subsidiary.custrecord_invoice_company_phone}</p>
The last two lines return the expected values but the federalIdNumber gives the following error:
ERROR: Field 'subsidiary.federalIdNumber' Not Found
I have also tried all lower case (federalidnumber), same error.
I know the field exist, works on other SO prints. Any other ways to get this field?
It's just ${subsidiary.federalidnumber} No record. prefix. It is the transaction's subsidiary not the user's though.
weirdly I just took a look at some working templates. note the test vs getting the value:
<#if record.subsidiary.fedralidnumber?has_content>
<b>GST Number: ${subsidiary.federalidnumber}</b>
</#if>

Get Outcome by Test Case ID

I'm at a loss with this one. What is the most direct way I can get the outcome of a test run associated with a test case (work item)?
Here is the API call for Get Results:
GET https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results/{testCaseResultId}?api-version=5.0
I would need the runId and the testCaseResultId.
I can get a list of test runs:
GET https://dev.azure.com/{organization}/{project}/_apis/test/runs?api-version=5.0
but this doesn't seem to have any association with test cases.
There isn't much to do with the Test Cases section of the API.
I must be missing something, it shouldn't be this hard to get a result of a test case?

U-SQL Job Failing

I have a USQL Script which works fine for a single file.
I put some ?? operators in the query to account for missing data cases too.
Now, when I ran it on about 900 JSON files:
TooManyVertexFailedInStage: Too many vertex failures in a stage
E_RUNTIME_USER_EXPRESSIONEVALUATION: Error while evaluating expression Microsoft.Analytics.Samples.Formats.Json.JsonFunctions.JsonTuple(tmp_0[0])["Value"] ?? "0"
Component
JobManager_User
Message
Too many vertex failures in a stage
Description
Many vertices in stage SV1_Extract failed due to Vertex user code error.
Details
Vertex SV1_Extract[4613].v0 {9199FFCE-F114-47D1-912E-D5FFBAC11E0C} failed
Error:
Vertex user code error
exitcode=CsExitCode_StillActive Errorsnippet=
I am not getting the cause of the error?
And how could I resolve it?
If you run your script locally you should see more detailed error information in the console output. Without knowing what your code does, it's hard to infer the error but it could be that tmp_0 is null, or is of zero length, or has a zeroth element that doesn't have a property called value. Your ?? operator wouldn't help with any of these cases.

Getting "required (...)+ loop did not match anything at input 'Scenario:'" error when using Background section in cucumber

I am writing a Karate DSL test to test a web service end point. I have defined my url base in karate-config.js file already. But when I try to use this in the Background section, I am getting the below error. Please help. Provided my feature file below.
Error: "required (...)+ loop did not match anything at input 'Scenario:'"
Feature: Test Data Management service endpoints that perform different operations with EPR
Background:
url dataManagementUrlBase
Scenario: Validate that the contractor's facility requirements are returned from EPR
Given path 'facilities'
And def inputpayload = read('classpath:dataManagementPayLoad.json')
And request inputpayload
When method post
Then status 200
And match $ == read('classpath:dataManagementExpectedJson.json')
You are missing a * before the url
Background:
* url dataManagementUrlBase

Cucumber "OR" clause?

Is it possible to specify some kind of "OR" (alternative) clause in Cucumber?
I.e. if I have two valid responses to some event I would like my test to pass if either of them happens.
Something like that:
"When I press a button"
"Then I should see the text 'Boo'"
"Or I should see the text 'Foo'"
My particular scenario is a login screen. When I try to log in with some random password, I should see an error message "invalid password" if the server is working or a message "network error" if it is not.
You can't really define OR functionality using the Gherkin but you can pass in a list and check that one of the values in the list matches what was returned.
Define list:
Then the greeting service response will contain one of the following messages
|Hello how are you doing?|
|Welcome to the front door!|
|How has your day been?|
|Come right on in!|
Check list:
#Then("the get messages service response will contain one of the following messages")
public void text_matching_one_of_the_following(List<String> greetingMessages){
boolean success = false;
for(String message : greetingMessages){
assertTrue(textMatchesResponse(message));
}
}
OR is not supported. You can use Given, When, Then, And and But. Please refer to http://docs.behat.org/en/v2.5/guides/1.gherkin.html
But perhaps you could make use of the But keyword to achieve what you are looking for.

Resources