# Types of Variables

**URL:** <https://forum.katalon.com/t/types-of-variables/25466>\
**Category:** Miscellaneous\
**Tags:** new-doc-request\
**Created:** [May 16, 2019, 10:28am UTC](https://forum.katalon.com/t/types-of-variables/25466 "2019-05-16T10:28:41Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/katalon/original/3X/d/5/d55596ab02785a255798e87ede769734747b30c4.svg) [@system](https://forum.katalon.com/u/system)\
**Post date:** [May 16, 2019, 10:28am UTC](https://forum.katalon.com/t/types-of-variables/25466/1 "2019-05-16T10:28:41Z")

</div>

* * *
This is a companion discussion topic for the original entry at [https://docs.katalon.com/katalon-studio/docs/global-variables.html](https://docs.katalon.com/katalon-studio/docs/global-variables.html)

---

<div class="post-metadata">

**Author:** ![vadim.gadayev](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/vadim.gadayev/32/30227_2.png) [@vadim.gadayev](https://forum.katalon.com/u/vadim.gadayev)\
**Post date:** [May 28, 2019, 4:21pm UTC](https://forum.katalon.com/t/types-of-variables/25466/2 "2019-05-28T16:21:27Z")

</div>

Did Katalon removed global variables view? I can not find the Global Variable view icon on the right.  
How would I add and review my global variables now?

---

<div class="post-metadata">

**Author:** ![Jeff\_Sharp](https://avatars.discourse-cdn.com/v4/letter/j/a5b964/32.png) [@Jeff\_Sharp](https://forum.katalon.com/u/Jeff_Sharp)\
**Post date:** [May 29, 2019, 4:39pm UTC](https://forum.katalon.com/t/types-of-variables/25466/3 "2019-05-29T16:39:33Z")

</div>

I’m having trouble finding it also. It’s not there.

---

<div class="post-metadata">

**Author:** ![Jeff\_Sharp](https://avatars.discourse-cdn.com/v4/letter/j/a5b964/32.png) [@Jeff\_Sharp](https://forum.katalon.com/u/Jeff_Sharp)\
**Post date:** [May 29, 2019, 6:58pm UTC](https://forum.katalon.com/t/types-of-variables/25466/4 "2019-05-29T18:58:36Z")

</div>

I just found out that it is located under Profiles \> Default in the Test Explorer pane on the right. You can create global variables there, even though it doesn’t state that. it’s very confusing now.

---

<div class="post-metadata">

**Author:** ![oswazteca](https://avatars.discourse-cdn.com/v4/letter/o/c37758/32.png) [@oswazteca](https://forum.katalon.com/u/oswazteca)\
**Post date:** [June 5, 2019, 6:55pm UTC](https://forum.katalon.com/t/types-of-variables/25466/5 "2019-06-05T18:55:01Z")

</div>

Yeah, looks like the documentation is out of date.

---

<div class="post-metadata">

**Author:** ![glennkatalon](https://avatars.discourse-cdn.com/v4/letter/g/c67d28/32.png) [@glennkatalon](https://forum.katalon.com/u/glennkatalon)\
**Post date:** [June 6, 2019, 2:08pm UTC](https://forum.katalon.com/t/types-of-variables/25466/6 "2019-06-06T14:08:22Z")

</div>

[https://docs.katalon.com/katalon-studio/docs/execution-profile-v54.html](https://docs.katalon.com/katalon-studio/docs/execution-profile-v54.html)

> The current [Global Variables](https://docs.katalon.com/display/KD/Variable+Types#VariableTypes-Globalvariables) list now become the **Default Profile**. There will be **NO** ‘Global Variables’ interface. You will need to create _Global Variables_ in the new **Execution Profile**.

---

<div class="post-metadata">

**Author:** ![b4526327](https://avatars.discourse-cdn.com/v4/letter/b/2bfe46/32.png) [@b4526327](https://forum.katalon.com/u/b4526327)\
**Post date:** [July 19, 2019, 10:59am UTC](https://forum.katalon.com/t/types-of-variables/25466/7 "2019-07-19T10:59:37Z")

</div>

Experts please help me. How can I set a global variable during the test case set.  
I prefer the verification way.

---

<div class="post-metadata">

**Author:** ![vadim.gadayev](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/vadim.gadayev/32/30227_2.png) [@vadim.gadayev](https://forum.katalon.com/u/vadim.gadayev)\
**Post date:** [July 19, 2019, 3:18pm UTC](https://forum.katalon.com/t/types-of-variables/25466/8 "2019-07-19T15:18:07Z")

</div>

Thank you.

---

<div class="post-metadata">

**Author:** ![sarah.kladstrup](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/sarah.kladstrup/32/9513_2.png) [@sarah.kladstrup](https://forum.katalon.com/u/sarah.kladstrup)\
**Post date:** [August 9, 2019, 7:48pm UTC](https://forum.katalon.com/t/types-of-variables/25466/9 "2019-08-09T19:48:23Z")

</div>

> GlobalVariable.nameOfGlobalVariableGoesHere

---

<div class="post-metadata">

**Author:** ![Mehran\_Shafqat](https://avatars.discourse-cdn.com/v4/letter/m/7ea924/32.png) [@Mehran\_Shafqat](https://forum.katalon.com/u/Mehran_Shafqat)\
**Post date:** [August 16, 2019, 11:19am UTC](https://forum.katalon.com/t/types-of-variables/25466/10 "2019-08-16T11:19:22Z")

</div>

parameterize Global Variables in http body directly not working it not picking the actual global variable value.

---

<div class="post-metadata">

**Author:** ![tanderson](https://avatars.discourse-cdn.com/v4/letter/t/d26b3c/32.png) [@tanderson](https://forum.katalon.com/u/tanderson)\
**Post date:** [August 30, 2019, 3:38am UTC](https://forum.katalon.com/t/types-of-variables/25466/11 "2019-08-30T03:38:27Z")

</div>

Turns out they change Katalon GlobalVariables without fixing the documentation.

---

<div class="post-metadata">

**Author:** ![jason.tolotta](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jason.tolotta/32/7687_2.png) [@jason.tolotta](https://forum.katalon.com/u/jason.tolotta)\
**Post date:** [September 2, 2019, 3:27am UTC](https://forum.katalon.com/t/types-of-variables/25466/12 "2019-09-02T03:27:38Z")

</div>

Can you set a Global Variable from a script?

**Edit:** Found out that you can but it only persists it during the test case/test suite execution session.

```auto
GlobalVariable.foo = "bar"

```

---

<div class="post-metadata">

**Author:** ![christian.lauber](https://avatars.discourse-cdn.com/v4/letter/c/f08c70/32.png) [@christian.lauber](https://forum.katalon.com/u/christian.lauber)\
**Post date:** [September 26, 2019, 9:50am UTC](https://forum.katalon.com/t/types-of-variables/25466/13 "2019-09-26T09:50:42Z")

</div>

Today I did the same experience. Did you find any solution to set persistent variables? Does somebody has any idea?

---

<div class="post-metadata">

**Author:** ![Marek\_Melocik](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/marek_melocik/32/371_2.png) [@Marek\_Melocik](https://forum.katalon.com/u/Marek_Melocik)\
**Post date:** [September 26, 2019, 11:53am UTC](https://forum.katalon.com/t/types-of-variables/25466/14 "2019-09-26T11:53:28Z")

</div>

> [@How to update GlobalVariable permanently](http://forum.katalon.com/t/how-to-update-globalvariable-permanently/33799):
>
> Hello, there were few requests to add an ability to change GlobalVariable permanently. I wrote a custom keyword which can do it. Works with Katalon Studio 6.3.0 Disclaimer: I am not responsible for any damages caused by this code. This method modifies profile file in your project folder and changes are permanent. Make sure you have proper backup of all your files in any case. Code: 
> 
> > **Click me**
> >
> > import java.nio.file.Files import java.nio.file.Paths import javax.xml.parsers.DocumentBuilder impor…

---

<div class="post-metadata">

**Author:** ![jayknowstheway](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@jayknowstheway](https://forum.katalon.com/u/jayknowstheway)\
**Post date:** [October 25, 2019, 1:26am UTC](https://forum.katalon.com/t/types-of-variables/25466/15 "2019-10-25T01:26:39Z")

</div>

Hello, does anyone know the syntax for using variables defined in the variables tab in execute Javascript? I’ve tried many variations but nothing I’ve tried works…

WebUI.executeJavaScript('document.getElementsByName(‘j\_domain’)[0].value = ‘+${GlobalVariable.vVar}+’😉  
WebUI.executeJavaScript('document.getElementsByName(‘j\_domain’)[0].value = ‘+${vVar}+’;  
WebUI.executeJavaScript('document.getElementsByName(‘j\_domain’)[0].value = ‘+vVar+’;  
WebUI.executeJavaScript('document.getElementsByName(‘j\_domain’)[0].value = ‘+GlobalVariable.vVar+’;

THANKS!

---

<div class="post-metadata">

**Author:** ![devalex88](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/devalex88/32/336_2.png) [@devalex88](https://forum.katalon.com/u/devalex88)\
**Post date:** [October 25, 2019, 3:36am UTC](https://forum.katalon.com/t/types-of-variables/25466/16 "2019-10-25T03:36:34Z")

</div>

Please refer to this tutorial.

> **[Concatenate Strings with Groovy | Baeldung](https://www.baeldung.com/groovy-concatenate-strings)**
>
> Learn how to concatenate Strings using Groovy.

---

<div class="post-metadata">

**Author:** ![jtheoret](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jtheoret/32/4458_2.png) [@jtheoret](https://forum.katalon.com/u/jtheoret)\
**Post date:** [November 28, 2019, 7:40pm UTC](https://forum.katalon.com/t/types-of-variables/25466/17 "2019-11-28T19:40:41Z")

</div>

I have a global variable that I set in one of my test suite and I want to use it in my next test suite in my test suit collection.

When I run my test suite collection in the second test suite of the collection the global variable is empty? how can I fix that, a global variable should be global through out my run…??? the collection I ran is in sequential, one suite is in Chrome and the other is in Android… I can’t put all the test cases in the same test suite.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [November 28, 2019, 9:56pm UTC](https://forum.katalon.com/t/types-of-variables/25466/18 "2019-11-28T21:56:35Z")

</div>

@jtheoret

A GlobalVariable.X is scoped for a single test suite run. Test cases in a Test Suite can share the value of GlobalVariable.X. But Test Suite A and Test Suite B can not share the dynamically updated value of GlobalVariable.X. GlobalVariable is designed as such. You can not change this behavior.

If you want to pass information across multiple test suites, you should create a file and write/read info for yourself.

Test Case a1 in the Test Suite A creates a file and save the value into it; Test Case b1 in the Test Suite B reads the file and consume info in it. You can employ any format for the file. If I were you, I would employ JSON format as Groovy language supports JSON natively. Please have a look at my previous post for a sample code:

> [@\[Katalon Profile\] Dynamic Profile update upon execution](http://forum.katalon.com/t/katalon-profile-dynamic-profile-update-upon-execution/11931/12):
>
> Victor, I think that Execution Profile in Katalon Studio is designed read-only for test cases. It is not designed to be updated by test cases runtime. You can create a json text file in the project directory. I think that a json file would be much easier storage for your dynamic information than modifying Execution Profiles. You can save a json file anywhere in the projectDir; for example /tmp, or /Data Files/. I myself would write it into /Materials folder using my [Materials](https://github.com/kazurayam/UsingMaterialsInKatalonStudio) library. Writing…

Or you can use a Excel file. See the following previous post of mine:

> [@Multiple Test Cases in a Test Suite can share a Excel file to read/write data dynamically](http://forum.katalon.com/t/multiple-test-cases-in-a-test-suite-can-share-a-excel-file-to-read-write-data-dynamically/12988):
>
> I have made a demo project on GitHub: [GitHub - kazurayam/MultipleTestCasesSafelyWriteIntoExcelFile: [Katalon Studio] Writing Data in Excel](https://github.com/kazurayam/MultipleTestCasesSafelyWriteIntoExcelFile) ----------- Problems to solve I wanted to find out a solution to the following points: I want my Katalon Studio project to generate a single Excel file where my Test Cases store anonymous data. I want to name the Excel file in such format. If I start a Test Suite named TS\_a then it creates a file named TS\_afollowed by the timestamp when it was started. …

This post is titled “multiple test cases in a test suite can share a excel file”. But more precisely in fact “multiple test cases in multiple Test Suites can share a excel file”.

Or simply you can use the Excel keyword plugin:

> **[Excel Keywords](https://store.katalon.com/product/34/Excel-Keywords)**
>
> Katalon Store is a collaborative marketplace that allows users to develop and share plugins, integrations, and keywords that enhance Katalon Studio capabilities.

---

<div class="post-metadata">

**Author:** ![kazurayam](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/kazurayam/32/333_2.png) [@kazurayam](https://forum.katalon.com/u/kazurayam)\
**Post date:** [November 29, 2019, 1:03am UTC](https://forum.katalon.com/t/types-of-variables/25466/19 "2019-11-29T01:03:16Z")

</div>

@jtheoret

Test Suite A and Test Suite B are supposed to be independent each other. This is how Test Suite concept is designed

> [@jtheoret](#):
>
> When I run my test suite collection in the second test suite of the collection the global variable is empty? how can I fix that, a global variable should be global through out my run…???

This implies, your Test Suite B depends on the the previous Test Suite A. Then I think you should not group your test cases as test suites. I would rather recommend you to use “Controller TestCase pattern” implemented using `WebUI.callTestCases()` keyword. See the following post:

[Test Suite - Script Mode - set up method - how to pass common data value - #5 by kazurayam](http://forum.katalon.com/t/test-suite-script-mode-set-up-method-how-to-pass-common-data-value/28144/5)
