got java.lang.ArrayIndexOutOfBoundsException: 28 after run a feature file

hallo all,
i got error java.lang.ArrayIndexOutOfBoundsException: 28 after run a feature file.

my feature file is :
#Author: your.email@your.domain.com
#Keywords Summary :
#Feature: List of scenarios.
#Scenario: Business rule through list of steps with arguments.
#Given: Some precondition step
#When: Some key actions
#Then: To observe outcomes or validation
#And,But: To enumerate more Given,When,Then steps
#Scenario Outline: List of steps for data-driven as an Examples and
#Examples: Container for s table
#Background: List of steps run before each of the scenarios
#“”" (Doc Strings)
#| (Data Tables)
#@ (Tags/Labels):To group Scenarios
#<> (placeholder)
#“”

(Comments)

#Sample Feature Definition Template
@tag
Feature: Order
I want to use this template for my feature file

@tag1
Scenario: Order with gopay
Given I am already Login
When I am open Product page
And I click 1-Click checkout
And I click change payment
And I choose qris
And I choose courier
And I click Confirm & Pay
Then Succesfully create order
And Close Browser

and my step definition
package common
import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.checkpoint.Checkpoint
import com.kms.katalon.core.checkpoint.CheckpointFactory
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testcase.TestCaseFactory
import com.kms.katalon.core.testdata.TestData
import com.kms.katalon.core.testdata.TestDataFactory
import com.kms.katalon.core.testobject.ObjectRepository
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

import internal.GlobalVariable

import org.openqa.selenium.WebElement
import org.openqa.selenium.WebDriver
import org.openqa.selenium.By

import com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory
import com.kms.katalon.core.webui.driver.DriverFactory

import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.testobject.ResponseObject
import com.kms.katalon.core.testobject.ConditionType
import com.kms.katalon.core.testobject.TestObjectProperty

import com.kms.katalon.core.mobile.helper.MobileElementCommonHelper
import com.kms.katalon.core.util.KeywordUtil

import com.kms.katalon.core.webui.exception.WebElementNotFoundException

import cucumber.api.java.en.And
import cucumber.api.java.en.Given
import cucumber.api.java.en.Then
import cucumber.api.java.en.When

class CommonOrder {
/**
* The step definitions below match with Katalon sample Gherkin steps
*/

String method = new String()
String total = new String()

@When("I am open Product page")
def I_am_open_product_page() {
	WebUI.navigateToUrl(GlobalVariable.product_url)
	WebUI.delay(5)
}

@And("I click 1-Click checkout")
def I_click_checkout() {
	WebUI.click(findTestObject('Product/button_1-Click_Checkout'))
	WebUI.delay(5)
}

@And("I click change payment")
def I_click_change_payment(){
	WebUI.click(findTestObject('Payment/button_change'))
}

@And("I choose courier")
def i_choose_courier() {
	WebUI.click(findTestObject('Payment/Page_Cart/div_Select_Courier'))
	WebUI.delay(5)
	WebUI.click(findTestObject('Payment/Page_Cart/div_first_courier'))
	WebUI.delay(5)
}

@And("I click Confirm & Pay")
def i_click_confirm() {
	total = WebUI.getText(findTestObject('Payment/Page_Cart/div_total_price')).trim()
	method = WebUI.getText(findTestObject('Payment/payment_method')).trim()
	method = method.toUpperCase()
	WebUI.click(findTestObject('Payment/Page_Cart/button_ConfirmPay'))
	WebUI.delay(3)
}

@Then("Succesfully create order")
def succesfully_create_order() {
	WebUI.verifyElementVisible(findTestObject('Payment/Page_QRIS/Label_complete_your_payment'))
	WebUI.verifyEqual(WebUI.getText(findTestObject('Payment/Page_QRIS/span_method')).trim(), method)
	WebUI.verifyEqual(WebUI.getText(findTestObject('Payment/Page_QRIS/Label_Total_Payment')).trim(), total)
	WebUI.delay(5)
}

@And("Order Complete")
def order_complete(){
	WebUI.delay(10)
}

}

class OrderQris {
/**
* The step definitions below match with Katalon sample Gherkin steps
*/
@And(“I choose qris”)
def I_choose_qris() {
WebUI.click(findTestObject(‘Payment/radio_QRIS_qr’))
}
}

how to solve the error? i think no problem with my gherkin file

You are trying to access an array index that doesn’t exist. You went out of bound, so you should probably change the range you set.

i don’t use array function on the gherkins feature file and step definition. so i confuse how to resolved this.

Try to click the last error line to see where the error is located.

1 Like

