Katalon Studio | How to create Custom Keywords

Поделиться
HTML-код
  • Опубликовано: 4 фев 2025

Комментарии • 70

  • @pallishreesenapati7452
    @pallishreesenapati7452 2 года назад +1

    Hi Raghav, thank you for this video. For writing any custom keyword we need to learn the groovy language.

    • @RaghavPal
      @RaghavPal  2 года назад +1

      Hi Pallishree, basic knowledge should be good to start, you can also find many examples online

  • @ashleythompson2652
    @ashleythompson2652 3 года назад +1

    Love your videos thank you!

  • @LatinRemixes25
    @LatinRemixes25 4 года назад

    Thank you :) Greeting from Colombia

  • @gionathanruggiero3810
    @gionathanruggiero3810 9 месяцев назад

    Hi Raghav, nice colletions of katalon studio videos, there are asome, i have a question, for you or community, i need to create a MOBILE keyword because i need to copy a text and then paste a text inn Android APP, can you help me, thanks

    • @RaghavPal
      @RaghavPal  9 месяцев назад

      Gionathan
      In Katalon Studio, you can create custom keywords to perform specific actions like copying and pasting text within an Android app. Here's a step-by-step guide to help you create a MOBILE keyword for this purpose:
      1. Define the Custom Keyword:
      - Go to Keywords in your Katalon Studio project.
      - Right-click and choose New > Keyword.
      - Provide a name for your keyword, such as `CopyAndPasteText`, and click OK.
      2. Implement the Keyword:
      - Open the newly created keyword file.
      - Write a method that uses the `Mobile.getText()` to extract text and `Mobile.setText()` to paste it.
      - Here's an example of how the code might look:
      ```groovy
      package com.yourcompany
      import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
      import com.kms.katalon.core.model.FailureHandling
      import com.kms.katalon.core.testobject.TestObject
      import io.appium.java_client.MobileElement
      import io.appium.java_client.android.AndroidDriver
      public class CopyAndPasteText {
      /
      * Copy text from one element and paste it into another.
      * @param fromElement TestObject to copy text from.
      * @param toElement TestObject to paste text into.
      */
      @Keyword
      def copyAndPasteText(TestObject fromElement, TestObject toElement) {
      // Get the driver
      AndroidDriver driver = MobileDriverFactory.getDriver()
      // Get text from the 'fromElement'
      String textToCopy = Mobile.getText(fromElement, FailureHandling.STOP_ON_FAILURE)
      // Set text to the 'toElement'
      Mobile.setText(toElement, textToCopy, FailureHandling.STOP_ON_FAILURE)
      }
      }
      ```
      3. Use the Keyword in Your Test Case:
      - In your test case, call the custom keyword with the appropriate TestObjects.
      - For example:
      ```groovy
      import com.yourcompany.CopyAndPasteText
      // Define your TestObjects
      TestObject fromElement = findTestObject('path/to/your/fromElement')
      TestObject toElement = findTestObject('path/to/your/toElement')
      // Use the custom keyword
      CopyAndPasteText customKeyword = new CopyAndPasteText()
      customKeyword.copyAndPasteText(fromElement, toElement)
      ```
      Make sure to replace `'path/to/your/fromElement'` and `'path/to/your/toElement'` with the actual paths to your TestObjects in the Object Repository.
      This is a simplified example, and you may need to adjust the code based on the specifics of your application and testing needs. For more detailed information, you can refer to the [Katalon documentation](^1^) on custom keywords and mobile testing commands.
      Remember to handle any exceptions and ensure that your elements are correctly identified in the Object Repository.
      Happy testing

  • @abdulrahaman176
    @abdulrahaman176 5 лет назад +2

    Hi Raghav, can you make a video on how to use the getHtmlTableRows (kustomkayword)and also how to use fiendElements methods in Katalon Studio.

    • @RaghavPal
      @RaghavPal  5 лет назад

      I will try to do a session Abdul

    • @abdulrahaman176
      @abdulrahaman176 5 лет назад

      @@RaghavPal Thank a lot ......

    • @abdulrahaman176
      @abdulrahaman176 4 года назад

      @@RaghavPal Hi Raghav, Please make a video waiting for this video

    • @abdulrahaman176
      @abdulrahaman176 4 года назад

      @@RaghavPal Hi Raghav, waiting for your session

    • @abdulrahaman176
      @abdulrahaman176 4 года назад

      @@RaghavPal Hi Raghav, waiting for your response....... it's humble request.

  • @chandrikamaddineni4437
    @chandrikamaddineni4437 4 года назад

    Hi mr.raghav,today I watched your vedios .your way of teaching is simply superb. Can u pls make a vedios like drag and drop and searching the specified ones in search bar.thank u

    • @RaghavPal
      @RaghavPal  4 года назад

      So happy & humbled to know this Chandrika, I will do

  • @shilpigs6251
    @shilpigs6251 5 лет назад

    Hi Raghav, Do you know how to call one custom keyword method to another custom keyword method. Eg: I ahev created ABC method in alfha custom keyword and need to call that ABC in beta custom keyword of XZY method.

    • @RaghavPal
      @RaghavPal  5 лет назад

      Hi Shilpi, have you tried doing the call in the keyword function, I believe this should be doable

  • @nehachopkar-tz8vd
    @nehachopkar-tz8vd Год назад

    Hi Raghav,
    How to call method from 1 test case to other?
    I have Firts Test case with method 1 and method 2
    I want to use method 2 in my send test case.
    I don't want to use custom keywords as I need only method 2.
    Please help! Thanks

    • @RaghavPal
      @RaghavPal  Год назад

      Neha
      There are two main ways to call methods from one test case to another in Katalon Studio without using custom keywords:
      **Method 1: Using the 'Call Test Case' keyword**
      The 'Call Test Case' keyword allows you to execute one test case from within another test case. To use this method, follow these steps:
      1. In your first test case, identify the method you want to call from the second test case.
      2. In your second test case, add the following step:
      ```
      WebUI.callTestCase(findTestCase('Second Test Case'))
      ```
      This step will execute the second test case, and any methods within that test case will be available for execution.
      3. To call the specific method you want, use the following syntax:
      ```
      TestObject secondTestCase = findTestCase('Second Test Case')
      secondTestCase.callMethod('method2')
      ```
      This will call the 'method2' method from the second test case.
      **Method 2: Using the 'Import Test Case' keyword**
      The 'Import Test Case' keyword allows you to import the methods from another test case into your current test case. To use this method, follow these steps:
      1. In your first test case, identify the methods you want to import into the second test case.
      2. In your second test case, add the following step:
      ```
      WebUI.importTestCase(findTestCase('First Test Case'))
      ```
      This step will import the methods from the first test case into your current test case.
      3. Once the methods have been imported, you can call them directly using the following syntax:
      ```
      firstTestCase.method2()
      ```
      This will call the 'method2' method from the first test case.
      Both of these methods will allow you to call methods from one test case to another in Katalon Studio without having to create custom keywords. The method you choose will depend on your specific needs and preferences.
      I hope this helps

  • @jnicoulakos
    @jnicoulakos 6 лет назад +1

    Thank you sir! :)

  • @shanthiva6432
    @shanthiva6432 3 года назад

    @Automation Step by Step: Raghav I would like to create custom keywords for GET, POST, PUT, DELETE, PATCH methods without using Object repository. I want to quit using ObjRepo since maintaining is becoming difficult. Is it possible? Please help me out

    • @RaghavPal
      @RaghavPal  3 года назад

      Hi Shanthi, you can do, will need to write code for it. In the Object Repository you can create sub-folders for easy maintenance

    • @shanthiva6432
      @shanthiva6432 3 года назад

      @@RaghavPal Raghav , what is happening is for each method I need to use authorization. So if the Authorization token (variable which I am using is ${token}) expires then the TC is failing.
      I have written a custom keyword script for authorization. and using it in the test case. The bearer token value I am storing in a global variable but somehow it is not getting picked up in objrepo. So I have to manually add the token value from postman to make the TC run. Can u help me with this? Also, i am trying to print the response, I see that the token value is running but it's not getting printed in test case

    • @RaghavPal
      @RaghavPal  3 года назад

      will check on this scenario

  • @shanthiva6432
    @shanthiva6432 3 года назад

    @Automation Step by Step : Raghav, Please help me in setting up Keywords for API tsting. Is there any video which you have made specific for API?
    Have you made any video for Authorization as well?Please let me know

    • @RaghavPal
      @RaghavPal  3 года назад

      Hi Shanthi, yes, you can check this ruclips.net/p/PLhW3qG5bs-L-yy1HtdxKcp-blmG5qeWgg

    • @shanthiva6432
      @shanthiva6432 3 года назад

      @@RaghavPal : Hi Raghav, can u please help me with writing this bearer auth token script in custom keyword. No matter what I am trying, i am not able to get it to execute

  • @palanivelselvaraj8110
    @palanivelselvaraj8110 3 года назад

    Dear Raghav,
    your videos are very useful to my QA team and thanks for your tutorials.

    • @RaghavPal
      @RaghavPal  3 года назад +1

      Glad to hear that Palanivel, can find all here - automationstepbystep.com/

    • @palanivelselvaraj8110
      @palanivelselvaraj8110 3 года назад

      @@RaghavPal noted it. thanks, Raghav

  • @waheedahmed6524
    @waheedahmed6524 5 лет назад +1

    Can we create custom keywords using java instead of groovy ? If so can you share video ?

    • @RaghavPal
      @RaghavPal  5 лет назад

      Hi Waheed, you can use java jar in katalon studio, For scripting within katalon you will need to use groovy

  • @sarazsmile6845
    @sarazsmile6845 6 лет назад

    i want to know how to compare two paragraph content in katlon. can you help me with that?

    • @RaghavPal
      @RaghavPal  6 лет назад

      Hi Saraz, you can verify match on 2 strings using docs.katalon.com/katalon-studio/docs/common-verify-match.html#description-

  • @Vinaykumar-rs5se
    @Vinaykumar-rs5se 3 года назад

    Hi ragav,
    I am using file upload function for uploading the PDF, it's not uploading it, could you please provide solution for it?

    • @RaghavPal
      @RaghavPal  3 года назад

      Hi Vinay, what do you get in logs

    • @Vinaykumar-rs5se
      @Vinaykumar-rs5se 3 года назад

      @@RaghavPal
      Thankyou for reply.
      I am getting file not interactable

    • @RaghavPal
      @RaghavPal  3 года назад +1

      will check on this

  • @hariprasad4946
    @hariprasad4946 6 лет назад

    Nice video Raghav.... Can you tell me why Katalon not allowing to call keyword if it is writen in Java instead groovy?

    • @RaghavPal
      @RaghavPal  6 лет назад

      Hi Hari, believe it supports groovy. You can also put this on katalon forum to get more insights

  • @testlinksuperuser6424
    @testlinksuperuser6424 6 лет назад +1

    Hi Raghav, Thanks for Videos. Can you please make a detailed video on Utilities keyword mentioned below for WEB Testing.
    Utilities
    [Common] Comment
    [Common] Concatenate
    Common Assertions (Soft Assetion)
    [Common] Verify Equal
    [Common] Verify Greater Than
    [Common] Verify Greater Than Or Equal
    [Common] Verify Less Than
    [Common] Verify Less Than Or Equal
    [Common] Verify Match
    [Common] Verify Not Equal
    [Common] Verify Not Match

    • @RaghavPal
      @RaghavPal  6 лет назад +1

      Hi, sure I will check it soon

  • @herbertdoy
    @herbertdoy 5 лет назад

    Hi Raghav, I'm learning a lot from your videos. One question, is it possible to call an ADB command for mobile app using custom keywords? Can you also make a video for it. That would be very helpful. Thanks :)

    • @RaghavPal
      @RaghavPal  5 лет назад

      Hi, you should be able to. I will check on that

  • @faryooza
    @faryooza 2 года назад

    Hi Dear
    i have a API web service with JavaScript pre request how can i handle it ?

    • @RaghavPal
      @RaghavPal  2 года назад

      Hi Faryooz, I will need to see some example

    • @faryooza
      @faryooza 2 года назад

      @@RaghavPal sure , i text u in linkedin since i'm not able to upload img here

    • @faryooza
      @faryooza 2 года назад

      @@RaghavPal if there is any other place to share with u the details please let me know

    • @RaghavPal
      @RaghavPal  2 года назад

      can upload on a shared url and send me

    • @faryooza
      @faryooza 2 года назад

      @@RaghavPal drive.google.com/file/d/1OFncd6IRQLnm_3PSMC8dW_6zLwt_ty94/view?usp=drivesdk

  • @mdnazeeer
    @mdnazeeer 6 лет назад

    Thanks Raghav.... 👏 could you please please tell how to integrate ngwebdriver with Katalon Studio.

    • @RaghavPal
      @RaghavPal  6 лет назад

      Hi Nazeer, Katalon Studio has keywords to handle Angular elements, try using them

  • @DobromirManchev
    @DobromirManchev 6 лет назад +1

    Hey, can you make a video about Checkpoints?

  • @tomaszmichalewicz4553
    @tomaszmichalewicz4553 6 лет назад

    Hi Raghav Thanks fro video. But i actually i wanted. There was a keyword created by my team which i wanted to import into my project. I even imported successfully but i need to add some object which i don't understand what kind of object is expected.

    • @RaghavPal
      @RaghavPal  6 лет назад

      Hi Tomasz, can you show me the scripting of the keyword.

  • @msmfathih862
    @msmfathih862 5 лет назад

    i can't see the keyword annotation in the drop down menu plz hlp

    • @RaghavPal
      @RaghavPal  5 лет назад

      Hi, hope you are talking about the auto suggestion drop down. You can start typing and then press Ctrl+Space

  • @divushree
    @divushree 5 лет назад

    calling custom keyword inside another custom keyword is working with this code
    (new “packagename”.“classname”()).“methodname”()
    But how to pass values
    If 1st custom keyword has
    @keyword
    def method name (string value)
    Pls guide me

    • @RaghavPal
      @RaghavPal  5 лет назад

      What is the error Divishree, will need some time to check on this