Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $

1,187 views
Skip to first unread message

Raju kiran

unread,
Jan 9, 2022, 1:29:08 PM1/9/22
to qaf users
When I am passing one parameter in feature file and running the test script facing

Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $
Feature file:

Feature: WebTableScneario
Scenario: Demo WebTableScneario

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

StepDef:
package com.qmetry.qaf.example.steps;

import java.util.List;
import java.util.Map;

import com.qmetry.qaf.automation.step.QAFTestStep;
import com.qmetry.qaf.automation.ui.WebDriverTestCase;



public class WebtableSteps extends WebDriverTestCase {
       
        @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");
          }

}




When I am running the config file facing below exception 
[RemoteTestNG] detected TestNG version 6.10.0
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Added "QAFMethodSelector"
java.lang.NoSuchFieldException: modifiers
        at java.base/java.lang.Class.getDeclaredField(Class.java:2549)
        at com.qmetry.qaf.automation.util.ClassUtil.setField(ClassUtil.java:599)
        at com.qmetry.qaf.automation.testng.pro.QAFExecutionListener.<init>(QAFExecutionListener.java:52)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:78)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
        at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:780)
        at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:722)
        at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1393)
        at org.testng.TestNG.addServiceLoaderListeners(TestNG.java:1017)
        at org.testng.TestNG.initializeConfiguration(TestNG.java:966)
        at org.testng.TestNG.run(TestNG.java:1089)
        at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
        at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
        at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
include groups []
 exclude groups: [] Scanarios location: scenarios/Webtable.feature
Unable to get class com.qmetry.qaf.automation.step.client.TestStepExporter from jar /C:/Users/rtuduru/.m2/repository/com/qmetry/qaf/3.0.0/qaf-3.0.0.jar
Login Page Step def
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at path $


Can Anyone please look into this and help me once
BeginArrayException.PNG

cjayswal

unread,
Jan 9, 2022, 8:25:31 PM1/9/22
to qaf users
I am able to reproduce bug. You can open a issue in github for this 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.



રવિવાર, 9 જાન્યુઆરી, 2022ના રોજ 10:29:08 AM UTC-8 વાગ્યે rjkir...@gmail.com દ્વારા આમ લખવામાં આવ્યું હતું:

cjayswal

unread,
Jan 10, 2022, 5:20:31 PM1/10/22
to qaf users
Please refer https://github.com/qmetry/qaf/issues/401

રવિવાર, 9 જાન્યુઆરી, 2022ના રોજ 05:25:31 PM UTC-8 વાગ્યે cjayswal દ્વારા આમ લખવામાં આવ્યું હતું:
Reply all
Reply to author
Forward
0 new messages