Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

`assert contains` always fails #35

Closed
stevegrossi opened this issue Dec 10, 2014 · 3 comments

Comments

@stevegrossi
Copy link

commented Dec 10, 2014

I'm trying out ruby-jmeter with Ruby 2.1.5, and assert contains: 'foo' seems always to fail. To rule out issues with my own test plan, I'm using a simplified version of the Etsy test in the examples directory:

require 'ruby-jmeter'

test do
  defaults :domain => 'www.etsy.com'
  cache :clear_each_iteration => true
  cookies
  threads :count => 1, :loops => 1 do
    transaction '01_etsy_home' do
      visit :name => 'home', :url => 'http://www.etsy.com/' do
        assert 'contains' => 'Etsy'
      end
    end
    view_results_tree
  end
end.jmx
ruby

When running the generated .jmx in JMeter, the ResponseAssertion fails, even though I can clearly see the text "Etsy" appears in the response:

screen shot 2014-12-10 at 9 30 27 am

Here's what JMeter has to say:

screen shot 2014-12-10 at 9 30 37 am

@90kts

This comment has been minimized.

Copy link
Contributor

commented Dec 10, 2014

The trick here is you want the assertion to happen on the main sample, not the sub samples (static assets etc).

In JMeter it looks like this:

and in Ruby-JMeter it looks like this:
assert contains: 'Etsy', scope: 'main'

@90kts 90kts closed this Dec 10, 2014

@stevegrossi

This comment has been minimized.

Copy link
Author

commented Dec 10, 2014

Perfect, that's what I was missing. Thanks!

@90kts

This comment has been minimized.

Copy link
Contributor

commented Dec 10, 2014

no probs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.