Katalon Studio | How to create Custom Keywords

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 พ.ย. 2024

ความคิดเห็น • 70

  • @pallishreesenapati7452
    @pallishreesenapati7452 2 ปีที่แล้ว

    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

  • @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

  • @ashleythompson2652
    @ashleythompson2652 3 ปีที่แล้ว +1

    Love your videos thank you!

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว +1

      Most welcome

  • @nehachopkar-tz8vd
    @nehachopkar-tz8vd 11 หลายเดือนก่อน

    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  11 หลายเดือนก่อน

      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

  • @gionathanruggiero3810
    @gionathanruggiero3810 7 หลายเดือนก่อน

    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  7 หลายเดือนก่อน

      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

  • @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

  • @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

  • @abdulrahaman176
    @abdulrahaman176 4 ปีที่แล้ว +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  4 ปีที่แล้ว

      I will try to do a session Abdul

    • @abdulrahaman176
      @abdulrahaman176 4 ปีที่แล้ว

      @@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.

  • @LatinRemixes25
    @LatinRemixes25 4 ปีที่แล้ว

    Thank you :) Greeting from Colombia

    • @RaghavPal
      @RaghavPal  4 ปีที่แล้ว

      You are welcome!

  • @shanthiva6432
    @shanthiva6432 2 ปีที่แล้ว

    @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  2 ปีที่แล้ว

      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 2 ปีที่แล้ว

      @@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  2 ปีที่แล้ว

      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 th-cam.com/play/PLhW3qG5bs-L-yy1HtdxKcp-blmG5qeWgg.html

    • @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

  • @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

  • @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

  • @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

  • @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

  • @jnicoulakos
    @jnicoulakos 6 ปีที่แล้ว +1

    Thank you sir! :)

    • @RaghavPal
      @RaghavPal  6 ปีที่แล้ว

      You're welcome John

  • @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

  • @divushree
    @divushree 4 ปีที่แล้ว

    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  4 ปีที่แล้ว

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

  • @sarazsmile6845
    @sarazsmile6845 5 ปีที่แล้ว

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

    • @RaghavPal
      @RaghavPal  5 ปีที่แล้ว

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

  • @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

  • @tomaszmichalewicz4553
    @tomaszmichalewicz4553 5 ปีที่แล้ว

    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  5 ปีที่แล้ว

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

  • @DobromirManchev
    @DobromirManchev 6 ปีที่แล้ว +1

    Hey, can you make a video about Checkpoints?

    • @RaghavPal
      @RaghavPal  6 ปีที่แล้ว

      Hi, sure, I had already created it, Will be available tomorrow.

    • @DobromirManchev
      @DobromirManchev 6 ปีที่แล้ว +1

      Ah, cool!

    • @abdulazizalduhami6705
      @abdulazizalduhami6705 6 ปีที่แล้ว +1

      Great feature, thanks for the video!

  • @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

  • @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