jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Kenworthy <Stuart.Kenwor...@bjss.com>
Subject RE: Need some help with HTTP responses and Assertions.
Date Fri, 29 Sep 2017 14:47:40 GMT
Yeh sorry bit of a tricky one but I have written solutions to very similar problems in the
past. To be honest the script should not be too big.

Load in the data
If uri/url is landing page
  Check for some strings (assertion) and assign a variable, either with the value or true
or false
  If assertion variables are true/set exit
  Else log out failed assertion(s) and fail sampler
Else set a variable as true to get past the challenge page in the following if controller

Done

Happy beans. :)

-----Original Message-----
From: Gratzer, Steve [mailto:steve.gratzer@aciworldwide.com.INVALID]
Sent: 29 September 2017 15:25
To: JMeter Users List <user@jmeter.apache.org>
Subject: RE: Need some help with HTTP responses and Assertions.

That's what I was afraid of.  Still, although I expected it, it never hurts to ask if there
is another way of doing something.  Thanks for the input all the same!

Steve

-----Original Message-----
From: Stuart Kenworthy [mailto:Stuart.Kenworthy@bjss.com]
Sent: Friday, September 29, 2017 9:47 AM
To: JMeter Users List <user@jmeter.apache.org>
Subject: RE: Need some help with HTTP responses and Assertions.

OK, this is a bit of an awkward one then.

You want to assert the landing page only.
If there is a challenge page, don't assert it, work past it to the landing page and assert
then.

The best way approach this may be to assert via script instead of using built in jmeter objects.

When the logon is requested, include a post processor pull down the response using

String response = prev.getResponseDataAsString();

which checks conditions of "response" and look for your assertion strings from within the
string variable.

If your scripted assertions fail, use logging within the script to log failed assertions and
set the sampler as failed using prev.setSuccessful(false);

As part of this you can also set a variable which will be used in an if controller to answer
the challenge page and request home again, this call can have standard assertions.

As you are using 2.13, you may be better trying beanshell postprocessors but no harm in trying
JSR223 script for future versions.

-----Original Message-----
From: Gratzer, Steve [mailto:steve.gratzer@aciworldwide.com.INVALID]
Sent: 29 September 2017 13:51
To: JMeter Users List <user@jmeter.apache.org>
Subject: RE: Need some help with HTTP responses and Assertions.

The landing page takes that long.  I need to follow the redirects to determine whether or
not I hit the challenge page or the landing page.  I do have a view tree listener in the script
so I know that it is flowing correctly.  As I've said, the script works as expected, but since
that landing page takes so long to load it makes the duration of the script execution excessively
long.  The functionality of the page is out of my scope as this script is for monitoring and
I am not the developer.  So I am trying to eliminate one of the 20+ second load times.  I
would like to remove the GET sampler since the previous post sampler is already following
the redirects to their conclusion and just replace it with an if controller (if last url is
equal to landing page then do assertions).  The problem I have is that when I just wanted
to test if the assertions would work after following the redirects from the POST action. 
There I made sure that one or the other assertion would alert (just for testing purposes)
however neither alerted.  So I am not certain why the assertions didn't show up other than
the sampler that they are under is a POST method and not GET.

The Submit Password is a POST sampler and follows the redirects.  As you can see it takes
23.5 seconds to execute (most of it is for the return of the landing page).  Additionally,
the next step (Retrieve Accounts Page aka the landing page) takes 21.4 seconds to execute.
 The assertions are under that step and work as expected.  When I tried putting the assertions
under the previous step, they don't alert for not found content (and yes I did change the
assertions so that at least one would fail for this test) .

108:39:55.526Monitoring Test Execution 1-11. Initiate User Session1249Success1138012491002
208:39:56.797Monitoring Test Execution 1-12. Submit Username596Success116542080 308:39:57.424Monitoring
Test Execution 1-13. Retrieve Password Page195Success111961940 408:39:57.641Monitoring Test
Execution 1-14. Submit Password 23541Success1450614130 508:40:21.214Monitoring Test Execution
1-15. Retrieve Accounts Page21405Success12328214040 608:40:42.623Monitoring Test Execution
1-16. Logout / End Session179Success5231780

-----Original Message-----
From: Stuart Kenworthy [mailto:Stuart.Kenworthy@bjss.com]
Sent: Friday, September 29, 2017 4:33 AM
To: JMeter Users List <user@jmeter.apache.org>
Subject: RE: Need some help with HTTP responses and Assertions.

Firstly, what is causing the 20+ delay? Do you have a global timer in force? But if this is
also happening in postman it is very unlikely it is anything to do with the tool you are using.

In your original statement you said jmeter is taking 20+ seconds to load the response, I do
not understand where you get this assumption from, jmeter doesn't actually load anything.
No parsing or rendering takes place unless you try to look at the response in a listener but
this is does asynchronous the to the transaction itself.

What are the resulting different times for this transaction type as reporting in jmeter?

But you main concern seems to be the assertions are not working when the landing page is present
as a result of redirects instead of the challenge page. Have you included a view results tree
to see what is actually coming back in both the redirects and they final stop?