my error in console is
2022-08-23 13:01:04.321 ERROR c.k.k.core.main.WSVerificationExecutor - :x: Verification FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Keyword runFeatureFile was failed (Root cause: java.lang.ArrayIndexOutOfBoundsException: 28
at cucumber.runtime.formatter.TestSourcesModel.getKeywordFromSource(TestSourcesModel.java:124)
at cucumber.runtime.formatter.JUnitFormatter$TestCase.getKeywordFromSource(JUnitFormatter.java:287)
at cucumber.runtime.formatter.JUnitFormatter$TestCase.addStepAndResultListing(JUnitFormatter.java:277)
at cucumber.runtime.formatter.JUnitFormatter$TestCase.addTestCaseElement(JUnitFormatter.java:232)
at cucumber.runtime.formatter.JUnitFormatter.handleTestCaseFinished(JUnitFormatter.java:134)
at cucumber.runtime.formatter.JUnitFormatter.access$300(JUnitFormatter.java:42)
at cucumber.runtime.formatter.JUnitFormatter$4.receive(JUnitFormatter.java:71)
at cucumber.runtime.formatter.JUnitFormatter$4.receive(JUnitFormatter.java:68)
at cucumber.runner.EventBus.send(EventBus.java:28)
at cucumber.runner.TestCase.run(TestCase.java:58)
at cucumber.runner.Runner.runPickle(Runner.java:44)
at cucumber.runtime.Runtime.runFeature(Runtime.java:120)
at cucumber.runtime.Runtime.run(Runtime.java:106)
at cucumber.api.cli.Main.run(Main.java:35)
at cucumber.api.cli.Main$run.call(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$_runFeatureFile_closure1.doCall(CucumberBuiltinKeywords.groovy:108)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$_runFeatureFile_closure1.doCall(CucumberBuiltinKeywords.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:74)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:68)
at com.kms.katalon.core.keyword.internal.KeywordMain$runKeyword.call(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords.runFeatureFile(CucumberBuiltinKeywords.groovy:75)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile$0.callStatic(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords.runFeatureFile(CucumberBuiltinKeywords.groovy:248)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile.call(Unknown Source)
at WSVerification1661234372947.run(WSVerification1661234372947:2)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.WSVerificationExecutor.runScript(WSVerificationExecutor.java:180)
at com.kms.katalon.core.main.WSVerificationExecutor.doExecute(WSVerificationExecutor.java:174)
at com.kms.katalon.core.main.WSVerificationExecutor.processExecutionPhase(WSVerificationExecutor.java:157)
at com.kms.katalon.core.main.WSVerificationExecutor.accessMainPhase(WSVerificationExecutor.java:149)
at com.kms.katalon.core.main.WSVerificationExecutor.execute(WSVerificationExecutor.java:131)
at com.kms.katalon.core.main.TestCaseMain.runFeatureFile(TestCaseMain.java:172)
at com.kms.katalon.core.main.TestCaseMain$runFeatureFile$0.call(Unknown Source)
at TempTempCase1661234369961.run(TempTempCase1661234369961.groovy:25)
)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:50)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:76)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:68)
at com.kms.katalon.core.keyword.internal.KeywordMain$runKeyword.call(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords.runFeatureFile(CucumberBuiltinKeywords.groovy:75)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile$0.callStatic(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords.runFeatureFile(CucumberBuiltinKeywords.groovy:248)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile.call(Unknown Source)
at WSVerification1661234372947.run(WSVerification1661234372947:2)
at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
at com.kms.katalon.core.main.WSVerificationExecutor.runScript(WSVerificationExecutor.java:180)
at com.kms.katalon.core.main.WSVerificationExecutor.doExecute(WSVerificationExecutor.java:174)
at com.kms.katalon.core.main.WSVerificationExecutor.processExecutionPhase(WSVerificationExecutor.java:157)
at com.kms.katalon.core.main.WSVerificationExecutor.accessMainPhase(WSVerificationExecutor.java:149)
at com.kms.katalon.core.main.WSVerificationExecutor.execute(WSVerificationExecutor.java:131)
at com.kms.katalon.core.main.TestCaseMain.runFeatureFile(TestCaseMain.java:172)
at com.kms.katalon.core.main.TestCaseMain$runFeatureFile$0.call(Unknown Source)
at TempTempCase1661234369961.run(TempTempCase1661234369961.groovy:25)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 28
at cucumber.runtime.formatter.TestSourcesModel.getKeywordFromSource(TestSourcesModel.java:124)
at cucumber.runtime.formatter.JUnitFormatter$TestCase.getKeywordFromSource(JUnitFormatter.java:287)
at cucumber.runtime.formatter.JUnitFormatter$TestCase.addStepAndResultListing(JUnitFormatter.java:277)
at cucumber.runtime.formatter.JUnitFormatter$TestCase.addTestCaseElement(JUnitFormatter.java:232)
at cucumber.runtime.formatter.JUnitFormatter.handleTestCaseFinished(JUnitFormatter.java:134)
at cucumber.runtime.formatter.JUnitFormatter.access$300(JUnitFormatter.java:42)
at cucumber.runtime.formatter.JUnitFormatter$4.receive(JUnitFormatter.java:71)
at cucumber.runtime.formatter.JUnitFormatter$4.receive(JUnitFormatter.java:68)
at cucumber.runner.EventBus.send(EventBus.java:28)
at cucumber.runner.TestCase.run(TestCase.java:58)
at cucumber.runner.Runner.runPickle(Runner.java:44)
at cucumber.runtime.Runtime.runFeature(Runtime.java:120)
at cucumber.runtime.Runtime.run(Runtime.java:106)
at cucumber.api.cli.Main.run(Main.java:35)
at cucumber.api.cli.Main$run.call(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$_runFeatureFile_closure1.doCall(CucumberBuiltinKeywords.groovy:108)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$_runFeatureFile_closure1.doCall(CucumberBuiltinKeywords.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:74)
… 17 more

the last line was com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:74) that this is function from katalon it self not my code