1
votes

Hello I'm using JMeter for testing an application but before trying any complex test plan I decided to try a simple request.

My test plan is like this:

Sampler --> HTTP Request
   Name: redirect test
   Server Name or IP: localhost/sample
   Method: GET
   Path: redir.php

My redir.php has this code <meta http-equiv="refresh" content="0;url=here.php">

And my here.php file contains this text : HELLO, YOU HAVE BEEN REDIRECTED

After that, I create a Response assertion that searchs for the word 'HELLO'.

When I execute the plan and check the results in the View Results Tree listener it says an error ocurred because the word 'HELLO' was not found.

This image shows my HTTP Request configuration

http://s7.postimg.org/k19tw7p0r/http_Request.png

And this one the Assert:

http://s4.postimg.org/4dg2sebfh/htpp.png

And this is the error JMeter returns to me

http://s8.postimg.org/dxbl00wv9/error_fdfdf.png

I have been searching and I found this in the response data section:

http://s9.postimg.org/h49m8ippr/redirect.png

Looks like Jmeter is searching the string 'HOLA' in the response.

I appreciate any help

1

1 Answers

1
votes

JMeter is not a browser so will not interpret an HTML page containing:

<meta http-equiv="refresh" content="0;url=here.php" />

So assertion fails because this page does not contain "Hello".

So to make your sample work, you need to extract from the previous response "here.php" , make JMeter call it and then check the Hello word in this latter response.

To do so add a Regular Expression Extractor under the first request and extract the url

Then add a Http Request to call this URL and add your assertion there.