-----Original Message-----
From: Gratzer, Steve [mailto:steve.gratzer@aciworldwide.com.INVALID]
Sent: 28 September 2017 22:51
To: JMeter Users List <user@jmeter.apache.org>
Subject: RE: Need some help with HTTP responses and Assertions.

Let me clarify.

The redirects are not the issue and they need to be followed to their conclusion.
The landing page is the only thing that takes 20+ seconds to load.
The landing page is automatically returned after successful login and if a challenge page
is not presented.
Following the redirects are necessary so that I can determine if a challenge page needs to
be dealt with before the script can proceed to the landing page.

Currently I am doing a POST for the password submittal using an HTTP sampler.  If the challenge
page is not returned then the last result will be the landing page.  Assertions at that point
do not seem to work as expected (or at all from what I see).  This in turn forces me to do
a GET HTTP sampler for the landing page.  This adds 20+ seconds to the script duration (which
I believe to be an unnecessary step to do).



-----Original Message-----
From: Stuart Kenworthy [mailto:Stuart.Kenworthy@bjss.com]
Sent: Thursday, September 28, 2017 4:11 PM
To: JMeter Users List <user@jmeter.apache.org>
Subject: Re: Need some help with HTTP responses and Assertions.

Seeing the same behaviour in postman most likely points to an issue in the request structure
or the system under test. Are you missing out some headings?

Or as I previously commented in another post, could it be and ancillary activity such as dns
lookup and timeout causing the issue? Is your browser using a proxy config your jmeter or
postman request is not using?

On 28 Sep 2017 21:07, Stuart Kenworthy <Stuart.Kenworthy@bjss.com> wrote:
On top of that, jmeter will not hold up the redirects due to an assertion. Jmeter will only
assert on the final redirect not each redirect in turn. The 20 second delay between redirects
is unlikely to be caused by you asking for and assertion. Something else must be in play.

On 28 Sep 2017 20:32, Deepak Shetty <shettyd@gmail.com> wrote:
Im not sure I understand your issue exactly but hopefully this will clarify a couple of things.

In JMeter , every request/response can be asserted against , but there are a couple of flags
that control whether you can do it on JMeter with some implications for your test case.
The way I understand your issue is you are logging in , and then there are a bunch of redirects
that take you to the home page (or some page) and you are writing asserts for this final page
, but you'd rather write asserts for the first post ?
The HTTP Request in JMeter has the Follow Redirects which controls whether JMeter automatically
follows redirects - If you do not want to this , then uncheck it. Once you do that you can
inspect /assert the response returned . However your test script has to change to extract
the URL being redirected to and then a new sampler that actually makes a new request for this
URL.(You can use transaction controllers if you want both individual times and grouped up
times)

So effective you can either do
Request 1 (Follow Redirects = true, redirect automatically false)
   (Request 2,3,4,..n)
   Assert final

OR
Request 1(Follow redirect = false, redirect automatically false)
+Assert1
+Regex extract , extract Location header into say url2) Assert 3xx
+response code

Request $url2 (follow redirects or not as required , if not then each redirect needs its own
request)

Note however in most systems there is really nothing to assert against in Request 1 (other
than status codes , if the system is issuing a redirect ) because there wont be a response
- youll have to use a browser tool to understand the request/response for your application

regards
deepak










On Thu, Sep 28, 2017 at 10:24 AM, Gratzer, Steve < steve.gratzer@aciworldwide.com.invalid>
wrote:

