Contributions
Re: Not able to retrieve the last value in grid data source
RadfordIdeally it should be cancelled everytime last row is encountered. But that the issue i am facing, Ready API does not cancel. It does run the case, but its not entering this if block. Since, Ready API, by default, adds 1 row to the grid, i added "rows - 1" - because i have 25 records, but row count method returns 26 (because of extra row added by Ready API). So when last row is encountered, it should cancel the execution of the test case. I tried with "currentRowIndex == rows" condition as well, in this case, ideally, the case should be cancelled when blank row (row added by ready api) is encountered. But it doesn't cancel it then as well. The case is run with value from "dataTag" column of last row (rows-1).6 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.4KViews0likes0CommentsNot able to retrieve the last value in grid data source
I have a very unusal problem. This is the structure of my test cases : - grid data source, with 2 columns - dataTag and runDataTag - dataTag has the actual data tag - runDataTag has value yes and no - which is used to check if this data tag should be run or not. - groovy step which checksrunDataTagvalue and redirects to next steps or to the data source loop step. - API call - simply run the API - groovy step - this validates the data that the API call step returned. - data source loop step -source step :grid data source and target step :groovy step which checksrunDataTagvalue The problem i am facing is with the last record in the grid data source. Lets say i have 25 records in the grid step (this means that there would be total of 26 rows in this step. "grid.getRowCount();" method returns 26 - I believe this is because ready api adds one row to the end by default). Now, if i have set the last record to "No", Ready API runs the last row and does not process it - comes back and processes the blank row (which was added by ready api itself) with last records values. Because of this, my groovy step which validates data fails. To avoid running the last step i wrote a simple groovy, which when encounters the last row, simply exits the test case. def dataTags = context.expand( '${DataTags#dataTags}' ) String runDataTag = context.expand( '${DataTags#runDataTag}' ).toString() def grid = testRunner.testCase.testSteps["DataTags"].dataSource.gridModel int rows = grid.getRowCount(); log.info "Total rows in grid: "+rows int currentRowIndex = testRunner.testCase.testSteps['DataTags'].currentRow.toInteger() log.info "currentRowIndex: "+currentRowIndex if (currentRowIndex == rows-1 ) { testRunner.cancel( "Data Tag cannot be blank." ) return null } else if (runDataTag.toLowerCase().equals("no")) { log.info "Data tag \""+dataTags+"\" is not set to be resolved. \n runDataTag value: "+ runDataTag testRunner.runTestStepByName("DataSource Loop") } else { log.info ("Running data tag: "+ dataTags) } The problem now i am facing is, it'll not run the last record at all. How do i resolve this prob ?6 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.5KViews0likes2CommentsRe: How to set test case to OK by a script?
HiRao, So this is my use case : Keep checking the status of a test step until it returns true (until the case passes). Each time it'll wait for 5 seconds before checking again. If the case passes, move to another steps The problem i am facing is,if the case fails even once, this test case is marked as FAILED. So, when i run this test case from Jenkins, it shows as failed even when all the test steps have passed. So this line that you have provided "testRunner.status == Status.PASSED" does not work. Looking at the documentation here, i do not see PASSED as a status. Do you have any other solution to marking the status as Passed ?6 years agoPlace ReadyAPI QuestionsReadyAPI Questions5.3KViews0likes0CommentsLooping through test step multiple times until a condition is met
I have a use case where the API returns 202 the first time it is hit. After that, the end point should return 200 and should return some data. It may happen that if the data is not ready in the subsequent hits the API could return 202. What i want to do write a groovy to check if the status is 202, hit the API again, this condition is for 3 times. Even after 3 hits, the status is 202, fail the case. Else if status is 200, do a set of operation. This is the code that i have written. String stat = testRunner.testCase.testSteps["<test step name>"].testRequest.response.responseHeaders["#status#"] testRunner.runTestStepByName("<test step name>") //run "<test step name>" step again as when run once, this step generates 202 and on subsequent hits, returns actual data. if( context.loopIndex == null ) context.loopIndex = 0 if( ++context.loopIndex < 3 && status == "202 Accepted") { testRunner.gotoStepByName( "<test step name>" ) log.info "Something...." } else if (status == "200 OK") { //do something here } else { //fail the case } The problem i am facing is, after the first pass, the condition is not checked, code written after testRunner.gotoStepByName is executed and it exists after that.1.2KViews0likes0CommentsRe: Failing a Groovy Script Test Step
testRunner.fail() fails the whole test case. I have a test case where - I run a http call, - validate data returned by the call and then, - iterate to the http call This keeps on happening until a condition is satisfied. The problem is, when i usetestRunner.fail()it fails the whole test case and the iteration stops. I want to fail the current iteration and then move on to next iteration. Is there a way.7 years agoPlace ReadyAPI QuestionsReadyAPI Questions8.8KViews0likes5CommentsExplicitly fail a test step via Groovy script
I would like to explicitly fail a test step based on a condition written in Groovy script. If the response from API matches the condition (mentioned in Groovy script), do nothing. If response from API does not match the condition, fail the API test step.7 years agoPlace ReadyAPI QuestionsReadyAPI Questions4.8KViews0likes2CommentsRe: Possible to override test step pass/fail via subsequent groovy script?
did you get a solution to this ? I am facing a similar problem where i need to explicitly fail a test step based on a condition (which i have in my trailing groovy script).7 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.7KViews0likes1Commentdata connection reset automatically
Hi, I have multiple environments setup, and for each environment i have different Database connections set up. The problem is, sometimes, when i change the environment, the "Connection" is automatically set to "None" and because of this all my test cases start to fail. This definitely happens when i close Ready API and launch it again. The only solution that i found was to manually go to each Data Source test step for each test case and select the Connection. Is there a solution to this ??8 years agoPlace ReadyAPI QuestionsReadyAPI Questions1.2KViews0likes2Comments