You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Adrian Speteanu <as...@gmail.com> on 2010/11/05 17:34:13 UTC
regex / assertion - how to assert that something is the x match in a document?
Hello,
Can you think of a way to assert that something is matched in document on
the exact x match?
I have:
1. variableToMatch - its numeric
2. samplerToAssert - response matches ${variableToMatch} pattern several
times, an assertion without regex will also pass easily, but it is more
important to test that is on the exact match-position no. 2, 3, 4 etc on
various repetitions.
How would you assert this?
My alternative is to add a sampler after that that I'm interested in and
test if variableToMatch equals a regex on the exact same position I predict,
but preferably I want samplerToAssert to fail.
Suggestions?
Thanks,
Adrian
Re: regex / assertion - how to assert that something is the x match
in a document?
Posted by Adrian Speteanu <as...@gmail.com>.
you're right, the only way to solve this elegantly is with XPath, however
I'm not that good with it yet and I need to make this work on pages that are
very complex and that change a lot. so now I will have to dig into this.
On Sat, Nov 6, 2010 at 6:52 AM, Deepak Shetty <sh...@gmail.com> wrote:
> do you have to use a regex ? an XPath assertion has better support for
> positional stuff. Worst case you can always use a beanshell assertion (and
> java regex's)
>
> regards
> deepak
>
> On Fri, Nov 5, 2010 at 9:34 AM, Adrian Speteanu <as...@gmail.com>
> wrote:
>
> > Hello,
> >
> > Can you think of a way to assert that something is matched in document on
> > the exact x match?
> >
> > I have:
> > 1. variableToMatch - its numeric
> > 2. samplerToAssert - response matches ${variableToMatch} pattern several
> > times, an assertion without regex will also pass easily, but it is more
> > important to test that is on the exact match-position no. 2, 3, 4 etc on
> > various repetitions.
> >
> > How would you assert this?
> >
> > My alternative is to add a sampler after that that I'm interested in and
> > test if variableToMatch equals a regex on the exact same position I
> > predict,
> > but preferably I want samplerToAssert to fail.
> >
> > Suggestions?
> >
> > Thanks,
> > Adrian
> >
>
Re: regex / assertion - how to assert that something is the x match
in a document?
Posted by Deepak Shetty <sh...@gmail.com>.
do you have to use a regex ? an XPath assertion has better support for
positional stuff. Worst case you can always use a beanshell assertion (and
java regex's)
regards
deepak
On Fri, Nov 5, 2010 at 9:34 AM, Adrian Speteanu <as...@gmail.com> wrote:
> Hello,
>
> Can you think of a way to assert that something is matched in document on
> the exact x match?
>
> I have:
> 1. variableToMatch - its numeric
> 2. samplerToAssert - response matches ${variableToMatch} pattern several
> times, an assertion without regex will also pass easily, but it is more
> important to test that is on the exact match-position no. 2, 3, 4 etc on
> various repetitions.
>
> How would you assert this?
>
> My alternative is to add a sampler after that that I'm interested in and
> test if variableToMatch equals a regex on the exact same position I
> predict,
> but preferably I want samplerToAssert to fail.
>
> Suggestions?
>
> Thanks,
> Adrian
>