You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by gangadhara kopparapu <ga...@gmail.com> on 2020/08/04 19:59:37 UTC

Query on Test Fragment in jmeter

Hi,

While working with test fragments, i came across one situation where I'm
stuck. Please help me out with the below problem.

Problem statement :
How to refer same test fragment under a thread group multiple times with
different test data.

Scenario: Login to Amazon and place order for two different items and
logout.

3 Test fragments created:
1. Login to Amazon
2. Place order
3. Logout

I'm using csv file to pass data for all test fragments.

Now, created a thread group, using include controller i have referred the
test fragments  in the below order :

1. login,
2. place order,
3. place oder (referred twice for 2nd item order)
4. Logout

Here I'm not able to perform second item order as the logic in 'place
order' is reading  first item order only.

How i can pass different data to place when it is called second time in
same thread group?

Please advise me on this.

Thanks and Regards
Gangadhara K

Re: Query on Test Fragment in jmeter

Posted by Mariusz W <ma...@gmail.com>.
Hi,
Not sure if I understand whole scenario but I usually use Module Controller
to include test fragment and JSR223 Sampler before each Module Controller
to prepare data for that Test Fragment.

Regards,
Mariusz

On Tue, 4 Aug 2020 at 22:00, gangadhara kopparapu <ga...@gmail.com>
wrote:

> Hi,
>
> While working with test fragments, i came across one situation where I'm
> stuck. Please help me out with the below problem.
>
> Problem statement :
> How to refer same test fragment under a thread group multiple times with
> different test data.
>
> Scenario: Login to Amazon and place order for two different items and
> logout.
>
> 3 Test fragments created:
> 1. Login to Amazon
> 2. Place order
> 3. Logout
>
> I'm using csv file to pass data for all test fragments.
>
> Now, created a thread group, using include controller i have referred the
> test fragments  in the below order :
>
> 1. login,
> 2. place order,
> 3. place oder (referred twice for 2nd item order)
> 4. Logout
>
> Here I'm not able to perform second item order as the logic in 'place
> order' is reading  first item order only.
>
> How i can pass different data to place when it is called second time in
> same thread group?
>
> Please advise me on this.
>
> Thanks and Regards
> Gangadhara K
>

Re: Query on Test Fragment in jmeter

Posted by Felix Schumacher <fe...@internetallee.de>.
Hi.

You are probably stumbling over the fact, that the csv reader (like many
other elements) are listening for iteration events, that trigger some
action. In the case of the csv reader, such an event will trigger
reading the next line of a csv file. The elements that trigger those
events are generally (in the tree) above those elements that listen for
them. In your case, the csv reader will be triggered by an iteration of
the thread group, only.

If you want to do the place order twice, place the element inside a loop.

Regards

 Felix

Am 04.08.20 um 21:59 schrieb gangadhara kopparapu:
> Hi,
>
> While working with test fragments, i came across one situation where I'm
> stuck. Please help me out with the below problem.
>
> Problem statement :
> How to refer same test fragment under a thread group multiple times with
> different test data.
>
> Scenario: Login to Amazon and place order for two different items and
> logout.
>
> 3 Test fragments created:
> 1. Login to Amazon
> 2. Place order
> 3. Logout
>
> I'm using csv file to pass data for all test fragments.
>
> Now, created a thread group, using include controller i have referred the
> test fragments  in the below order :
>
> 1. login,
> 2. place order,
> 3. place oder (referred twice for 2nd item order)
> 4. Logout
>
> Here I'm not able to perform second item order as the logic in 'place
> order' is reading  first item order only.
>
> How i can pass different data to place when it is called second time in
> same thread group?
>
> Please advise me on this.
>
> Thanks and Regards
> Gangadhara K
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org