Script code vanished when a test case is renamed

Katalon Studio v8.3.0.beta
macOS Monterey 12.2.1

I created a GitHub project where you can see the bug reproduced.

  • step1 I created a script Test Case/sub/TC1, this had no problem
  • step2 I moved the script to Test Cases/sub/subsub/TC1, this had no problem
  • step3 I renamed the script to Test Cases/sub/subsub/Main
  • step4 I renamed the script to Test Cases/sub/subsub/Test, Test Cases/sub/subsub/TestTest, Test Cases/sub/subsub/testesttest ---- and found that the script code has vanished.

The GitHub repository has 4 tags, so you can trace what I did.

I looked at the 2 folders <projectDir>Test Cases and <projectDir>/Script and found that 2 folders has become inconsistent.

I looked at the Katalon’s .log file, where I found a StackTrace:

!ENTRY org.eclipse.e4.ui.workbench 4 0 2022-03-02 20:55:53.947
!MESSAGE 
!STACK 1
org.eclipse.core.internal.resources.ResourceException(/%Users%kazuakiurayama%katalon-workspace%CodeVanishedWhenTestCaseRenamed%CodeVanishedWhenTestCaseRenamed.prj/Scripts/sub/subsub/TestTest/Script1646222137979.groovy)[368]: java.lang.Exception: File not found: /Users/kazuakiurayama/katalon-workspace/CodeVanishedWhenTestCaseRenamed/Scripts/sub/subsub/TestTest/Script1646222137979.groovy.
	at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:42)
	at org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:38)
	at org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:835)
	at org.eclipse.core.internal.resources.File.getContents(File.java:275)
	at org.eclipse.core.internal.resources.File.getContents(File.java:266)
	at com.kms.katalon.groovy.reference.TestArtifactScriptRefactor.getScriptContent(TestArtifactScriptRefactor.java:208)
	at com.kms.katalon.groovy.reference.TestArtifactScriptRefactor.replace(TestArtifactScriptRefactor.java:159)
	at com.kms.katalon.groovy.reference.TestArtifactScriptRefactor.updateReferences(TestArtifactScriptRefactor.java:281)
	at com.kms.katalon.groovy.reference.TestArtifactScriptRefactor.updateReferenceForTestCaseFolder(TestArtifactScriptRefactor.java:261)
	at com.kms.katalon.groovy.reference.TestArtifactScriptRefactor.updateReferenceForProject(TestArtifactScriptRefactor.java:247)
	at com.kms.katalon.dal.fileservice.manager.TestCaseFileServiceManager.updateTestCase(TestCaseFileServiceManager.java:131)
	at com.kms.katalon.dal.fileservice.dataprovider.TestCaseFileServiceDataProvider.updateTestCase(TestCaseFileServiceDataProvider.java:27)
	at com.kms.katalon.controller.TestCaseController.updateTestCase(TestCaseController.java:126)
	at com.kms.katalon.composer.testcase.handlers.RenameTestCaseHandler$2.run(RenameTestCaseHandler.java:83)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)
!SUBENTRY 1 org.eclipse.core.resources 4 368 2022-03-02 20:55:53.947
!MESSAGE File not found: /Users/kazuakiurayama/katalon-workspace/CodeVanishedWhenTestCaseRenamed/Scripts/sub/subsub/TestTest/Script1646222137979.groovy.
!STACK 0
java.lang.Exception: File not found: /Users/kazuakiurayama/katalon-workspace/CodeVanishedWhenTestCaseRenamed/Scripts/sub/subsub/TestTest/Script1646222137979.groovy.
	at org.eclipse.core.internal.resources.ResourceException.provideStackTrace(ResourceException.java:42)
	at org.eclipse.core.internal.resources.ResourceException.<init>(ResourceException.java:38)
	at org.eclipse.core.internal.localstore.FileSystemResourceManager.read(FileSystemResourceManager.java:835)
	at org.eclipse.core.internal.resources.File.getContents(File.java:275)
	at org.eclipse.core.internal.resources.File.getContents(File.java:266)
	at com.kms.katalon.groovy.reference.TestArtifactScriptRefactor.getScriptContent(TestArtifactScriptRefactor.java:208)
	at com.kms.katalon.groovy.reference.TestArtifactScriptRefactor.replace(TestArtifactScriptRefactor.java:159)
	at com.kms.katalon.groovy.reference.TestArtifactScriptRefactor.updateReferences(TestArtifactScriptRefactor.java:281)
	at com.kms.katalon.groovy.reference.TestArtifactScriptRefactor.updateReferenceForTestCaseFolder(TestArtifactScriptRefactor.java:261)
	at com.kms.katalon.groovy.reference.TestArtifactScriptRefactor.updateReferenceForProject(TestArtifactScriptRefactor.java:247)
	at com.kms.katalon.dal.fileservice.manager.TestCaseFileServiceManager.updateTestCase(TestCaseFileServiceManager.java:131)
	at com.kms.katalon.dal.fileservice.dataprovider.TestCaseFileServiceDataProvider.updateTestCase(TestCaseFileServiceDataProvider.java:27)
	at com.kms.katalon.controller.TestCaseController.updateTestCase(TestCaseController.java:126)
	at com.kms.katalon.composer.testcase.handlers.RenameTestCaseHandler$2.run(RenameTestCaseHandler.java:83)
	at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

