Contributions
How to see list of test cases that are linked to a specific resource
Hi All! Does anyone know if it is possible to see the test cases or test steps that are using a specific resource when looking in the projects tab? When going to delete a resource it knows how many test cases that are being affected so it would useful to see the tests that are associated. Many thanks Caz554Views0likes0CommentsRe: How to load values from csv PRIOR to setting DataSource
HiNBorovykh Thanks for the message - but have you ever noticed that this doesn't continue to run the tests and stops at the DataSource Loop? Is there a way to inject this method into the into each teststep while running the tests through the command line? We are running our ReadyAPI tests from Jenkins. At runtime we are only wanting to excute the tests in certain regions that we specify. These value would be passed to the testrunner from the jenkins job and then passed to to readyAPI. Any thoughts are being able to develop an approach this way?5 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.8KViews0likes1CommentRe: How to access method getStepTestByName in a teardown script
HimanshuTayalI'm trying to get the logic from the groovy script I've written working at the project level. Currently the functionality requires me to include a groovy script within each testcase. I was wanting to be able to use the same logic in a setup script to reduce the amount of code needed to be inserted into the project. Can we use Java libraries in setup scripts? I'm not sure it is even possible to transfer this approach to a setup script at project level. class SelectedMarkets{ def static selectMarketsToRunTests(testRunner, context, log){ def dataPath def dataFile def headers def rowLine //get the specifcic global property def objGlobalProperties = com.eviware.soapui.SoapUI.globalProperties; def regionToRun = objGlobalProperties.getPropertyValue("region") def regionArray = regionToRun.tokenize(); log.info regionArray //get original dataPath dataPath = context.expand( '${#TestCase#DataPath}' ) //get original dataFile dataFile = context.expand( '${#TestCase#DataFile}' ) //read current file FileInputStream fstream = new FileInputStream(dataPath +"/"+dataFile); DataInputStream data = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(data)); //find relevant lines and then write to another file while ((rowLine = br.readLine()) != null){ if(rowLine.contains("locale")){ headers = "$rowLine" log.info headers; } regionArray.each{ //if finds global property write to new file if(rowLine.contains(it) && !rowLine.contains("locale")){ //create temporary file def tempFile = File.createTempFile("temp" + dataFile, ".csv") //write revalent locales to temp file headers += "\n$rowLine" tempFile.write headers log.info headers //set the datasource to the temp file def dataSourceStep = testRunner.testCase.getTestStepByName("DataSource") dataSourceStep.getDataSource().setFileName(tempFile.absolutePath) } } } data.close(); } }5 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.7KViews0likes2CommentsRe: How to access method getStepTestByName in a teardown script
HimanshuTayal I appreciate the suggestion but ideally I want to use it in my SetUp script to alter the Datasource if there is a global property available When I try to use runner.project in the setup script I keep getting an error?5 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.8KViews0likes4CommentsRe: How to access method getStepTestByName in a teardown script
HiHimanshuTayal Thanks for the reply. If testrunner isn't available at the project level is there a way to reset every datasource of every testcase at the end of the run. I have it working at the testcase level but would like it to be a bit of script that sits in the teardown script of the project. The scripts I've included currently sit at the TestCase level class TearDownForSelectedMarkets{ def static resetTestCaseSettings(testRunner, context, log){ //reset the data to original path DataSource.setDataPath(testRunner,context,log) //reset the datasource path def dataSourceStep = testRunner.testCase.getTestStepByName("DataSource") dataSourceStep.getDataSource().setFileName('${#TestCase#DataPath}/${#TestCase#DataFile}') //delete global property com.eviware.soapui.SoapUI.globalProperties.removeProperty("region") //delete temporary folder/file } } class StartUpForSelectedMarkets{ def static setRegionAsGlobalProperty(testRunner, context, log){ //set global property - SETUP SCRIPT def objGlobalProperties = com.eviware.soapui.SoapUI.globalProperties objGlobalProperties.setPropertyValue("region", "ca ie") } }5 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.8KViews0likes7CommentsHow to access method getStepTestByName in a teardown script
Hi Folks, Is there a reason that this: def dataSourceStep = testRunner.testCase.getTestStepByName("DataSource") Doesn't work in a teardown script? Using a Groovy script I have modified my datasource path to point to a temporary file if a particular global property exists which I execute in a setup script. I am wanting to revert the datasource back to it's original version after it has been run. I am doing it at the testcase level but is there a way to do it at the project level? Any input would be appreciated!5 years agoPlace ReadyAPI QuestionsReadyAPI Questions2.9KViews0likes9CommentsHow to load values from csv PRIOR to setting DataSource
Hey Folks, Is there a way to access the csv file that is populating the datasouce prior to loading the datasource. I'm attempting to isolate only certain rows in the csv file but in order for this to be dynamic I need to be able to determine which rows the data exists so that I can populate the datasource with only those rows. Something like: def objGlobalProperties = com.eviware.soapui.SoapUI.globalProperties; def regionToRun = objGlobalProperties.getPropertyValue("region"); def locale = context.expand( '${DataSource#locale}' ) if(locale == regionToRun) { def dataSourceTestStep = testRunner.getTestCase().getTestStepByName("DataSource") def endRow =dataSourceTestStep.getCurrentRow() dataSourceTestStep.setEndRow(endRow) } I'm not sure if I'm overcomplicating this so I'm open to suggestions. Ideally I would like it to completely ignore the data that isn't in the regions to be run. This is at the testcase level so if there is a way to run this from the project or suite level it would be even better. Each testcase has it's own csv file that it uses to populate the DataSource. Many thanks!Solved5 years agoPlace ReadyAPI QuestionsReadyAPI Questions2KViews0likes5CommentsRe: Is there a way I can input a specific value what will only run tests with that value
meinTest These are great tips and have let me figure out how to come at this problem. Except when you cancel the TestRunner it stops running through to the next TestCase. Test are step up as follows: Set Datasource Path (Groovy) Datasource (csv file) Set Endpoint (Groovy) Rest Request Datasource Loop - goes to the next iteration of the csv file To improve efficency we would like to select set one specific region and run through all of our tests from just that region.5 years agoPlace ReadyAPI QuestionsReadyAPI Questions2KViews0likes1CommentRe: Is there a way I can input a specific value what will only run tests with that value
HimeinTest Thanks for the reply. As a user I want to be able to specify which regions I want my tests to run in before I run the tests. If I set a global property the way you suggested will this me to prevent the other regions from running. The locales are set in the DataSouce so I want to skip the tests that haven't been selected.5 years agoPlace ReadyAPI QuestionsReadyAPI Questions2KViews0likes3Comments