SoapUI Beginner Tutorial 8 - GROOVY Scripting in SoapUI | Getting Started

Sdílet
Vložit
  • čas přidán 4. 09. 2024

Komentáře • 145

  • @RaghavPal
    @RaghavPal  Před 5 lety +3

    Online courses - automationstepbystep.com/

  • @uhsbangalore2930
    @uhsbangalore2930 Před 4 lety +3

    We have implemented this groovy explained in the video, its a big success for the project. Thank you!

    • @RaghavPal
      @RaghavPal  Před 4 lety +1

      So happy to know this Ullasa

  • @yatishankarbandyopadhaya1275

    I strongly believe complete newbies like me find it very difficult to understand why are we starting with groovy in the first place. so far i had understood loading the WSDls, end point URLs, sending the request, getting a valid response, creating a test suite>test case>test step. From a practical standpoint it would be helpful for me to know why do i need to learn groovy after this. In my project on webservice testing i didnt need it. So if you could start with a basic intro as to why do we need groovy here will be helpful

    • @RaghavPal
      @RaghavPal  Před 4 lety +2

      Hi Yatishankar, I got your point. A session on why its needed, where it will help etc will help. Although some of this is mentioned during the sesion, but I can understand for newbies, a separate session will help. Will try to add this

    • @rahuljaiswal611995
      @rahuljaiswal611995 Před 2 lety

      @@RaghavPal Thank you for your lucid explanations .. please help to find the separate session which you have mentioned above .

  • @kevinpowers6875
    @kevinpowers6875 Před rokem

    You taught me how to run any testCase, which is awesome and just what we needed to reduce regression tests in soapUI. Many thanks and Kudo's!

  • @SingerPriyaBhandari
    @SingerPriyaBhandari Před 4 lety

    Hi Raghav, You are an awesome teacher. As a student, the only thing that makes us more clear is if you give a meaningful name to a particular test case or test suit or for any method you are using will help us to understand in the best way. I am getting too much confused on name like test suit 1, test case 2, and so on. sorry about that. Else Everything is perfect.

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Prabhat, I completely got your point Prabhat and will take care of this in future tutorials

  • @emilioastier
    @emilioastier Před 9 měsíci

    Hi Raghav, your videos are really educational and useful. They are of great help to me to better understand groovy in automation tests. greetings from Spain.

  • @mohammadamin8042
    @mohammadamin8042 Před 5 lety +2

    Hi Raghav your presentation is very helpfull thank you somuch.

  • @FosterSB
    @FosterSB Před 2 lety

    Your videos are very helpful and well organized. I like the use of notepad! When you get to the crux of a helpful point perhaps slow down a tad so that I needn't pause the video (if you're still making these years later). Thanks!

  • @f.r.i.e.n.d.s2127
    @f.r.i.e.n.d.s2127 Před 2 lety

    Thank You Raghav , It is very useful and very understanding .

  • @nagaswaraok4134
    @nagaswaraok4134 Před 5 lety +1

    hi thank you for giving this valueable infirmation great sir there no one canot expail like this clearly about groovy

  • @performancetestengineer-go2294

    Raghav pal sir your my best teacher

    • @RaghavPal
      @RaghavPal  Před 6 lety

      Great to know this Gowri. I am humbled.

  • @pavithralakshminarasimhan2623

    Very helpful to get started using groovy

  • @sanasayed5890
    @sanasayed5890 Před 4 lety

    Good explanation sir of every topic...keep it up

  • @mayankjain9941
    @mayankjain9941 Před 4 lety

    Nicely explained about groovy scripting thanks a lot!!!

  • @pragatishukla1720
    @pragatishukla1720 Před 4 lety +1

    Thanks for the wonderful video. Please let me know how to run more than on e test steps or test cases using single statement

    • @RaghavPal
      @RaghavPal  Před 4 lety +1

      Hi Pragati, What exactly is your scenario, In case you want to run in a loop you can do that using groovy script. e.g.
      // This will get the list of all testSteps in the testCase
      def testSteps = context.testCase.getTestStepList()
      testSteps.each{
      // This block will loop through the test steps and print the test step name to the log
      log.info(it.name)
      }

    • @pragatishukla1720
      @pragatishukla1720 Před 4 lety +2

      @@RaghavPal thanks this is all I wanted.

  • @lakshmiavvaru7126
    @lakshmiavvaru7126 Před 5 lety

    Thank you so much for helping me in all the project requirements I am in

  • @SagarSagar-ro3fj
    @SagarSagar-ro3fj Před 2 lety

    context Analogy...if i understand it correctly ... once we create a class and its methods, then we call it from different class. But, here we need to define variable to the class -def testStep = testRunner.testCase.getTestStepByName("Hello"); .this is something like deciding which which fun activity to go in the amusement park. Once we decide, we need a different passes/tickets to play the different rides. these pass/tickets are "Context" testStep.run(testRunner, context); . Once we get the pass we get access to that ride/area in amusement park. Once we do enter there we can play the ride which is actual function calling activity. context.Hello.sayHello()
    Lol..just trying to figure it out.confirm if this right and easy way to understand context..because context object is used in different languages as well for example dart in flutter.

  • @jyothirmaisivaram8934
    @jyothirmaisivaram8934 Před 4 lety +1

    Hi Raghav,
    Very well explained. Can you please provide syntax too? Example: to call a class that is defined in another test case. tcase=project.teststeps("").testcases("");

    • @RaghavPal
      @RaghavPal  Před 4 lety +1

      I will cover this, Not sure if I have done this in any later videos, I have some more Groovy sessions in SoapUI in my Udemy course

    • @jyothirmaisivaram8934
      @jyothirmaisivaram8934 Před 4 lety

      @@RaghavPal
      Do you have concepts that are not covered here in Udemy course?

    • @RaghavPal
      @RaghavPal  Před 4 lety +1

      A major part is the same, There are few Groovy Scripting sections. You can check all sections and lecture in the course Curriculum

    • @jyothirmaisivaram8934
      @jyothirmaisivaram8934 Před 4 lety

      @@RaghavPal Thank You

  • @zonacs4259
    @zonacs4259 Před 6 měsíci

    Hi Raghav, firstly i thank you for your tutorial serie, very helpful also because regarding SoaupUi, there aren't much guides out of here nowdays.
    So, i want to ask you one ore more practical use cases to implement a object-oriented program in a api test. I've seen this when implementing Selenium with customs libraries in e2e testing, but i can't immagine a usefull case in api testing.

    • @RaghavPal
      @RaghavPal  Před 6 měsíci

      While object-oriented programming (OOP) isn't as prevalent in API testing as it is in UI testing, there are certainly practical use cases where it can bring significant benefits:
      1. Modeling Complex Data Structures:
      * API responses or requests often involve nested objects and arrays. Object-oriented data structures like classes and interfaces can effectively represent these complexities, making tests more readable and maintainable.
      * Create dedicated classes for "user", "order", "product", etc., with properties and methods reflecting their real-world counterparts.
      2. Reusability and Modularity:
      * Break down common test logic into reusable methods within classes. This promotes code reuse and reduces duplication across tests.
      * Implement "base classes" for common API interactions (authentication, authorization), and inherit them for specific tests, reducing boilerplate code.
      3. Encapsulation and Abstraction:
      * Encapsulate complex logic within methods or properties, hiding implementation details and improving test readability.
      * Use interfaces to define expected behaviors without specifying concrete implementations, promoting flexibility and future changes.
      4. Data-Driven Testing:
      * Create classes to encapsulate different test data sets, making data-driven testing more organized and scalable.
      * Use inheritance or composition to create variations of test data based on specific scenarios.
      5. Mocking and Stubbing:
      * Develop custom mock objects mimicking external dependencies (third-party APIs, databases) using OOP principles.
      * This allows isolation and control of these dependencies in your tests.
      Examples:
      * Product API testing: Create a `Product` class with properties like ID, name, price, and methods for CRUD operations. Write tests that interact with the API using this class for clarity and reuse.
      * Authentication testing: Build an `Authentication` class with methods for login, logout, and token management. Leverage inheritance for specific authentication flows (OAuth, Basic Auth).
      Remember, OOP isn't always necessary, but when dealing with complex APIs or aiming for maintainable and scalable tests, it can provide significant advantages. Don't hesitate to adopt it when it enhances your testing practices.

  • @ramzijelassi9535
    @ramzijelassi9535 Před 5 lety +1

    Thanks for the video

  • @istvan368
    @istvan368 Před 4 lety +1

    Raghav very thank you for all these tutorials and that you give us for free! You are the best! I also have a youtube channel where I explain different things. You are my role model. I'd like to have a question, I have written a groovy script where I read data from excel and I'd like to do that my only test case loops through the rows that are in excel. So one row in excel stores all the data for one test case and each line means a different test case, but the test case form (all the request, etc) are the same.
    Or in other words, I have only one test case which contains all the necessary things. It has a groovy script which reads the rows from excel and every row means a complete run of the test case.
    p.s. I have a soapUI project where I have setup scripts which contain a class but it doesnt contain these variables that you say the class should contain.
    Another question which I'd like to have at the end of the video, what is the reason of these method invocations order: project = testRunner.testCase.testSuite.project ?

    • @RaghavPal
      @RaghavPal  Před 4 lety +1

      Hi István, so glad to know this.
      You might have to do some custom coding for making every line a test case in excel.
      these are the classes and interface in soapui library. You can read api docs to get more info

  • @Kamal-vd1zg
    @Kamal-vd1zg Před 4 lety

    I like the way you explain things
    thanks

  • @arjunms3345
    @arjunms3345 Před 5 lety +1

    Hello Raghav always love your videos great explanation...can you please tell me how do we make JDBC connection and do database verification in groovy...it would be really helpful... thank you

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Arjun, I will try to do a video, but can take some time. Pls get some online help meanwhile

  • @nagendran75
    @nagendran75 Před 4 lety +2

    Thank you Raghav, that was very useful. I've connected to the DB successfully through JDBC request and successfully retrieve the records using SQl queries.. How can I compare the response values against the DB returned values using Groovy script? Can you advise please?

    • @RaghavPal
      @RaghavPal  Před 4 lety +1

      Hi Nagendran, I will plan to have a session on this. For now check - testingneeds.wordpress.com/2016/11/21/soapui-push-and-pull-data-from-database/

    • @nagendran75
      @nagendran75 Před 4 lety

      @@RaghavPal Thanks very much Raghav. Managed to pull the Db response. looking forward to your session.

    • @RaghavPal
      @RaghavPal  Před 4 lety +2

      Great Nagendran, it will help others if you can put your solution here

    • @vidhyanagi
      @vidhyanagi Před 4 lety

      ​@@RaghavPal. ​ Sure Raghav. Sorry, I missed the notification as previously commented from my husband's mobile. I've used context.expand to refer to the soap response and the JDBC request- response. Here is the example code:
      def soapDataItem = context.expand ('$ { teststepnameofSOAPRequest#Response#//xpathoftheproperty}')
      def JDBC DataItem = context.expand ('$ { teststepnameofJDBCRequest#ResponseAsXml#//xpathoftheproperty}')
      assert soapDataItem == JDBCDataItem

  • @lolworld2178
    @lolworld2178 Před 3 lety

    what is the purpose to write run method? Why we have pass those 2 arguments and from where they will get value?

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi, its inbuilt in SoapUI, you can see the documentation for more details

  • @ashishnaidu2487
    @ashishnaidu2487 Před 2 lety

    Hi Raghav, your teaching is amazing and very easy to follow and did a hands on too and it was very productive. But in this video I was unable to follow much of it, I lost it at the very beginning itself maybe due to as I have zero programming knowledge. So, can you guide and assist me how to overcome this gap. Thanks again!

    • @RaghavPal
      @RaghavPal  Před 2 lety

      Hi Ashish, can learn Groovy from my tutorials here - automationstepbystep.com/

    • @ashishnaidu2487
      @ashishnaidu2487 Před 2 lety

      @@RaghavPal Thanks a lot! Raghav for the much valuable and helpful assistance.

  • @philb4462
    @philb4462 Před 4 lety

    Thanks again for your great course.
    Is it possible to run a Selenium script using a Groovy step in a SoapUI test case? Do you go into that later in your video series? At work we have a step that needs to be carried out from a screen interface because there is no WSDL for it.
    Also, I have a specific question about something I want to do on a project for my job. Would you consider doing a one-to-one session with me? I don't think it would take very long.

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Phil, You can do that, although not covered here. You can add selenium jars and then use groovy script or can also call a java jar for this.

  • @angelaranda4208
    @angelaranda4208 Před 5 lety +1

    Hello Raghav, do you have video where you show how to put the result of a wsdl in variable, so that in another wsdl that result can be used?

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Angel, you can see this one - czcams.com/video/GSAt7YOvjbY/video.html&list=PLhW3qG5bs-L-Bt9T_bnyflQ0Te4VgFhKF
      Playlist - czcams.com/play/PLhW3qG5bs-L-Bt9T_bnyflQ0Te4VgFhKF.html

  • @abhishekangrish
    @abhishekangrish Před 4 lety

    Hello Sir, Thankyou for such great informational videos . Always follow your videos. Also please can you once upload a token handling video for Jmeter. Actually i am trying to handle dynamic tokens in Jmeter and not getting the exact results with regular expressions. I will be very thankful in case you can help me out that Groovy scripting in J meter as well.

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Abhishek, sure I will check on that session

  • @nirmalm8158
    @nirmalm8158 Před 6 lety

    Hi Ragav, Excellent presentation. Very easy to understand. Thank you! Have a doubt, which tool will be the best for Web Service Load or Performance Testing (Load UI/LoadRunner/Jmeter..etc). Thanks!

    • @RaghavPal
      @RaghavPal  Před 6 lety

      Hi Nirmal, it depends on the need, features, budget etc. JMeter is free and lots of online support is available. However if you need to do geographical distribution, you will need multiple systems or go with some paid services like Blazemeter. Paid tools like LoadRunner have many out of the box features.
      So it depends.

  • @nrravitej2498
    @nrravitej2498 Před 5 lety

    Hi Raghav, @9:45 , the list of printed methods from testRunner class is not having the testCase method. This testCase is very commonly used method right, why is its not available in the list of methods got printed?. Below are the methods names printed [cancel, equals, fail, getClass, getLog, getReason, getResults, getRunContext, getStartTime, getStatus, getTestCase,
    getTestRunnable, getTimeTaken, gotoStep, gotoStepByName, hashCode, isRunning, notify, notifyAll, runTestStep, runTestStepByName,
    setMockRunContext, setRunContext, start, toString, wait, waitUntilFinished]
    Please clarify this doubt.

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi, pls check the api doc here - www.soapui.org/apidocs/com/eviware/soapui/model/testsuite/TestRunner.html

  • @kambalavinodkumar1018
    @kambalavinodkumar1018 Před 4 lety

    Hello Raghav, I have written this code to execute the case, but getting null pointer exception error at statement number 4.
    project = testRunner.testCase.testSuite.project ;
    tcase = project.testSuites["TestSuite3"].testCases["TestCase2"] ;
    tstep = tcase.getTestStepByName("GetCountryISOCode");
    def status = tstep.run(testRunner, context)
    def result = status.getStatus().toString();
    log.info (" >>>> "+result)

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi, just check if it is running your step. There can be some syntax or spelling issue (including spaces)

  • @user-ty4hf4tu9o
    @user-ty4hf4tu9o Před rokem

    Hello RaghavPal, Do you have any online course where we can learn readyAPI with AWS console connection and checking cloudwatch?

  • @AbhishekGupta-1807
    @AbhishekGupta-1807 Před 8 měsíci

    Sir for me the last demo didn't work the error is " Mon Dec 25 16:11:10 IST 2023:ERROR:An error occurred [Cannot get property 'testCase' on null object], see error log for details "

    • @RaghavPal
      @RaghavPal  Před 8 měsíci

      Abhishek
      Here are the steps to address it:
      1. Analyze Error Details:
      Review Error Log: Inspect SoapUI's error log for specific line numbers and clues about the script's context.
      Check Console Output: Look for additional error messages or stack traces that might provide more insights.
      2. Identify Null Object:
      Examine Variable Usage: Carefully review your script to determine where the testCase property is being accessed.
      Verify Context: Ensure that the script is executing within a valid test case context where the testCase property should be accessible.
      3. Common Causes and Solutions:
      Incorrect Script Placement:
      If the script is not within a test case or test step, it won't have access to the testCase property.
      Move the script to the appropriate location within a test case or test step.
      Missing Test Case Reference:
      If the script is in a separate file or custom library, ensure it's properly referencing the test case object.
      Pass the test case object as a parameter to the script or use appropriate methods to access it.
      Script Execution Order:
      If the script depends on other test steps or variables, verify that they are executing in the correct order.
      Adjust the test case structure or use conditional logic to ensure proper execution flow.
      Global Properties:
      If you're using global properties, double-check their names and values to ensure they are defined correctly.
      4. Debugging Tips:
      Use Logging: Add log.info statements to print variable values and track script execution flow.
      Isolate the Issue: Comment out parts of the script to narrow down the problematic code.
      Test Incrementally: Build and test your script in small, manageable sections.
      5. Additional Considerations:
      SoapUI Version: If you're using an older SoapUI version, consider upgrading to avoid compatibility issues.
      Script Complexity: For complex scripts, consider using techniques like modularization and error handling to improve readability and maintainability.

  • @ashwin4399
    @ashwin4399 Před 3 lety

    What is the difference between context and TestRunner as both the usage are same??

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Ashwin, pls check this stackoverflow.com/questions/25184307/what-t-is-the-difference-between-context-and-testrunner-in-soapui

  • @testingtrail
    @testingtrail Před 6 lety

    Great tutorial, so seems to me that use of classes is more like static right? or by doing this testinit = tcase.getTestStepByName("anyclass"); you are creating an object of that type? Thanks!

    • @RaghavPal
      @RaghavPal  Před 6 lety +1

      So here a lot of inbuilt functions are provided by soapui. like getTestStepByName() is a function already available in an existing class and we can call it to get the value

  • @gullasridhar8720
    @gullasridhar8720 Před 8 měsíci

    Hi sir, i have a doubts
    1. If we mentioned path parameter wrong in the uri what status code we get and we mentioned wrong Query parameter what status we get, we get 404 only for both path and query parameters or we get different status code.
    2. what is the main difference between Bearer token and Token generated through API

    • @RaghavPal
      @RaghavPal  Před 8 měsíci +1

      Here are the answers to your SoapUI API testing questions:
      1. Status Codes for Incorrect Parameters:
      - Incorrect Path Parameter:
      - Most likely results in a 404 Not Found status code, indicating the requested resource doesn't exist at the specified path.
      - Incorrect Query Parameter:
      - Varies depending on API implementation:
      - Might return a 400 Bad Request status code if the parameter is invalid or essential for processing.
      - Could return a 404 Not Found if the parameter is crucial for resource identification.
      - Might ignore invalid parameters and return a 200 OK status code with potentially unexpected results.
      Key takeaways:
      - API documentation should specify expected status codes for different error scenarios.
      - Testing with both correct and incorrect parameters is crucial for robust API testing.
      2. Differences Between Bearer Token and API-Generated Token:
      - Bearer Token:
      - Self-contained access token representing authorization to access protected resources.
      - Typically obtained through OAuth 2.0 or OpenID Connect flows.
      - Used by adding "Bearer" keyword before the token in the Authorization header.
      - Example: `Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...`
      - API-Generated Token:
      - Created by the API itself upon successful authentication or other actions.
      - Specific usage varies depending on API design:
      - Can be used for authorization, session management, or other purposes.
      - Might be included in request headers, query parameters, or body data.
      - Example: `Authorization: Token 1234567890abcdef`
      Key takeaways:
      - Bearer tokens are a standardized way to handle authorization in web APIs.
      - API-generated tokens offer flexibility for custom authentication and authorization mechanisms.
      - API documentation should clarify the types of tokens used and their intended usage.
      Additional considerations for SoapUI:
      - Use test steps to set appropriate headers for different token types.
      - Assert expected status codes to verify API behavior in response to incorrect parameters.
      - Leverage SoapUI's test suites and reporting features for comprehensive API testing.

    • @gullasridhar8720
      @gullasridhar8720 Před 8 měsíci

      @@RaghavPal Thank you for clear cut explanation sir

  • @mekha123
    @mekha123 Před 4 lety

    Hello, Ragav Thanks for the brilliant presentation But testStep.run(testRunner, context) not defined into hello class

  • @saifalisanadi6519
    @saifalisanadi6519 Před 5 lety +1

    can u plz create video on how perform IO operation in groovy

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Saifali, I have some File I/O videos here - czcams.com/play/PLhW3qG5bs-L8T6v6DgsZo93DgYDmOF9u4.html

  • @minuahamed632
    @minuahamed632 Před 4 lety

    Hi Raghav, I have one query.In the 'CallHello' test step , why did you write testStep.run(testRunner,Context) ? I could not understand the need for that line of code.
    Thanks,
    Minu

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Minu, log, context and testRunner are global variables and is present everytime in SoapUI. Now I may not go very deep but you can directly use them in your scripts as and when required and there are some in built syntaxes like the one above. You may check more in the documentation

  • @roopashreedb6149
    @roopashreedb6149 Před 3 lety

    Hi Raghav..
    How to stop testcases running in infinite loop
    It is not stopping..it is running continuously

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Roopa, if you do not find any option on the ui, you will have to close soapui and then fix the script

  • @sreelathatharigonda8306

    its very nice video. The Groovy script which we are using in SoapUI and Jenkins pipeline script , both are the same?

    • @RaghavPal
      @RaghavPal  Před 6 lety

      Thanks for watching Sreelatha. Groovy script is same wherever you use it.

  • @rijojohnpatric9642
    @rijojohnpatric9642 Před 3 lety

    Do we have the feature for auto suggestion, what we experience in eclipse
    @Raghav Pal

  • @niazmaksud1139
    @niazmaksud1139 Před 5 lety

    Hi Raghav,
    Thanks for the video.
    Why are you passing testRunner and context as parameters in method testStep.run?

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Niaz, this is as per the structure of the method.

  • @shivaji288
    @shivaji288 Před 4 lety

    Hi I am getting while executing callHello groovy script java.lang.NullPointerException: cannot invoke menthod info () on null object line number 5 .

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Pls check your code again and try to compare. What is line 5 of your code

  • @sreesatyatarra1810
    @sreesatyatarra1810 Před 5 lety

    As part of groovy scripting I'm unable to call 2 values from excel to do addition soap request . Please help. Its throwing error stating "org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Script4.groovy: 3: unable to resolve class".

    • @sreesatyatarra1810
      @sreesatyatarra1810 Před 5 lety

      Its not able to recognize workbook even though i imported jxl.*

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Sreesatya , did you add excel library in bin folder and restart SoapUI

  • @vasuvasu7881
    @vasuvasu7881 Před 3 lety

    Hi Raghav is groovy scripting same in readyapi and soupui tools

    • @RaghavPal
      @RaghavPal  Před 3 lety +1

      Yes, ReadyAPI may have some more features like auto complete etc but you can use the same groovy scripts

  • @vipintekade6400
    @vipintekade6400 Před 4 lety

    @Automation Step by Step
    project =testRunner.testCase.testSuite.project;
    tcase = project.testSuites("TestSuite3").testCases("TestCaseName1");
    hello = tcase.getTestStepByName("Hello");
    hello.run(testRunner, context)
    context.Hello.sayHello("Vipin")
    For this Program i didn't got the proper output ;
    groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.WsdlProject.testSuites() is applicable for argument types: (java.lang.String) values: [TestSuite3] Possible solutions: getTestSuites() error at line: 2

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Vipin, you have used circular brackets (). Try using square brackets []
      tcase = project.testSuites("TestSuite3").testCases("TestCaseName1");

  • @prashantmainali6896
    @prashantmainali6896 Před 3 lety

    Hey can anyone answer that is it important to name groovyStep same name as the class itself

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Prashant, In case its related to some part in the video, pls mention the time stamp so I can check also try and check at your end

  • @pujanagraj7498
    @pujanagraj7498 Před 3 lety

    I'm getting java.lang.NullPointerException:Cannot invoke method sathi() on null object

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Puja where is this method sathi() coming from. Show the script

    • @pujanagraj7498
      @pujanagraj7498 Před 3 lety

      @@RaghavPal
      Is there any difference happens, if
      1) Right click on Test steps>Add Step>Groovy Script
      2) Right click on Test case1, in Test suite 3 as in Vedio>Addstep>Groovy Script
      I have done both one for class Hello and one for Calling the method, since the structure of Test suite remained same I didn't bother.

    • @pujanagraj7498
      @pujanagraj7498 Před 3 lety

      @@RaghavPal
      I had not given Global Variable in order...like, log,context,test Runner in context.setProperty, now it executed, Tqsm😊

  • @anitha3469
    @anitha3469 Před 5 lety +1

    how to write this in a single line?
    project = testRunner.testCase.testSuite.project ;
    tcase = project.testSuites["TestSuite3"].testCases["TestCase1"] ;
    hello = tcase.getTestStepByName("Hello");

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Anitha, I believe I replied to a similar question earlier. Just try to combine these like
      hello = testRunner.testCase.testSuite.project.testSuites["TestSuite3"].testCases["TestCase1"].getTestStepByName("Hello")

  • @TOBongExpress
    @TOBongExpress Před 5 lety

    Hi Raghav,
    I need help with the blow can you help?
    Test Step Name: Read Data from Excel file
    Script Groovy Script
    Web Services Method N/A
    Activity
    1. Read the inputs from a input.xls (define in project level property datafile) and set the values o the test case level properties x and Y
    2. Run the Addition Test from groovy script
    3. Fetch the result value from the response and set the fetched result value as the value to the test case level property z
    4. Write the result value into the console log

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Sourav, do you need a groovy script for this. You will have to search and create it, I do not have anything handy

    • @TOBongExpress
      @TOBongExpress Před 5 lety

      @@RaghavPal Thankyou Raghav Please let me know if I register for your CZcams Course will you be able to speak over chat and get help in solving codes like this , I want to learn this in details

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Sourav, due to huge no of messages, I might not be able to come over chat, but you can send me your queries and I can reply when I see them

  • @krishnadasari9863
    @krishnadasari9863 Před 5 lety

    how can we validate the REST request using JSON with the help of groovy script

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Krishna, you will have to get the response and then use JsonSlurper. You will get some groovy videos in this playlist - czcams.com/play/PLhW3qG5bs-L-Bt9T_bnyflQ0Te4VgFhKF.html
      Can take some online help as well

  • @kshitijrastogi5674
    @kshitijrastogi5674 Před 5 lety

    Hi,
    I am getting a null pointer exception when I try to call my method from another test case.
    please help..

  • @qentitest6005
    @qentitest6005 Před 5 lety

    Hey Raghav! Can you run python files with groovy script and can you use groovy script variable for testcase header valuer?

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi, I did not exactly got your scenario and needs. In SoapUI, we use groovy scripting. You should be able to use it and code as per your needs.

  • @prashantmainalimusic
    @prashantmainalimusic Před 3 lety

    Can we call this class from a different project if yes then how?

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Prashant, not sure from a diff proj, will need to check online

  • @vipintekade3750
    @vipintekade3750 Před 4 lety

    Hi Ragav
    project =testRunner.testCase.testSuite.project;
    tcase = project.testSuites("TestSuite3").testCases("TestCaseName1");
    hello = tcase.getTestStepByName("Hello");
    hello.run(testRunner, context)
    context.Hello.sayHello("Vipin")
    Output : got this below error please help .
    groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.WsdlProject.testSuites() is applicable for argument types: (java.lang.String) values: [TestSuite3] Possible solutions: getTestSuites() error at line: 2

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Vipin, the syntax is wrong. it should be
      tcase = project.testSuites["TestSuite3"].testCases["TestCaseName1"] ;
      it is square brackets and not circular brackets

  • @narmadaav2967
    @narmadaav2967 Před 5 lety

    Hi Raghav ,
    Is there a video where we can give multi data for an xml using groovy

    • @narmadaav2967
      @narmadaav2967 Před 5 lety

      I wanted to give multi data to single xml
      And wanted to take the xml automatically from any datasoruce...using soapui free version...
      Thanks in advance

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Narmada, pls explain your scenario in detail. An example will help

  • @steffy007
    @steffy007 Před 6 lety

    How to re,ad excel sheet data into groovy? pls help

    • @RaghavPal
      @RaghavPal  Před 6 lety

      Hi Steffy, I will plan to create a tutorial on that. You can try getting some online help meanwhile. Check this
      stackoverflow.com/questions/46407278/how-to-get-data-from-excel-to-soapui-request
      community.smartbear.com/t5/SoapUI-Pro/Get-xls-data-in-loop-in-groovy-script/td-p/27864

  • @prathibhab3112
    @prathibhab3112 Před 5 lety

    I get NullPointerException when I run callHello groovy... Error is at line -context.Hello.sayHello() Please help..

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Prathibha, need some logs to check this. Suggest pls see the video again to check if you missed something.

    • @prathibhab3112
      @prathibhab3112 Před 5 lety +1

      @@RaghavPal Sure Raghav..

    • @prathibhab3112
      @prathibhab3112 Před 5 lety

      @@RaghavPal context.setProperty("Hello", new Hello(log,context,testRunner)) - does this statement will add a custom property with the name Hello and value of the constructor to the groovy test step Hello? Because I checked my system and I did not find the custom property Hello under the groovy test step...

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Prathibha, this should not create a custom property available for user. It creates in context that will be available dynamically at runtime

    • @spheshoyisa3731
      @spheshoyisa3731 Před 5 lety

      I was getting NullpointerException ,because my groovy class was HelloGroovyScript but I called Hello then I changed to Hello then it worked .

  • @harshsingh-uc1yf
    @harshsingh-uc1yf Před 3 lety

    Not working for me

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Let me know the issue with logs Harsh

  • @balpreetsingh217
    @balpreetsingh217 Před 4 lety

    I got confused by listening "Hello" multiple times.