Conclusion

This bug has a fatal impact. This looks too silly.

I suppose that the v8.3.0 must not be released before this issue is fixed.

Otherwise I am afraid you would lose many customers.

@Jass
@duyluong


Appendix 25 May 2022

I looked the above sample project directory at the state of step4.

A Katalon Project has <projectDir>/Test Cases folder and <projectDir>/Scripts folder. Theoretically these 2 folders should be always in sync. However at the step4, the Scripts folder is corructed. See the following screenshot.

There is Scripts/sub/TestTest folder; but there is not Test Cases/sub/TestTest.tc file. This must be a falt.

~/katalon-workspace/CodeVanishedWhenTestCaseRenamed $ tree Scripts
Scripts
`-- sub
    |-- TestTest
    |   `-- Script1646222137979.groovy
    `-- testesttest
        `-- Script1653476524706.groovy

I looked at the files under the Scripts folder. See the following screenshot.

  • Scripts/sub/testesttest/Script1653476524706.groovy file is effectively empty.
  • The Scripts/sub/TestTest/Script1646222137979.groovy file contains the code I wrote.

I expected the Script/sub/testesttest/Script*.groovy to keep the code I wrote, and I expected there remains not TestTest/Script*.groovy. ---- These did not happened.

I see this is a bug of Katalon Studio.

1 Like

I noticed that V8.2.5 has the same problem.

@kazurayam: For a serial of actions with rename and moving, before moving/rename it, please help to close the test test case, refresh the project. System works fine after that.

Could you please help to try again and let us know the result after refresh project

image

Note: Like other system, we users have a serial actions to the source data, refresh is required for next actions, example : Solr search engine.

Hope this information is useful.

No I won’t.

I would refuse your advice.

Hi @kazurayam

Thanks for reporting this bug. It is a regression bug reported by some other users as well. We’ll consider fixing it.

Happy Testing
Jass

I have never seen such fragility in IntelliJ IDEA.

I would never compare a GUI software like KS with a text search engine like Lucene.

Thanks @Jass,

Hope to see the issue fixed soon

FYI.

This bug still persists in the v8.3.0.

Carelessly enough, I renamed a test case script. And once renamed, my code in the test case script went away!

I regret that I forgot adding and committing the test case script into the local Git repository before renaming it.

I checked the latest v8.3.5. The bug still persists.

I would warn all Katalon Studio users.

DO NOT RENAME TEST CASES.

You may lose your codes.

If necessary, take a backup of your project before renaming your test cases.

Hi @kazurayam,

The ticket corresponding to this issue is in our backlog and we’ll try to fix them in the soonest release.
Sorry for the inconvenience.

Nam Nguyen.

Hello Team,

Any solution ? There should be a hot fix for this problem and it should not be in backlog.

This might cause some users to lose there work entirely. Katalon is a testing tool and looks like the tool itslef is not getting tested.

1 Like

I can’t believe that Katalon Team is not providing us a hot fix to this issue yet.

I just experienced the same thing. After renamed test case the script disappeared.
I am using Katalon Studio 8.4.1

Katalon Studio v8.5.5 still has this bug.

I’ve lost 6 scripts in the last two days to this issue before figuring out what the cause was.

  • macOS 12.6
  • Katalon Studio 8.3.0

I reproduced this problem.

(1) I created a new project
(2) I created a test case at Test Cases/sub/subsub/TC1. I wrote the script as follows:

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

WebUI.comment("Hello, I am TC1!")

The folder tree looked as follows:

