SoapUI Auth Header with special characters - authentication

I am using SoapUI and encountered that if I add umlauts into the password, it does not work as expected.
Here is an example: Lets assume as username "täst" and as password "!23Öüok". SoapUI will create the following Base64 encoded String: "Authorization: Basic dD9zdDohMjM/P29r[\r][\n]". Decoding "dD9zdDohMjM/P29r" will result into this "t?st:!23??ok".
Is there any SoapUI specific setting or anything that I am missing? I think the Base64 encoded String should be like this: "dMOkc3Q6ITIzw5bDvG9r"

I believe that you need to have have encoding as UTF-8 in order to see the desired value.
Go to SOAPUI_HOME/bin
Have a backup of soapui.bat file
Close soapui tool if it is running
Open soapui.bat in a text editor of your choice
Find line set JAVA_OPTS=%JAVA_OPTS% -Dsoapui.ext.libraries="%SOAPUI_HOME%ext"
Add below line after the above line
set JAVA_OPTS=%JAVA_OPTS% -Dfile.encoding=UTF-8
Save the file
Restart soapui, make sure that is reflected in System Properties
This should help you to see the desired output.
Note that if you are using testrunner.bat to execute the tests, incorporate the above suggested change into this file as well.

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.

Set Kettle DB Connection password from Environment Variable

How do I set a database connection's password to use an environment variable. I cannot add these to the kettle.properties file (security policy). When I click control-space on OSX, nothing happens. If I try and paste the string ${PASSWORD} directly into the password field, it does not allow it, due to the presumably non-alphanumeric '$' char.
The other fields as shown below work fine.
The EDIT Connection dialog below shows the field in red, which is what I want to achieve logically.
Using PDI Community 8.2, on Mac OSX Mojave.
I found one solution. Instead of creating the DB connection in Table Input Step with Edit or New, I used the Wizard option, which allowed me to paste ${SOURCE_DB_PASSWORD} variable into the password field.
The characters were obfuscated, so it's impossible to tell if you have the correct value, but it worked.
CTRL+V doesn’t work, you need to right-click and choose paste.
You can encrypt the password and save it on kettle.properties, in spoon directory execute:
Encr.bat -kettle yourpassword
Paste the full result with "Encrypted" in the properties file, restart spoon and test the connection.
In OSX, I believe you need to use the shortcut shift + cmd + space to access the environment variables.
You might need to use the 'get variables'-step to define the variables from kettle.properties.
Just type ${Variable_Name} as you are defining for other environment variable. If open your .ktr file in Notepad++ you can see the value is your Variable_Name instead of Encrypted password. It worked for me :)
enter image description here

Jmeter dynamic URL property with variable not substituted

