How to convert all global variables to an excel data file

How can I easily organise the project with minimal manual script changes ?
I want the data in the global variables to be in a file (excel) in data files and the code change automatically accordingly :smiley:
is that possible ?
I have almost 500 TC :confused:

I don’t think so. Life is not as easy as you want it to be.

I think you should, at this occation, refactor your existing 500TCs so that they are flexible enough to accept data from either of GlobalVaraibles or Excel files. I mean, you should be brave enough to rewrite your codes.

You need not to change the code of your existing 500 TCs because you can update the GlobalVariable’s value with any data from external files runtime. Let me assume you have a GlobalVariable named username in the default Execution Profile with initial value FOO. You can write a Test case:

println "BEFORE: GlobalVariable.username = ${GlobalVariable.username}`
GlobalVariable.username = 'BAR'
println "AFTER: GlobalVariable.username = ${GlobalVariable.username}`

You execute this script while applying the default Profile, you will see the following output in the Console.

BEFORE: GlobalVariable.username = FOO
AFTER: GlobalVariable.username = BAR

Let me assume that you manage to find a way to update the GlobalVariables with Excel file, your 500TCs can stay unchanged referring to the GlobalVariables. Of course, it requires certain tricks of programming.

How can you implement the idea of “referring to GlobalVariables with values updated runtime”? It depends on the way how your current project is structured.

You just mentioned you have 500TC, but did not described how these are organised. Do you execute every single TC by clicking the green Run button? Do you have a single Test Suite which binds all of 500TCs to execute sequentially? Do you have a “Controller” test case which calls other test cases? Also how many set of values of GlobalVariables do you have? 1, 2, 3, …10, 100? Do you want to repeat executing all of 500TCs for each set of values (e.g, 10 times)? Do you want to choose just a few of your TCs to apply the values from excel file? — well, so many factors to consider.