Search code examples
web-servicessoapautomationbddkarate

How to read table data where the Request URL has given?


I have a feature file which contains the following content.

Feature: Webservices Testing
  I want to use this template for my feature file

Background:
   * url 'http://101.154.221.189:9101/search/InvGuidedSearchService?wsdl'

@Scenario1
Scenario: Get Available Units
        Given request 'testdata'
        When method post
        Then status 200
        * print 'Response of GetAvailableUnits:', response

@Scenario2
  Scenario: GetMember Preferences
    * url 'http://101.231.121.211:9211/extn/scep/MemberPreferencesService'
        Given request 'testdata'
        When method post
        Then status 200

        * print 'Response of GetMemberPreferences:', response

* table testdata
|file_name|
|'getAvailableUnitDetail.xml'|
|'getMemberPreferences.json'|

In order to read file request file from table data, what is the code procedure I need to use? For the above code, I'm getting the error message and it's not working.

What should be the correction required in this code?

Thanks


Solution

  • Start by understanding how you should read a data table in cucumber. I wrote a blog post outlining that a while ago. Read it and implement the example. It should give you enough knowledge to solve your current problem.