# Import/Export function for Test Case variables

**URL:** <https://forum.katalon.com/t/import-export-function-for-test-case-variables/13416>\
**Category:** Feature Request\
**Tags:** feature-request, katalon-studio\
**Created:** [September 26, 2018, 3:27pm UTC](https://forum.katalon.com/t/import-export-function-for-test-case-variables/13416 "2018-09-26T15:27:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marek\_Henzl](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@Marek\_Henzl](https://forum.katalon.com/u/Marek_Henzl)\
**Post date:** [September 26, 2018, 3:27pm UTC](https://forum.katalon.com/t/import-export-function-for-test-case-variables/13416/1 "2018-09-26T15:27:28Z")

</div>

Hi Team,

I would like to ask if feature for importing/exporting Variables within Test Case tab is planned, or if is it possible to suggest this. Having a lot of Test Cases and typing variables for each one requires to type it repeatedly. Eg. in concurrent tool SOAP UI there is a possibility to store variables to file and import.

Thank you in advance

Kind Regards,  
Marek Henzl

---

<div class="post-metadata">

**Author:** ![Thiago\_Jorge\_Almeida](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/thiago_jorge_almeida/32/1078_2.png) [@Thiago\_Jorge\_Almeida](https://forum.katalon.com/u/Thiago_Jorge_Almeida)\
**Post date:** [September 27, 2018, 7:34pm UTC](https://forum.katalon.com/t/import-export-function-for-test-case-variables/13416/2 "2018-09-27T19:34:58Z")

</div>

This is a transversal problem. It would be very usefull to improve the copy/paste functionality between two Variables tabs, between two Profiles, between two Data Files, between two Data Bindings, etc.

---

<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:** [September 28, 2018, 1:21am UTC](https://forum.katalon.com/t/import-export-function-for-test-case-variables/13416/3 "2018-09-28T01:21:30Z")

</div>

Marek,

I think that a GlobalVariable of type java.util.Map would be useful for you.

I have made a project “[KatalonDiscussion9854](https://github.com/kazurayam/KatalonDiscussion9854)” to demonstrate my proposal. You can download the zip file from [Releases](https://github.com/kazurayam/KatalonDiscussion9854/releases) page.

I would copy & paste the README here.  
---------------------------

# How to run the demo

1. start your Katalon Studio, open this project
2. please note that a Profile `default` defines a GlobalVariable named `MEMORY` of type `java.util.Map`.
3. select `Test Suites/TS0` and run it

# Processing

1. `GlobalVariable.MEMORY` is initialized with values: `['A':'a', 'B':'b', 'C':'c', 'D':'d', 'E':'e']`
2. Test Suite `TS0` execute a series of test cases: `TC1`, `TC2`, `TC3`.
3. Each test cases prints `MEMORY`, and update it.

# Code

The source of test cases is very simple. For example, `TC1` is as simple as this:

```auto
import internal.GlobalVariable as GlobalVariableMap memory = (Map)GlobalVariable.MEMORY
CustomKeywords.'my.MemoryManager.retrieve'(memory) # retrieve memory
memory.put('A', "TC1 said hello")                 

```

# Output

TC1 prints the MEMORY, as follows:

```auto
key=A,value=akey=B,value=b
key=C,value=c
key=D,value=d
key=E,value=e

```

TC2 prints the MEMORY, as follows:

```auto
key=A,value=TC1 said hellokey=B,value=b
key=C,value=c
key=D,value=d
key=E,value=e

```

TC3 prints the MEMORY, as follows:

```auto
key=A,value=TC1 said hellokey=B,value=TC2 said welcome
key=C,value=c
key=D,value=d
key=E,value=e

```

TC4 prints the MEMORY, as follows:

```auto
key=A,value=TC1 said hellokey=B,value=TC2 said welcome
key=C,value=TC3 said goodbye
key=D,value=d
key=E,value=e

```

Please note that the `GlobalVariable.MEMORY` is shared by test cases and updated mutually by them.

# Conclusion

Each test cases declares a single variable `Map memory` which contains multiple key=value pairs. This reduces need to type variable names repeatedly in each test cases.

---

<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:** [September 28, 2018, 1:47am UTC](https://forum.katalon.com/t/import-export-function-for-test-case-variables/13416/4 "2018-09-28T01:47:54Z")

</div>

Also you can make a test case variable of type java.util.Map.  
 ![](https://s3.amazonaws.com/katalon-forum/editor/d7/c2mqkp4je8tr.png "Image: https://s3.amazonaws.com/katalon-forum/editor/d7/c2mqkp4je8tr.png")  
This would be useful for reducing variable names in test cases as well.

[Map\_as\_testcase\_variable.PNG](https://s3.amazonaws.com/katalon-forum/editor/d7/c2mqkp4je8tr.png)

---

<div class="post-metadata">

**Author:** ![Patrik](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@Patrik](https://forum.katalon.com/u/Patrik)\
**Post date:** [October 4, 2018, 7:56am UTC](https://forum.katalon.com/t/import-export-function-for-test-case-variables/13416/5 "2018-10-04T07:56:33Z")

</div>

50 \* Upvoted for the initial feature request!

I started a new project where I will splitt the workflow in independent parts of “dummy test cases”, as I currently like the CallTestCase feature approach.

Those dummy TC are called depending on the test path by the real test cases.

Currently it is a pain as I have created 5 workflow parts (dummy TC) and 3 test cases. All needs to set the variables tab with 15 entires of type Map.

I will cry if I have to add the other 10 dummy test cases and 20 test cases.

1 \* upvoted for kazurayam code example.

The work around by kazurayam seems to be good, but I belive that Katalon sould support this by a build-in feature.

If everybody needs to write his own code to get around a lack of a missing feature, it will end in a tool which looks and works different for everyone.

As less as possible CustomKeywords are required to have a better common tool.

---

<div class="post-metadata">

**Author:** ![YoungNgo](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/youngngo/32/15132_2.png) [@YoungNgo](https://forum.katalon.com/u/YoungNgo)\
**Post date:** [November 7, 2018, 10:52pm UTC](https://forum.katalon.com/t/import-export-function-for-test-case-variables/13416/6 "2018-11-07T22:52:33Z")

</div>

This feature request has been acknowledged and handled with the following solution: [https://github.com/katalon-studio/katalon-studio/issues/12](https://github.com/katalon-studio/katalon-studio/issues/12).  
Please follow up its implementation status there.

---

<div class="post-metadata">

**Author:** ![Jass](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/jass/32/9588_2.png) [@Jass](https://forum.katalon.com/u/Jass)\
**Post date:** [March 13, 2020, 8:26am UTC](https://forum.katalon.com/t/import-export-function-for-test-case-variables/13416/7 "2020-03-13T08:26:23Z")

</div>


