Upgrade Profiles

Hi, can we get an upgrade for profiles? The web application the company I work at requires me to use hundreds of Global Variables and some of them requires to be changed while others stay the same. Before you tell me to use local variables, trust me, I’ve tried that approach and it just doesn’t work as well.

1. Add folders to profiles.
Reason: If I create 20 global variables for different pages and there’s 30 different pages then that’s 600 global variables at least, it’s hard to look at the amount of variables and where it’s at.

2. Add Move Up and Move Down to the Global Variables list
Reason: Sometimes I require to add a variable after some changes and it’ll be at the end of the page. I could go to the file directly and edit it but why when Katalon has that ability for Test Suites, add it to profiles as well and that would make it so much easier.

3. If I click on a Global Variable on the profile list and then click add, have the newly added Global Variable appear below the one I selected instead of the very end
Reason: Just makes it easier to know, similar to ass if you were to insert a new row in excel

4. Drag and drop Global Variables around the list
Reason: Just makes working with Variables so much easier

**5. Allow me to call another Profile’s Global Variables through scripting
**Reason: Maybe this is already possible, I don’t know. If not, it would make it easier to work with since I have 5 different environments to work with and I use different profiles for them but a lot of the other variables are the same and it gets pretty daunting to work with having to replicate it 5 times whenever I add a new variable in.

1 Like

I’d like to know why you think you need so many global variables. What are you storing in them? Would you be able to post a screenshot of some of your pages?

Reason for asking: I test a very complex, large app. There are 105 pages (last count) each containing forms with hundreds of fields in multiple grids. I have approx twenty globals per profile (and some of those I could probably get rid of).

There might be something coming soon (?): http://forum.katalon.com/discussion/9381/global-variables-profiles-editor.

And, Russ: nice to have you back! :slight_smile:

Russ Thomas said:

I’d like to know why you think you need so many global variables. What are you storing in them? Would you be able to post a screenshot of some of your pages?

Reason for asking: I test a very complex, large app. There are 105 pages (last count) each containing forms with hundreds of fields in multiple grids. I have approx twenty globals per profile (and some of those I could probably get rid of).

Unfortunately, I’m unable to post screenshots as this is the company’s internal in-house product. These pages aren’t like other products that I’ve worked on where it’s just very basic and static with some dynamics, it’s pretty much all dynamic with hundreds of different branches that interconnect. Each option basically branches out to 2 to even 100 different directions, so I try to break everything down to different sections versus pages as each page could have a hundred different scenarios. If it was myself using it, local variables would work but I have others using what I’ve built on katalon as well so searching through each page for my variable to change when they’re using it is just not practical.

I appreciate you have a complex scenario you’re trying to manage. But keep in mind, there are some pretty smart people here and there’s always more than one way to analyze and produce good results. If you could share the kind of thing you’re storing in your globals, I’m sure someone will chime in with suggestions.

Your call.

Oh I don’t doubt that there are some very smart people here along with those that I work with. I just think it would be amazing having folders for global variables so I can separate them between pages and being able to call a global variable from another profile.

But if anybody can come up with a suggestion or solution to how I should store my variables, I would greatly appreciate it. Lets take for example I have a page called Apples and another called Bananas. Right now I’m naming my Global Variables as:

Apples_Object1
Apples_Object2
Banana_Object1
Banana_Object2

This goes on and on for many different different items. Now I also have Login information that changes from environment to environment, lets call the page Cats.

Cats_Object1
Cats_Object2

Because of how the application is set up, I separate each page into different Test Cases. So Apples page may have 10 different test cases that branches.

                                                            Apples_TestCase4  
                                                           /  

Apples_TestCase1 - Apples_TestCase2 - Apples_TestCase5
\ \
\ Apples_TestCase6
Apples_TestCase3

Apples_Object1 may appear in Apples_TestCase4 and Apples_TestCase5 but may not appear in Apples_TestCase6. While Apples_Object2 may appear in Apples_TestCase4 and Apples_TestCase6 but may not appear in Apples_TestCase5.

Apples_TestCase1 may contain just the header, then Apples_TestCase2 and Apples_TestCase3 contains the prerequisites you have to enter and 4, 5, 6 test cases are possible scenarios.

Same thing happens for Banana page.

Both Apples and Bananas objects changes as users sees fit.

