On sending an incorrect username/password, the server application sends this JSON:
{"result":"error","additional-info":"Incorrect username or password"}
I have made the assertion:
Server sends:
But the tree viewer seems to indicate that there is an error. The response log file has this message
timeStamp,elapsed,label,responseCode,responseMessage,threadName,dataType,success,failureMessage,bytes,sentBytes,grpThreads,allThreads,URL,Latency,IdleTime,Connect
1606209008151,39,SignInRequest,401,Unauthorized,SignInUsers 1-1,text,**false**,**path can not be null or empty**,570,263,1,1,http://localhost:9000/ws/users/signin,37,0,21
What am I doing wrong in asserting the response?
UPDATE
I added json assertion but when I run the test, the screen looks like this (red color but not sure what the reason is)
Interestingly, if I change the validation from error to "error" then I can see reason (kind of expandable tree) which when using just error doesn't appear.
If you want to compare the full response - you need to go for Response Assertion.
however it's very sensitive to any changes, a whitespace or line break will cause the failure.
JSON Assertion allows executing arbitrary Json Path queries, so if you want to assert additional-info element you should go for something like:
and this one is for result:
You are validating the expected results, so you don't fail
Check Invert assertion checkbox if you want it to fail (or change to success response)
Invert assertion (will fail if above conditions met) Invert assertion (will fail if above conditions met)
For http://www.filmiclub.com/, I am getting this error in the W3C validator:
Element head is missing a required instance of child element title
But when I copy the HTML and do validation with "Validate by direct input", the HTML is 100% error free and there is no validation error.
Do you know why PHP generated HTML with this error?
Choose the "Show source" option and click Revalidate, you'll see the cause. your PHP script is crashing when receiving a request from the validator, so then PHP sends out its own error message response instead of your website.
<h4>A PHP Error was encountered</h4>
<p>Severity: Notice</p>
<p>Message: Undefined index: HTTP_ACCEPT</p>
<p>Filename: helpers/common_helper.php</p>
<p>Line Number: 7328</p>
Apparently the W3C's validator sends a HTTP request that does not have the Accept: header, but your PHP code expects the HTTP_ACCEPT header to be present and fails because it is absent.
Change your PHP code to detect the presence (or lack of) Accept header, like so:
if( isset( $_SERVER['HTTP_ACCEPT'] ) ) {
// code here
}
Using XPath assertion: //ul/#class after a HTTP request, the assertion returns:
success_message_1=links
success_message_2=accordion vertnav vertnav-top grid-full
success_message_3=grid-full classic
success_message_4=checkout-types
success_message_5=links
success_message_matchNr=5
It is missing exactly one element, which happens to be the success message I need to find. The structure of the success message is:
<ul class="messages"><li class="success-msg"><ul><li>Message</li></ul></li></ul>
Strangely targeting the item with //li[#class="success-msg"] returns nothing. Using jQuery I did a simple jQuery('ul') and it matches all of the <ul> including the missing one.
I've checked the response and the success message does exist in the response, but why can't I select it with XPath?
The correct XPath expression if you need to obtain "Message" "vanilla" XPath selector will look like
//li[#class='success-msg']/ul/li/text()
If your page is not XML/XHTML compliant you may require to enable "Use Tidy" box in your XPath Assertion.
Particularly for your code following XPath Assertion works for me:
//li/text()='Message'
You may wish to use XPath Extractor combiner with Debug Sampler and View Results Tree listener to see what is the output of your XPath queries and once you'll get "true" - the query is OK to be used in the assertion.
I'm having problems trying to make angular run all the validations of an input at once.
Here is a jsfiddle example of my problem http://jsfiddle.net/carpasse/GDDE2/
if you type 1 character on the email input you get this "The minimum lenght is 3." error message
and is not until you type 2 more characters than you get the other error message "This is not a valid email."
Does anybody know how to make angular show both error messages at the same time??
Thanks a lot in advance
You problem is not that all the validators are not being run - they are!
Remember that the way these validations work is by passing the view values through a pipeline of transformation functions, which can also specify the validity of the value.
The problem is that the min length validator passes undefined down the pipeline if it is not valid and that the email validator says that undefined is a valid email address!
Try creating your own validation directive that says that undefined is not a valid email address and you will find both errors are showing: http://jsfiddle.net/eKfj3/
I have been using JMeter for a while and only for load tests. I was wondering if I can use it for ordinary functionality testing.
For example: I have a malformed XML and an application returns 400 Bad Request which I expect to be returned - so it's correct but JMeter resolves it as a failure.
I tried Response Assertions but it didn't work...
Is this possible with JMeter?
To test a non 200 response code, you must check the 'Ignore Status' field in the Response Assertion. Without this, the test will always fail regardless of the response assertion.
So here is what you need to do to test the http response code 400:
Add a new Response Assertion.
Set the following assertion properties:
check the 'Response Code' radio button.
check the 'Ignore Status' box.
check the 'Equals' radio button in the Pattern Matching Rules.
click the 'Add' button.
enter '400' in the row in Patterns to Test.
Done.
Easily.
See answers to this.
You can also possibly try NOT check-box in Pattern Matching Rules Response Assertion.