Forum Discussion
nmrao
Champion Level 3
The screen shot shows multiple test cases. And the groovy script is from one of the test case.
Are you running only one test case from commandline? And that does not the run the groovy script where project variables are set? If so, the groovy script should get executed for each test case.
Consider restructring the test steps.
ijasjit
9 years agoNew Contributor
Hi nmrao,
The groovy Script - GetCoupns (part of AddCouponsToACard test-case) is setting a project variable ids.
The next test-case RemoveCouponsFromACard is supposed to use the project variable ids. This will be used in the test-step RemoveCouponsFromACard.
Its like, I can only remove coupon number which I had added.
This all works good when I execute the testcase via GUI by click on Play button.
I can manually see thet the ids is always updated with a new value, each time the AddCouponsToACard test case is run.
The issue comes when I execute AddCouponsToACard by using the command line testrunner.sh
testrunner.sh -sExternal_Web_PROD -cAddCouponsToACard -r -a -f/opt/SOAR_Test/work/External_Web_PROD -I /opt/External_SoapUI_Project/External_Web_Prod.xml
With this command line execution, the project variable 'ids' is not being set and hence when RemoveCouponsFromACard is run the 'ids' used is not the one which was used by AddCouponsToACard
testrunner.sh -sExternal_Web_PROD -cRemoveCouponsFromACard -r -a -f/opt/SOAR_Test/work/External_Web_PROD -I /opt/External_SoapUI_Project/External_Web_Prod.xml
I tried adding another step, a groovy script to RemoveCouponsFromACard test-case, to log the project id it will be using. But unfortunately the ids logged was not what AddCouponsToACard had used.
def test = context.expand( '$(#Project#ids}' )
log.info = ("Coupon id picked by the RemoveCouponsFromACard Script =" + test
--
Thanks,
JASJIT SINGH
JASJIT SINGH
- nmrao9 years agoChampion Level 3If the test case is to be run automatically, it needs to have all the steps. It can't run one step from other test case and one for another.
- HeikoStudt9 years agoOccasional Contributor
How about using "-S" for save the project? Be carefull, though, as it might collide with your running SoapUI GUI or your source control.
A second option might be an "startup" groovy script for calling a "init" testcase in all the others and then go further. IMHO this might work...
MFG
Heiko Studt
Related Content
- 5 years agoEmilija
- 5 years agoKrishna_Kumar
- 2 years agoTestQA1
- 3 years agoloricotton