Is there any way to implement page object model in katalon studio? Please help
anyone there pls help me on this
POM is an idea separating each WebPage into smaller PageObject for maintainence purpose. In stead of making each WebPage a separated Class (ie implemeted in Java, etc), in Katalon Studio, we use the same approach with a little bit different implementation: Object Repository and Test Case.
Hence, there are 2 options we could use to implement POM:
- Use script mode completely. In this mode (at Keywords section), we can create PageObject classes (groovy/java) the same as implementation of any testing frameworks
- Use Katalon manual mode to create a structure as following image. PageObject is splitted at 2 area: Object Repository and Test Cases. The “call TestCase” function is used to reuse/call methods built in each page.
We implement “page object Model” or Page object Pattern by identifying first the pages… calling them: Page_Login,Page_Home,Page_ContactUs, etc . Within those pages are the objects defined in the object repository(this is ok to have the object once and not duplication of the object).
In the Keywords section we have Page_Login class with all the necessary methods to log to the application…implemented as @keyword (example : login keyword , so in all tests that needs to login…we call only one keyword by passing por example user and password). So we have each page has it own class keywords like selenium does.
I tried to implement the POM model in Katalon, and used it with BDD tests.
I’ve got an issue in the “loginSteps.groovy” file, with the customkeyword “login(String Username, String Password)”. Indeed, the test failed to enter in this step.
I tried to bypasse customkeyword and write directly every login step in the “loginSteps.groovy”, and it worked.
So I guessed I’ve got an issue with my login customkeyword.
Any recommandation or advice ?
which error were you getting ?
Please find below the error log.
Thanks for your help.
2019-12-09 13:34:45.385 ERROR c.k.k.core.main.WSVerificationExecutor - Verification FAILED.
com.kms.katalon.core.exception.StepFailedException: Feature file ‘Include/features/login.feature’ was failed
at com.kms.katalon.core.keyword.internal.KeywordMain$stepFailed$0.call(Unknown Source)
at com.kms.katalon.core.keyword.internal.KeywordMain$runKeyword.call(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile$0.callStatic(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile.call(Unknown Source)
at com.kms.katalon.core.main.TestCaseMain$runFeatureFile$0.call(Unknown Source)
It happens that you are calling a keyword from a stepdephinition, in the same way that you are calling the keyword only used for test cases, to call a keyword from a step you must instantiate the class and access the word key through the object or on the contrary declare the static method to access without instantiating.
Hi, thanks for the answer.
In fact, I found my mistake.
I tried to pass a “test object” as an argument rather than a string for my custom keyword.
Hello, I would like to know how you have implemented the stepsdephinitions in that same case.
On the other hand knowing if you use data through an excel with that same model and if that is how it would be, I would appreciate