How to check reference for my keyword

Hi guys,

Let say if i have created 4 functions in a custom keywords and have been widely used in other test cases, anyone know is there any method can i trace back the specific function that had used in which test cases?
Example i have function A,B,C i only want to know function A used in which function. In test case, we can trace it by right click and click reference, but if keyword function is there any way to do it?

@Alan_Chan1

Hi Alan,

Did you find a resolution to this? Im faced with the same question.

1 Like

This post has been up for 1 year. Now that there is a reaction, you are going to delete it?

I flagged the post, i need help with this.

My first idea was to use the power of deleting an item from the Object Repository within KS, but upon further reflection, I decided it would not work. However, how about:

Download “Komodo Edit” (there was a free version when I got it a few years ago) and use its power to Find-in-Files to review your Test Cases in the script folder for any of your Keywords. It should give you a listing of the path structure for every instance of your search criteria. At the top will be a count of the number of instances found and the number of files reviewed.
Edit: It looks like only the free version is available (Komodo Edit) and the paid version is now not supported (Komodo IDE).

You can also use another free product called NotePad++ and use Search > Find-in-Files.

And this link says you can even do it in Windows Explorer on Windows 10. Just remember to use the colon separator and quotation marks.
http://julianhopkins.com/how-to-search-for-a-specific-phrase-in-windows-10-file-explorer/

I have ever developed a solution named “TestObject Usage Report”

This solution provides a reverse lookup from TestObject to TestCase. You are supposed to

  1. create a TestSuite “runAllTestCases” that calls all of your Test Cases
  2. create a Test Listener that call my Plugin’s API
  3. you run the TestSuite
  4. my Plugin monitors test cases calling test objects; records the reference in memory
  5. finally the plugin prints the information into text files. In there you can find information which test objects are called by which test cases.

I can imagine that the programming technique of “TestObject Usage Report” can generate a reverse lookup from Keyword method to Test Case. That would be a solution for the “How to check reference for my keyword” question.

====

But I am not going to develop it. Because, I am sure, that development would not satisfy people at all. Surely they would expect a list of Test Case names is presented by a very short action on the Keyword Editor: e.g, right click on the keyword method source. They wouldn’t do any more hustle.

====

Practically I do not need this reverse lookup feature. I would just remove (or comment out) the keyword method in question; and run a Test Suite “runAllTestCases” to check. If the test fails, I would know the keyword is used (so I would restore the keyword source). If the test passes, I would know the keyword is not used. This poor method is enough for me.

Use grep. Altough it is a linux native app, you can find windows binaries too

If you are prepared to get out of Katalon Studio and use other tools to do “grep” like search, I would recommend Visual Studio Code.

Open the folder of your KS project in VSCode, Edit > Find in Files

In fact, I use VSCode quite often together with Katalon Studio. VSCode provides features that KS lacks. For example, the editor for Markdown document with Dynamic Preview is useful for authoring documents about KS project, e.g, README.md.

1 Like

Hi,

I’ve tried using a different IDE, namely IntelliJ.
This works for me alot better than the Katalon IDE.

Running tests to see where it breaks by commenting out keywords is no option for me, its far too time consuming for the project i’m working at.

I think it’s a good idea to have several applications to assist you in your testing / IT work. Even kazurayam states that he uses others, like MS Code.

Hi Alan_Chan1
May this will help you.

First copy the function name that you have created like “setUsername” then click on the Advance Search CTA.
Click on the file search tab paste the function name and search.
In the search result, you will get all the scripts that are using this function.

image


Thank You!

1 Like

The following old post describes how to import a Katalon project into other IDE such as IntelliJ IDEA and Eclipse. A magic trick.

As you may know, a Katalon Studio project is essentially an Eclipse project. The IDE products support imporing project created other vendors. So commercial IDE products are potentically able to import the Groovy source codes written in Katalon Studio. Once imported, you may be able to use vast coverages of “Refactoring” features of IDEA and Eclipse. You may be able to get xrefs of class/method references as @Alan_Chan1 wanted.

However you can NOT run the Katalon Test Cases in other IDEs of course.

If you edited the test cases source in IntelliJ IDEA, it is likely you want to export edited source into Katalon Studio. ---- I think you need to invent a way to do this (copy files from dir A to dir B). You shouldn’t export any support by Katalon Studio.

This post may be interesting to someone who want more of refactoring support provided by IDEs.

Thought I haven’t really tried this. Please try at your own risk.

Please note that the poster of the aformentioned post wrote

Please note that this is not an official feature. Use this only if you really prefer your IDE.