I have a simple Jmeter test where I have a property to set the URL. The PATH in the Jmeter test is set to the following.
${__P(GET_URL,)}
This works well for all URLs that I have been working with, except for the ones where I need to pass a variable in the URL component.
For example, it works for http://server:port/getemployeelist when I run the test with -JGET_URL=/getemployeelist
Then I created a CSV config element to populate the variable EMP_ID.
Then if I run the test with -JGET_URL=/getemployee/${EMP_ID}, the EMP_ID variable is not getting substituted. Jmeter test gives me an error as follows:
java.net.URISyntaxException: Illegal character in path at index xx: https://://getemployee/${EMP_ID}
Appreciate any help/pointers.
It will not work this way, JMeter doesn't know anything about ${EMP_ID} at the time it is being started, you need to append this ${EMP_ID} to HTTP Request sampler "Path" in the runtime
Start JMeter as:
jmeter -JGET_URL=/getemployee/
Use CSV Data Set Config to read the EMP_ID from the CSV File
In the HTTP Request sampler use construction like /${__P(GET_URL,)}/${EMP_ID} to combine JMeter Property specified via -J command line argument and JMeter Variable originating from the CSV file.
If anything goes wrong first of all check jmeter.log file - it normally contains enough troubleshooting information. If there is nothing suspicious - use Debug Sampler and View Results Tree listener combination to inspect requests and response details, variables and properties names and values, etc.
Had asked this question a while back. Thought of posting the solution which I eventually ended up implementing. In the solution, I created a template jmx with a substitution variable for the HttpSampler.path and then replace the path at runtime. Following are the key points from the scripting done.
This turned out to be a simpler solution that worked for all kinds of API call patterns.
Created a template jmx (jmeter_test_template) with the following line.
<stringProp name="HTTPSampler.path">#PATH#</stringProp>
This jmx has CSV config element to populate variable "EMP_ID". To create this file, just create a new test with any URL and then save it as a template and replace the URL with substitution variable #PATH#.
Created a wrapper script like run_any_api.sh with usage,
sh run_any_api.sh URL=http://server:port/myapp/employees/${EMP_ID}
In the wrapper script, this URL is replaced in place of the token.
sed "s/#PATH#/$URL" jmeter_test_template.jmx > jmeter_test_template.current_test.jmx
jmeter -t jmeter_test_template.current_test.jmx
Last but not the least, please remember to cleanup the temporary jmx,
rm jmeter_test_template.current_test.jmx

How to ignore failure when file does exist when downloading with WinSCP script

Running a script to get a file from SFTP server, however this is recurring job and should still succeed if no file exist, is there an option I can specify?
option batch on
option confirm off
option transfer binary
open sftp://server -timeout=60
password
get /File/2_04-28-2015.txt D:\Files
close
exit
Getting this result:
Can't get attributes of file 'File/2_04-28-2015.txt'.
No such file or directory.
Error code: 2
Tried setting failonnomatch:
winscp> option failonnomatch on
Unknown option 'failonnomatch'.
You cannot tell WinSCP to ignore absent file, when using a specific file name.
But you can check the file existence prior to the actual download.
Easy alternative hack is to use a file mask (note the trailing *) and set the failonnomatch off:
option failonnomatch off
get /File/2_04-28-2015.txt* D:\Files\
(if you are getting "Unknown option 'failonnomatch'", then you have an old version of WinSCP).
Have you tried using MGET instead of GET? It shouldn't fail, just not transfer anything if there's nothing there.

How can I determine if a file upload is a valid CSV file - or at least text - in ColdFusion 8?

I have a form which allows a user to upload a file to the server. How can I validate that the uploaded file is in fact the expected format (CSV, or at least validate that it is a text file) in ColdFusion 8?
For simple formats like CSV, just check yourself, for example via regex.
<cffile action="read" file="#uploadedFile#" variable="contents" charset="UTF-8">
<cfset LooksLikeCSV = REFind("^([^;]*;)+[^;]*$", contents)>
You can place additional checks with regard to file size limits or forbidden characters.
For other file formats, you can check for header signatures that occur in the first few bytes of the file.
You could even write a full parser for your expected file format - for CSV validation, you could do a ListToArray() at CR/LF and check each line individually against a regex. XML should work pretty straightforward as well - just try to pass it to XmlParse(). Binary formats like images are a little more difficult, but libraries exist there as well.
I dont know if it can help you but Ben Nadel wrote excellents posts about CSV:
http://www.bennadel.com/blog/483-Parsing-CSV-Data-Using-ColdFusion.htm
http://www.bennadel.com/blog/976-Regular-Expressions-Make-CSV-Parsing-In-ColdFusion-So-Much-Easier-And-Faster-.htm
http://www.bennadel.com/blog/501-Parsing-CSV-Values-In-To-A-ColdFusion-Query.htm
I think it's as simple as specifying the accept value in cffile ...Unfortunately the CF8 docs don't specify the value as part of the info for cffile ... It's under file management ...
<cffile action=”upload” filefield=”filename” destination=”#destination#” accept=”text/csv”>
CF8 » Controlling the type of file uploaded