Iâm convinced @kazurayam is writing a book - Katalon: The Missing Manual
Love this thread. slowly but slowly is about reinventing the wheel
Why not simply use IDEA+groovy+Spock?
apply plugin: 'groovy'
group = 'org.spockframework'
version = '1.0-SNAPSHOT'
description = """Spock Framework - Example Project"""
sourceCompatibility = 1.8
repositories {
maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
compile group: 'org.codehaus.groovy', name: 'groovy-all', version:'2.5.2'
compile group: 'org.codehaus.groovy.modules.http-builder', name: 'http-builder', version: '0.7.1'
testCompile group: 'org.spockframework', name: 'spock-core', version:'1.2-groovy-2.5'
testCompile group: 'com.athaydes', name: 'spock-reports', version:'1.6.1'
testCompile group: 'org.slf4j', name: 'slf4j-simple', version:'1.7.13'
}
tasks.withType(Test) {
systemProperties System.properties
}
thatâs all you need
Thank you @Ibus thatâs definitely another great option. At this moment we havenât published our Maven-based libraries so if they are required dependencies the setting up will be a little bit tricky.
Well, we are not reinventing the wheel. I want to do unit-testing for custom Keywords with JUnit. In the Katalon Studio GUI it was difficult. Therefore devalex88 proposed alternative way: do it in IDEA or Eclipse. We are reusing the best wheels, arenât we?
By the way , I miss âPage Objectâ in Katalon Studio. I hope I could reinvent the wheel called âPage Objectâ in Katalon Studio.
Martin Fowler wrote :
However, if you write tests that manipulate the HTML elements directly your tests will be brittle to changes in the UI.
Test Objects in Katalon Studio manipulate HTML elements directly, so my Katalon tests will be brittle to changes in UI.
The âObject Repositoryâ stuffed by âWeb Recorderâ tool tends to be huge in size where hundreds of duplicating Test Objects are contained. A huge Object Repository is simply hard to maintain. Due to this concern, I would rarely use âWeb Recorderâ for testing a large-scale Web UI. I have a hope that introducing âPage Objectâ pattern into Katalon Studio would enable us to reduce the size of âObject Repositoryâ.
I have some web-ui testing projects of mine which use IDE+Groovy+Gradle+WebDriver+Spock+GEB. GEB provides nice implementation of Page Object pattern. I like this tool set.
But I still love Katalon Studio primarily for its easiness for non-programmers (my colleagues at work) to getting started with. They can not get started with the âIDE+Groovy+Gradle+WebDriver+Spock+GEBâ tool set ever; it has too much of technical prerequisites â they can not set it up at all.
So I miss âPage Objectâ pattern in Katalon Studio.
@kazurayam i was just kidding. honestly i love the workarounds proposed.
@devalex88 mhm ⌠i have an idea ⌠not sure if will work.
What if we grab all the jarâs from katalon plugins and bring them into an IDEA project (maven or gradle) ?
In theory if they are in a standard place we should be able to use them âŚ
I have to find some time next week to play with this, in vacation now âŚ
I have given up the idea of testing my custom keywords with JUnit outside Katalon Studio; I mean in Eclipse.
I want to do unit-tests on my custom keyword class com.kazurayam.ksbackyard.ScreenshotDriver
. This class interacts with WebDriver to take screenshot of web sites, therefore it requires the Katalon Studio runtime environment. It is impossible to mock the KS runtime environment in Eclipse, so I gave up.
I am going to investigate 2 more options, both will be performed within Katalon Studio GUI:
- Use Cucumber (which is built-in Katalon Studio) for testing my custom keyword classes
- Develop another custom keyword ârunJUnitâ and call it in ordinary Katalon Test Cases. The keyword should make it easier to run JUnit tests located in the
Includes/scripts/groovy
directory. I also want to find some way to view the testing results in concise format.
I started learning Cucumber in Katalon Studio. I read https://docs.katalon.com/katalon-studio/docs/running-cucumber-features-file.html#in-test-cases and found such sample code:
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(features = "Include/features", glue = "")
public class MyCucumberRunner {}
Well, this code is using org.junit.runner.RunWith
. In other words, Cucumber is running on top of JUnit. I have got a clearer view how Cucumber is integrated into Katalon Studio.
I have developed a custom keyword which integrates JUnit in Katalon Studio. See the following post:
More to the subject of the original post, I tried importing my Katalon project using the build.gradle option and everything in IntelliJ is mangled, not even sure where to start. I think I should have imported it as an eclipse project like you stated. Just found other threads where build.gradle turned out more favorable results. If you going down this path, caution to the wise - donât import the project using the build.gradle file- that is if you are using Katalon with gradle integration to begin with. I could probably work through the challenges but I wonât live that long. Gonna retry the recommended way for now . . .
I understand you are writing to me @kazurayam.
I have ever done importing a Katalon Studio project into IntelliJ IDEA as well as Eclipse.
Do you want help for this issue? If so, please share more information on it so that other people can try reproducing the issue on their side â the zip of the katalon project that you want to import into IntelliJ IDEA, and the build.gradle script you used.
I do not see what you mean, sorry.
In the first place, why are you, @ze2, trying to import Katalon Studio project into IntelliJ IDEA or Eclipse? As I noted at Jan 8, I found that idea is useless for me.
hi,
in IntelliJ IDEA create maven project
implement your classes & methods
then create .jar in File --> Project Structure --> Artifacts
give name for your .jar file, press OK
then build artifacts
Build --> build artifacts
.jar file created to path out.artifacts
copy .jar to Katalon Drivers folder
import package.classname.methods in Katalon testcase or keyword class
hi @devalex88 , First of all thanks a lot for doing this.This is a great help for me.
I have imported my katalon project in intellij ,every jar is working fine in intellij also but i have a problem that i am not able to run our test cases as Object Repository is not getting identified . Reason what i think is that after importing project in intellij each object in object repository has been imported with extension â.rsâ but it is looking for without â.rsâ.
Eg. Katalon is looking for Object with path âObject Repository/Logout/UserIconâ but in project it is âObject Repository/Logout/UserIcon.rsâ . Is this a reason i am not able to execute my test cases and If yes then plz help me how can we execute our test cases.
Amar convert your object repository into Keywords and then you would be able to access.
Please how do I convert the Object Repository into Keywords. Thanks in advance for helping.
Max 2, if you trying to not to utilize OR in katalon studio then you can define your all test objects as a keywords .
Refer to this page
https://docs.katalon.com/katalon-studio/docs/handling_static_dynamic_test_objects.html#create-a-separate-keyword-for-dynamic-selectors
Hi, I performed the same as you did, but it did not work for me.
. The error i am facing is Groovyc: parsing failed. Please help me to resolve this issue