how to prioritize event
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
how to prioritize event
I have a test cases defined in excel like
Datasource = Exel
Column : Prerequsite
CreateUser;EditUser
TestCase: LoginRequest
DataSource: Prerequsite : Create User Request, Edit User Rquest
I have a Event like
If datasource Prereq contains Createuser than RUN CreateUserRequest and
If datasource prereq contains edituser than RUN EditUserRequest
So, when i am running above event 1st Create User need to run then edituser should run
but its both running parallel
How can i run one bye one like createUser then Edit User
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey, can you provide more info on this? Is the Event you're talking about a groovy script? Can you provide us the groovy script? Can you share a print screen of your project for us just to understand you better?
Cheers!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Well, let me put it in this way
i have 3 variables storing in datasource as
1) createuser 2) edituser 3) logoutuser
and i have event like this:
if (datasource.contains ("createuser")) { Then here createuser validation will be execute }
if (datasource.contains ("edituser")) { Then here edit user validaton will be execute }
if (datasource.contains ("logoutuser ")) { Then here logout validaton will be execute }
Event : TestRunlisitner after step = datasource
So, Here on my datasource
If i keep only 1 variable like - createuser then event is executing correct
but if i keep 3 varaibles like - createuser;edituser;logoutuser
Then all 3 varaibles executing at the same time but my scenario is
need to excute one by one like 1) createuser 2) edituser 3) logoutuser
I hope this help you ..
Thanks in advance
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
So one thing I see is that you mentioned having a Data Source with multiple variables / columns, one for each of the tests you want to consider running. And that these tests execute when all three variables are present. Using a data-source for this may take some extra work to get it to function the way you want.
This sounds like an issue that might be solved with a wait/sleep command in groovy. That way, the Create User has time to process. You could build in some sort of check that waits until the Create User has a response, and then process the next steps.
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @678,
Have @groovyguy's reply helped you?
Tanya Yatskovskaya
SmartBear Community and Education Manager
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, Tanya
But still my issue not yet resolved,
I need to get prioritize the functions
Thanks
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
if (datasource.contains ("createuser")) { Then here createuser validation will be execute } if (datasource.contains ("edituser")) { Then here edit user validaton will be execute } if (datasource.contains ("logoutuser ")) { Then here logout validaton will be execute }
This is the groovy script you provided. You need these three events to happen one after another, instead of roughly at the same time? The way your groovy script is, depending on how fast it goes, it is going to process all three blocks quickly. What I propose is putting in something like this:
sleep(100);
Using that sort of command can force the groovy script to sleep to give the individual events enough time to process. Outside of that, screenshots and/or a sample of your project may help us troubleshoot.
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
here more information
Datasource-ExcelFile
TestCaseNumber | Function |
TestCase1 | createuser;edituser |
TestCase2 | createuser;edituser;logoutuser |
Events :
TestRunListener.afterStepcreate - Datasource-ExcelFile
Groovy Code:
def datasource = context.expand( '${DataSource#Function}' )
Functions :
//CreateUserFunction
if (datasource.contains("createuser")) {
//Some Create User Code
}
//EditUserFunction
if (datasource.contains("edituser")) {
//Some Edit User Code
}
//Logout User Function
if (datasource.contains("logoutuser")) {
//Some Logout User Code
}
I hope this help
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have you tried adjusting your groovy script code to enact any sort of wait or check for the tests you are running to finish? I've mentioned it a few times but haven't heard whether or not that has worked for you.
---
Click the Accept as Solution button if my answer has helped, and remember to give kudos where appropriate too!
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I tried keeping "sleep" but no luck
Is there any option that on the datasource row if more than one function on one single cell split bye ; and then execute 1 and 2 and 3rd
Thanks
