Prevent "t.expect(log).contains('string', 'message')" from printing log - testing

I have a test that looks for ~100 separate substrings of a large log file, and fails if any of the strings is not present. Each time a not-present string is found, I emit a message saying which one. However, the log file is also put into the output log, and it is pretty large. How can I prevent it from being printed?

TestCafe does not allow removing an error message from a report. However, you can rewrite your assertion in the following way to hide the expected string:
const logContains = log.includes(myString);
await t.expect(logContains).ok(`The log file does not contain the following string: "..."`);

Related

How to configure/capture 'failureMessage' to the result file in Jmeter

I have a jmx script which saves the results to a CSV file.
I need to see the 'failureMessage' field in the CSV especially when the 'success' column says 'false' as in the below example. But the failureMessage column always appear as blank irrespective in the csv
Example -
timeStamp|time|label|responseCode|threadName|dataType|success|failureMessage
02/06/03 08:21:42|1187|Home|200|Thread Group-1|text|true|
02/06/03 08:21:42|47|Login|200|Thread Group-1|text|false|Test Failed: expected to contain: password etc.
I tried looking up the jmeter.properties file to check the below which is set to true. But it still doesn't save the message to failureMessage in the csv.
assertion_results_failure_message only affects CSV output
jmeter.save.saveservice.assertion_results_failure_message=true
I cannot reproduce your issue using:
Latest JMeter 5.2.1
With the default Results File Configuration
Running JMeter in command-line non-GUI mode
Demo:
If you cannot see custom assertion failure messages your setup violates at least one of the above 3 points.
Try adding assertions with your requests and you will find it in your results in case of assertions getting failed.

Printing variable in the server code

I have inherited some code that is written in Perl and makes HTTP requests between the server and the client. I want to print few variables that is in the server code but that raises errors when I use the print statement. The variables are scalars, arrays or hashes. I want to print the output to the terminal and only for debugging purposes. Few errors I get are-
malformed header from script 'get_config': Bad header: self=$VAR1 = bless( {
Response header name 'self=Bio' contains invalid characters, aborting request
A simple print 'test' raises error like
malformed header from script 'get_config': Bad header: test
How do I print the variable values without any errors?
You haven't explained yourself very well at all. But, from the errors you're getting, I assume this is a CGI program.
A CGI program sends its output to STDOUT, where the web server catches it and processes it in various ways. In order for this to work, the data that your program prints to STDOUT needs to follow various rules. Probably the most important of those rules is that the first output from your program must be the CGI headers - and at the least, those headers should include a Content-type: header.
I assume that you're trying to display your debugging output before your program has sent the CGI headers. That's not going to work.
But do you really want to send your debugging output to STDOUT? That seems like a bad idea. If you use warn() instead of print() then your output will go to STDERR instead - and in most web servers, STDERR is connected to the web server's error log.
For more control over the output generated by warn(), see the CGI::Carp module.

Storing from wildcard input path

I’m having issues using wildcard input paths in Pig.
If I run the following commands:
A = load ‘/something/*.csv’ using PigStorage(‘,’)
dump A;
I see the output from all csv files in the something folder printed to my console after the job is run.
If, however, I run a store instead:
A = load ‘/something/*.csv’ using PigStorage(‘,’)
store A into ‘somedestination’;
The job fails with the following error message:
Input(s):
Failed to read data from “/something/*.csv”
It looks like the store is attempting to load from the literal path instead of globbing using the wildcard, but if that’s the case then why does it work during the dump? Is there another way to accomplish this?
You may not have the permission to write to that folder.
The dump essentially writes to the tmp folder (or another folder if the configuration is different) and then prints that to the screen.
Do a dump. Look at the log. It should say something like:
Input(s):
Successfully read 0 records from: "‘/something/*.csv’"
Output(s):
Successfully stored 0 records in: "file:/tmp/temp1865628879/tmp-1573237939"
Then next time try and store to the folder that you saw when you did the dump. If that works fine, then you have a permissions problem.

Error loading data "operation: Unexpected"

This is a repost from a question asked on the (now disfunct) bigquery forum.
While uploading data from the bq tool I get the following error:
BigQuery error in load operation: Unexpected. Please try again.
I've tried running several files, but each gives the same exception.
The latest failed job is job_5251c0bf5eb24436a350bdfbdbdb3cd8
It looks like that job hit a SECURITY_VIOLATION error. This is likely due to a line that is longer than the maximum line length (64k).
In the next build of BigQuery (which will probably go live next week) it will give you a better error in this case -- it will tell you which lines are too long, and long lines won't cause the import to fail (subject to the maxBadRecords limit).
In the meantime, you can make sure that your input lines are shorter than 64k (note that newlines can be quoted, so stray quotes can cause lines to appear to be too long).

How to determine when AviSynth has an error message without seeing the video output

Is is there a programmatic way to test for errors in Avisynth scripts before seeing the black and red Error message in the output.
We are currently assembling Avisynth script files as a part of an automated encoding routine. When something goes wrong with Avisynth or the source file, Avisynth renders a big black and red error message. Our encoder sees this as a normal video file and keeps on encoding without raising an error.
What is the best way to check for these errors without actually being seeing the output from the video file.
AviSynth has support for try-catch: http://avisynth.org/mediawiki/Control_structures#The_try..catch_statement
I'm not sure how you would signal an error to your encoder from there. As far as I know you must return a clip from the script, and a return statement inside a try/catch block does not return from the entire script anways: http://avisynth.org/mediawiki/The_full_AviSynth_grammar#Closing_Remarks
You can however log error messages to text files, so I've seen people doing this to test an AVS script for error before running it:
script = "file_to_test.avs"
try {
Import(script)
} catch (err) {
WriteFileStart(BlankClip(), "C:\logfile.txt", script, """ ": " """, err, append=true)
}