$ tree .
.
β”œβ”€β”€ Checkpoints
β”œβ”€β”€ Data Files
β”œβ”€β”€ Drivers
β”œβ”€β”€ Include
β”‚   β”œβ”€β”€ config
β”‚   β”‚   └── log.properties
β”‚   β”œβ”€β”€ features
β”‚   └── scripts
β”‚       └── groovy
β”œβ”€β”€ Keywords
β”œβ”€β”€ Libs
β”‚   β”œβ”€β”€ CustomKeywords.groovy
β”‚   └── internal
β”‚       └── GlobalVariable.groovy
β”œβ”€β”€ Object Repository
β”œβ”€β”€ Plugins
β”œβ”€β”€ Profiles
β”‚   └── default.glbl
β”œβ”€β”€ Reports
β”‚   └── Self-healing
β”‚       └── broken-test-objects.json
β”œβ”€β”€ Scripts
β”‚   └── sub
β”‚       └── subsub
β”‚           └── TC1
β”‚               └── Script1675690524595.groovy
β”œβ”€β”€ Test Cases
β”‚   └── sub
β”‚       └── subsub
β”‚           └── TC1.tc
β”œβ”€β”€ Test Listeners
β”œβ”€β”€ Test Suites
β”œβ”€β”€ TestScritVanishesWhenRenamed.prj
β”œβ”€β”€ bin
β”‚   β”œβ”€β”€ groovy
β”‚   β”œβ”€β”€ keyword
β”‚   β”œβ”€β”€ lib
β”‚   β”‚   β”œβ”€β”€ CustomKeywords.class
β”‚   β”‚   └── internal
β”‚   β”‚       └── GlobalVariable.class
β”‚   β”œβ”€β”€ listener
β”‚   └── testcase
β”œβ”€β”€ build.gradle
β”œβ”€β”€ console.properties
└── settings
    β”œβ”€β”€ external
    β”‚   β”œβ”€β”€ com.kms.katalon.composer.execution.settings.properties
    β”‚   └── com.kms.katalon.core.db.DatabaseSettings.properties
    └── internal
        β”œβ”€β”€ com.kms.katalon.composer.testcase.properties
        β”œβ”€β”€ com.kms.katalon.execution.properties
        β”œβ”€β”€ com.kms.katalon.execution.webui.properties
        β”œβ”€β”€ com.kms.katalon.integration.analytics.properties
        └── com.kms.katalon.integration.qtest.properties

36 directories, 19 files

This seemed OK.

(3) I tried to renamed Test Cases/sub/subsub/TC1 to Test Cases/sub/subsub/Main. Then I got a error dialog, which said Unable to renamed the test case.

I looked at the folder tree:

$ tree .
.
β”œβ”€β”€ Checkpoints
...
β”œβ”€β”€ Scripts
β”‚   └── sub
β”‚       └── subsub
β”‚           └── TC1
β”‚               └── Script1675690524595.groovy
β”œβ”€β”€ Test Cases
β”‚   └── sub
β”‚       └── subsub
β”‚           └── Main.tc
...

Interesting enough.

  • Test Cases/sub/subsub/TC1.tc has been already renamed to Test Cases/sub/subsub/Main.tc;
  • but the Scripts/sub/subsub/TC1/*.groovy file was left un-renamed

Obviously you can see, the renaming operation partially failed.

A Test Case in Katalon Studio is implemented as a combination of 2 physical files: one in the Test Cases folder, another in the Scripts folder. When I tried renaming a Test Case, Katalon Studio renamed a file under the Test Cases folder, but failed to rename the counter-part under the Scripts folder. Katalon Studio is not capable of Transactinal processing.

What is β€œTransactinal processing”? Well, Wikipedia tells you: β€œEach transaction must succeed or fail as a complete unit; it can never be only partially complete.”

(4) I tried renaming the Test Cases/sub/subsub/TC1 again.

I coud rename it, but I found the new Test Cases/sub/sub/Main has the following code:

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject
import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.testcase.TestCase as TestCase
import com.kms.katalon.core.testdata.TestData as TestData
import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW
import com.kms.katalon.core.testobject.TestObject as TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import internal.GlobalVariable as GlobalVariable
import org.openqa.selenium.Keys as Keys

This is an initial code: what we usually find when we create a new Test Case.

$ tree .
.
β”œβ”€β”€ Checkpoints
...
β”œβ”€β”€ Scripts
β”‚   └── sub
β”‚       └── subsub
β”‚           β”œβ”€β”€ Main
β”‚           β”‚   └── Script1675690919162.groovy
β”‚           └── TC1
β”‚               └── Script1675690524595.groovy
β”œβ”€β”€ Test Cases
β”‚   └── sub
β”‚       └── subsub
β”‚           └── Main.tc

You can find 2 files Scripts/sub/subsub/TC1 and Scripts/sub/subsub/Main.

I checked the content of Scripts/sub/subsub/TC1, which as as follows:

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

WebUI.comment("Hello, I am TC1!")

Wow! My vanished code was still there!

@MarkBC

You reported your issue at Why does Katalon Studio randomly erase test cases? .

You may find your β€œseemingly vanished codes” still remain in the Scripts folder with the previous folder names. Please check your project folder tree.

You can not check the project folder tree accurately using Katalon Studio.

You need to use Windows Explorer, or Mac Finder, or Terminal.

Thanks for the suggestion. I did find the files (using Finder on my Mac) and they existed in the scripts directory, but were 0 bytes long.

@MarkBC

I am sorry to hear that the files were 0 bytes long. Anything may be caused by bugs.


In order to protect your resources from being erased by Katalon Studio in future, I would recommend you to use Git to make a local backup of your projects.

Git is really bug-free! You can trust it.

I have posted a new one about the same issue:

i hope yo realize that i can read this as:

  • katalon development suck, dont ever trust. use alternate solutions!

@vu.tran any opinnion on this?

1 Like