# Refreshing the application data before each test case without restarting

**URL:** <https://forum.katalon.com/t/refreshing-the-application-data-before-each-test-case-without-restarting/125801>\
**Category:** Mobile Testing\
**Tags:** katalon-recorder, mobile-testing, katalon-studio\
**Created:** [March 26, 2024, 3:06am UTC](https://forum.katalon.com/t/refreshing-the-application-data-before-each-test-case-without-restarting/125801 "2024-03-26T03:06:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hajar20abouyahia](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/hajar20abouyahia/32/23870_2.png) [@hajar20abouyahia](https://forum.katalon.com/u/hajar20abouyahia)\
**Post date:** [March 26, 2024, 3:06am UTC](https://forum.katalon.com/t/refreshing-the-application-data-before-each-test-case-without-restarting/125801/1 "2024-03-26T03:06:20Z")

</div>

i’ am working on automation of an android mobile application .In my test suite that start the application once and perform all the tests. I want to clear the application cache before running some tests without restarting the application. Is there any command/function, that can achieve the purpose? Thanks.

---

<div class="post-metadata">

**Author:** ![Elly\_Tran](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/elly_tran/32/21874_2.png) [@Elly\_Tran](https://forum.katalon.com/u/Elly_Tran)\
**Post date:** [March 26, 2024, 3:08am UTC](https://forum.katalon.com/t/refreshing-the-application-data-before-each-test-case-without-restarting/125801/2 "2024-03-26T03:08:02Z")

</div>

Hi,

Welcome to our community. I have not seen any cleaning cache mid-testing yet. How about others?

---

<div class="post-metadata">

**Author:** ![hajar20abouyahia](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/hajar20abouyahia/32/23870_2.png) [@hajar20abouyahia](https://forum.katalon.com/u/hajar20abouyahia)\
**Post date:** [March 27, 2024, 7:14am UTC](https://forum.katalon.com/t/refreshing-the-application-data-before-each-test-case-without-restarting/125801/3 "2024-03-27T07:14:04Z")

</div>

what about just clearing the text field !! i just want to refresh the application before executing the next test case do you get me ?! and thank for your time i really appreciate it

---

<div class="post-metadata">

**Author:** ![grylion54](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/grylion54/32/16265_2.png) [@grylion54](https://forum.katalon.com/u/grylion54)\
**Post date:** [March 27, 2024, 8:19pm UTC](https://forum.katalon.com/t/refreshing-the-application-data-before-each-test-case-without-restarting/125801/4 "2024-03-27T20:19:40Z")

</div>

> [@hajar20abouyahia](#):
>
> I want to clear the application cache

Maybe the following link might assist you:

> [@Clear cache and history](http://forum.katalon.com/t/clear-cache-and-history/45593/2):
>

If you just want to clear the text field, then maybe the below. Go for it.

> **[\[Mobile\] Clear Text | Katalon Docs](https://docs.katalon.com/katalon-studio/keywords/keyword-description-in-katalon-studio/mobile-keywords/mobile-clear-text)**
>
> Description

---

<div class="post-metadata">

**Author:** ![depapp](https://dub1.discourse-cdn.com/katalon/user_avatar/forum.katalon.com/depapp/32/29178_2.png) [@depapp](https://forum.katalon.com/u/depapp)\
**Post date:** [October 9, 2026, 9:33am UTC](https://forum.katalon.com/t/refreshing-the-application-data-before-each-test-case-without-restarting/125801/5 "2026-10-09T09:33:45Z")

</div>

hi @hajar20abouyahia

the uiautomator2 driver has a command for exactly this, it clears the app data like a fresh install without touching the session:

```groovy
import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory

def driver = MobileDriverFactory.getDriver()
driver.executeScript('mobile: clearApp', [appId: 'com.yourcompany.app'])
driver.executeScript('mobile: activateApp', [appId: 'com.yourcompany.app'])

```

clearApp is the same as `adb shell pm clear`, so the app is force stopped and its storage wiped. activateApp brings it back to the foreground in a second, much faster than Mobile.startApplication which reinstalls. put the two lines in a @BeforeTestCase listener for the suite where you need a clean state.

if you only want the fields reset and not the data, Mobile.clearText per field is the way, there is no “reset the form” command, the app would have to offer that itself.