Cats objects on the other hand changes depending on the environment but I only have to enter the information once.

Every time I create a new object for Apples and Banana, I have to copy the same object to other profiles though and this gets tedious and I may forget to do so at times and it gets hard to track as I can’t move them up or down so it’ll just look like this but a lot more.

Apples_Object1
Apples_Object2
Banana_Object1
Banana_Object2
Apples_Object3
Banana_Object3
Apples_Object4
Apples_Object5
Banana_Object4

I could manually edit the Global Variables file but gets a little too much when I have multiple profiles.

So, if I’m understanding you correctly, you’re using the globals as constants (most of the time). And in that case, yes, I agree, a hierarchical structure would benefit you greatly – but, only if you need them stored that way.

The hint here is whether you fully considered the option of declaring them in the code somewhere - I’m thinking static variables that are configured based on some kind of state which you can discover “early” during the individual test case’s life cycle(s) - in a listener, perhaps.

Fact is, if I laid out my code the way I’m picturing yours, I’d probably have hundreds of globals too. But mine are being reduced to almost zero, over time. And yes, I’m using statics “everywhere”. Most of them are stored in one Map (which I call “G”) which is populated, like I said, “early” in a Test Listener. I read the values from a JSON file on disk (this file could be maintained/produced elsewhere if you have a way to do that?) It contains all the globals I need/use.

Maybe you’ll see that as just moving the problem to a different location, maybe you’ll find it better. Your call.

The code below is used to read the globals in from disk and assigns them to the “G” map (declared static elsewhere):

  /**
   * Read in the current profile settings.
   */
  void getProfileSettings() {
    String profileName = RunConfiguration.getExecutionProfile()
    comment("readProfileSettings:" + profileName)
    String dir = getMyProjectPath()
    def f = new File(dir + profileName + ".json")
    G = new JsonSlurper().parseText(f.text)
  }

This is a very interesting conversation, Vincent. Thanks B)

2 Likes

This is a great and amazing solution Russ, thank you for taking the time to providing me with a possible solution. The only way I can see myself using this approach though is if I have a way to easily store the JSON file and an easy way to edit it that even non-technical users can open it up and edit it. If you or anybody has any ideas or an application that can do this, I would love to find out more about it.

Well, perhaps you don’t need a JSON file, per se. For example, you could store the data in any kind of file (CSV, spreadsheet, etc) and read it from there. My point in saying…

(this file could be maintained/produced elsewhere if you have a way to do that?)

was to suggest exactly that. If your data destined to be stored in variables can be produced externally (e.g. Excel) then by all means, do that. Then read it in to your test prior to the main test code executing. The point is, produce it in any way that benefits you (and your users).

My guess is, you’ll end up with a few globals that are truly constants across all suites/tests, and the rest will be manufactured by the system we’re discussing…

Make sense?

1 Like

@Russ Thomas I don’t know why I clicked Best Answer and then your entire post disappeared for me, perhaps a weird but on Katalon’s forum. But anyways, I have an issue with using an excel file if you could help me out with that.

I’m able to read from an excel file based by column using:

findTestData("New Test Data").getValue("url", 1)

but if I have several hundred variables, I wouldn’t be using columns but rows instead with the first column being the field name and the second column being the value itself.

Is there a way to use getValue by column 1 row name and then get the value from column 2? Hope that makes sense.

Edit: and I guess the at @ sign doesn’t really work that well either …

1 Like

weird bug* … apparently I can’t edit a second time either …

1 - I don’t do excel, never tried it.

2 - Best Answer is moved to the top of the thread (-1).

- you can usually edit a post by clicking the little gear/cog icon top right of the post (like most teenagers, the edit button has issues ;))

There’s a ton of posts here about excel integration, plus the docs. I’d be surprised if a solution to that issue hasn’t been mentioned somewhere.

IDEA: write up the spreadsheet the way you prefer, export it to CSV (or whatever) in the format you need to read it into Katalon. You could even automate the export using VBA, I guess.

@Vincent Luong

for (def i=0; i<=findTestData("New Test Data").getColumnNumbers(); i++){
        println findTestData("New Test Data").getValue("url", i)
}
If I understood correctly what you need, you can change which row are you selecting by changing the 'i'.

@Vincent_Luong
Just found this.

You can use findTestData("NewTestData").getColumnNames()