> Currently I have a jmeter script that does a login to a site.  The
> issue I am running into is that when the login process completes, it
> goes through some redirects and finally drops you at the landing page.
> The landing page is what I am using assertions on.  Essentially, this
> works fine, but with one problem.  The landing page takes 20+ seconds
> to load.  So, when the script submits (POST) the password to proceed,
> jmeter takes 20+ seconds to load the response and then another 20+
> seconds to reload the page with a GET sampler to do assertions on.
>
> This looks ugly from a monitoring standpoint as those two actions
> consume
> 40+ seconds to complete.
>
> At this point, I would like to do the assertions against the resulting
> return of the POST sampler instead of doing an additional GET sampler
> which adds another 20+ seconds to the script duration, but it doesn't
> seem to work that way.  I am assuming that the POST sampler is what
> the assertions are having an issue with.  They do not alert for missing content.
>
> So, I am wondering if there is something I am missing?  Is my
> understanding not correct, or am I trying to do something that isn't
> available?
>
> I do need to follow the redirects after submitting the password to
> check the final returned URL.  It may return a security validation
> page that the script has to address, so I can't turn that off.
> Optimally, I would like to find a way that I can run the assertions on
> the final return results of a POST request.  This way I won't be
> getting the page automatically after the POST and then having to do a GET in order to
perform the assertions.
>
> Jmeter version is 2.13 (not my choosing, that is what I have to use).
>
> Order of sequence:
>
>
>   1.  Establish session / Get login page
>   2.  POST username
>   3.  GET password page
>   4.  POST password
>   5.  Check for additional security URL
>   6.  GET landing page
>
> ________________________________
> [https://www.aciworldwide.com/-/media/aci-footer]<http://
> www.aciworldwide.com<http://www.aciworldwide.com>>
> This email message and any attachments may contain confidential,
> proprietary or non-public information. The information is intended
> solely for the designated recipient(s). If an addressing or
> transmission error has misdirected this email, please notify the
> sender immediately and destroy this email. Any review, dissemination,
> use or reliance upon this information by unintended recipients is
> prohibited. Any opinions expressed in this email are those of the author personally.
>



The information included in this email and any files transmitted with it may contain information
that is confidential and it must not be used by, or its contents or attachments copied or
disclosed to, persons other than the intended addressee. If you have received this email in
error, please notify BJSS. In the absence of written agreement to the contrary BJSS' relevant
standard terms of contract for any work to be undertaken will apply. Please carry out virus
or such other checks as you consider appropriate in respect of this email. BJSS does not accept
responsibility for any adverse effect upon your system or data in relation to this email or
any files transmitted with it. BJSS Limited, a company registered in England and Wales (Company
Number 2777575), VAT Registration Number 613295452, Registered Office Address, First Floor,
Coronet House, Queen Street, Leeds, LS1 2TW.
________________________________
 [https://www.aciworldwide.com/-/media/aci-footer] <http://www.aciworldwide.com> This
email message and any attachments may contain confidential, proprietary or non-public information.
The information is intended solely for the designated recipient(s). If an addressing or transmission
error has misdirected this email, please notify the sender immediately and destroy this email.
Any review, dissemination, use or reliance upon this information by unintended recipients
is prohibited. Any opinions expressed in this email are those of the author personally.
B KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB  [  X  ܚX KK[XZ[
 \ \ ][  X  ܚX P Y]\  \X K ܙ B  ܈Y][ۘ[  [X[  K[XZ[  \ \ Z[ Y]\  \X
K ܙ B

The information included in this email and any files transmitted with it may contain information
that is confidential and it must not be used by, or its contents or attachments copied or
disclosed to, persons other than the intended addressee. If you have received this email in
error, please notify BJSS. In the absence of written agreement to the contrary BJSS' relevant
standard terms of contract for any work to be undertaken will apply. Please carry out virus
or such other checks as you consider appropriate in respect of this email. BJSS does not accept
responsibility for any adverse effect upon your system or data in relation to this email or
any files transmitted with it. BJSS Limited, a company registered in England and Wales (Company
Number 2777575), VAT Registration Number 613295452, Registered Office Address, First Floor,
Coronet House, Queen Street, Leeds, LS1 2TW.
________________________________
 [https://www.aciworldwide.com/-/media/aci-footer] <http://www.aciworldwide.com> This
email message and any attachments may contain confidential, proprietary or non-public information.
The information is intended solely for the designated recipient(s). If an addressing or transmission
error has misdirected this email, please notify the sender immediately and destroy this email.
Any review, dissemination, use or reliance upon this information by unintended recipients
is prohibited. Any opinions expressed in this email are those of the author personally.

The information included in this email and any files transmitted with it may contain information
that is confidential and it must not be used by, or its contents or attachments copied or
disclosed to, persons other than the intended addressee. If you have received this email in
error, please notify BJSS. In the absence of written agreement to the contrary BJSS' relevant
standard terms of contract for any work to be undertaken will apply. Please carry out virus
or such other checks as you consider appropriate in respect of this email. BJSS does not accept
responsibility for any adverse effect upon your system or data in relation to this email or
any files transmitted with it. BJSS Limited, a company registered in England and Wales (Company
Number 2777575), VAT Registration Number 613295452, Registered Office Address, First Floor,
Coronet House, Queen Street, Leeds, LS1 2TW.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org ________________________________
 [https://www.aciworldwide.com/-/media/aci-footer] <http://www.aciworldwide.com> This
email message and any attachments may contain confidential, proprietary or non-public information.
The information is intended solely for the designated recipient(s). If an addressing or transmission
error has misdirected this email, please notify the sender immediately and destroy this email.
Any review, dissemination, use or reliance upon this information by unintended recipients
is prohibited. Any opinions expressed in this email are those of the author personally.
B KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB  [  X  ܚX KK[XZ[
 \ \ ][  X  ܚX P Y]\  \X K ܙ B  ܈Y][ۘ[  [X[  K[XZ[
 \ \ Z[ Y]\  \X K ܙ B

The information included in this email and any files transmitted with it may contain information
that is confidential and it must not be used by, or its contents or attachments copied or
disclosed to, persons other than the intended addressee. If you have received this email in
error, please notify BJSS. In the absence of written agreement to the contrary BJSS' relevant
standard terms of contract for any work to be undertaken will apply. Please carry out virus
or such other checks as you consider appropriate in respect of this email. BJSS does not accept
responsibility for any adverse effect upon your system or data in relation to this email or
any files transmitted with it. BJSS Limited, a company registered in England and Wales (Company
Number 2777575), VAT Registration Number 613295452, Registered Office Address, First Floor,
Coronet House, Queen Street, Leeds, LS1 2TW.
Mime
View raw message