Want to execute unit-tests by JUnit for my Java/Groovy code as Cutom Keyward

**OS : **Windows 7

Katalon Studio Version : 5.3.0.1

## Katalon Studio logs:

I don’t think log is necessary for this case.

## Environment (for Web testing)

Browser : Firefox 52

## Environment (for Mobile testing)

N/A

## Steps to reproduce -

I made my own Custom Keyword “verifyUrlAccessible(String url)” as mentioned at

https://forum.katalon.com/discussion/5345/webui-verifylinksaccessible-is-not-very-useful-a-custom-keyword-verifylinkaccesible-is-proposed#latest

## Actual Behavior -

I found that Katalon Studio lacks feature of executing JUnit tests over my Java/Grooby codes as CustomeKeyword.
Initially my CustomKeywords.‘com.happymigration.UrlUtils.verifyUrlAccessible’ was just a few lines of code. But soon my CustomKeyword started to grow, become larger and more complexed. I realized that it deserved JUnit tests. I could not find a way how to execuite JUnit in Katalon Studio project. Therefore I created a new Eclipse project where I write Java code for my CustomeKeyword and performed JUnit testing just as I usually do. Then I copied and pasted the finalized Java code into Katalon Studio. — This way saved me. But it is obviously non-efficient.

I am afraid that, in the current Katalon Studio design, Custom Keyword is not regarded as a first-class citizen. It is rather regarded as a supplemental feature which is better than having nothing. I would propose you, Katalon Team, to promote it. **

## Expected Behavior -

**Just I mean, please let me do JUnit testing for my Custom Keywords.

Otherwise, I will develop my Custome Keywords in a seperated Eclipse project where I can execute JUnit testing as much as I want. I would require Katalon Studio document to describe how to integrate my Eclipse project and Katalon Studio — I want to know how to share the CLASSPATH in the Katalon project with my Eclipse project.

## Screenshots / Videos

PLS

find attached image of my desktop where windows of Eclipse and Katalon Studio opened. I developed and unit-tested my Java code as CustomeKeyword in Eclipse. Once finished, I did copy-paste the code into the Katalon Studio’s project. This way worked, but it is far too inefficient.

CustomeKeyword_developed_inEclipse_copyandpasted_into_KatalonStudio.png

4 Likes

Hi Kazurayam

I’m now moving away from @Keywords and declaring my methods as static and importing them wherever I need them. There are two reasons I do this:

1 - CustomKeywords.‘com.companyname.classname.keywordname’(args) is very ugly in Script View.
2 - com.companyname.classname.keywordname is mostly unreadable in Manual View and usually involves having to make the Item column wider (which Katalon does not remember)

I would much rather:

import static com.companyname.classname.mymethod
mymethod(args)

I wonder if this will help you run unit tests against your methods?

Russ

Russ,

Thank you very much for your suggestion. I will think about it.

1 Like

After 4 months learning Katalon Studio, I have got a progress on running JUnit in Katalon Studio.
See Running JUnit4 in Katalon Studio

1 Like