Forum Discussion

emabindum's avatar
emabindum
Occasional Contributor
3 years ago

Groovy script to run the excel data source test step from groovy script

I need the Groovy script to run the below mention test case

The test case which i have looks like

1 step : DataSource(Excel)

2 step: groovyScript

3 Step: restrequest

4 Step: datesink

5 Step: Datsourceloop

 

when we run the script manually the execution will happen based on the row count of excel which we mentioned the path in the datasource step (in the execution loop the 2,3,4 steps get executed repeatedly based on the  excel row count ).

Same way i am looking for the groovy script which do the same execution for framework development.

  • KarelHusa's avatar
    KarelHusa
    Champion Level 1

    emabindum,

    It's not clear to me what's your goal.

     

    Are you asking how to use the loop iteration data in Groovy script (using DataSource)?

    Or, how to implement the data-driven looping in Groovy script (without DataSource)?

     

    • emabindum's avatar
      emabindum
      Occasional Contributor

      Hi KarelHusa ,

       I want script to use the loop iteration data in Groovy script (using DataSource).

       

      (what i am trying to do is, i am creating groovy class as a frame work and going to use that class method in each test case setup script, so that the entire execution will happen from that groovy only. The structure of each case is exactly same like which i mentioned in the first post. Here my question is how to achieve that through groovy script. I am getting test case name then getting all the steps, till this point its working fine after that how to run the datasource step(is there any specific syntax) and how to to make the data source loop call multiple test steps based on the datasource row count)

  • emabindum's avatar
    emabindum
    Occasional Contributor

    Hi KarelHusa 

    Now i am able to get all the failed assertion messages. But how can i know which iteration got failed and that respective failed assertion messages, which iteration got passed in teardown script itself.(I am using 2nd approach from your suggestions).