com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $ in QAF

Viewed 302

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $

Feature file: In the feature file I am passing one parameter

Feature: WebTableScneario 
Scenario: Demo WebTableScneario

Given I login to application
And I select the country
|Country|
|UAE|
Then I logout the application

StepDef:

@QAFTestStep(description ="I login to application") 
      public void user_is_on_loginpage() {
      
         
          System.out.println("Login Page Step def");
      }
    
    @QAFTestStep(description ="I select the country{0}") 
      public void user_selectCountry(List<Map<String,String>> countrydetails) {
      System.out.println("select the country");
      }
      
    @QAFTestStep(description ="I logout the application") 
      public void user_logout() {
      System.out.println("logout");
      }

}

Can anyone please into this and help me But When I am running facing below exception Console log

1 Answers

This looks potential bug for corner case. A quick fix can be as below:

And I select the country
|Country||
|UAE||

Alternately, the method signature can be changed to accept Map instead of List of Map or List of String/Object if you are expecting only one property in list.

Update: Refer issue 401

Related