加特林脚本发出警告:“导入的“登录”被包操作中的对象登录定义永久隐藏”

问题描述 投票:0回答:1

我在IntelliJ中运行我的加特林脚本时遇到问题。我有多个脚本要执行,其中涉及一次登录,然后其余的脚本/流程。对于前4-5个脚本,一切运行良好,直到遇到此警告->“导入的Login' is permanently hidden by definition of object Login in package actions" in the newly created script. Ever since, every script, that includes even the previously running scripts, has started throwing this warning. As a result, even if I ignore and go ahead with executing the script, it stops moving ahead and remains stuck, later throwing this blockage in the console as well -> imported Login'被包操作中的对象Login定义永久隐藏。

我遵循了与以前的脚本完全相同的脚本编写实践,与通常的编写没有偏差。

流量:

  1. 执行登录
  2. 捕获登录操作期间生成的会话ID。
  3. 创建一个新脚本并在该脚本中导入Login操作,从而使用捕获的会话ID值。
  4. 当我开始仅在新创建的脚本中看到异常时,当我在新脚本中导入Login操作包时出现问题。

请帮助。

谢谢!

scala exception performance-testing gatling scala-gatling
1个回答
0
投票
//Login Action that is being imported to another action below:


    package jda.Scheduler.actions

    import io.gatling.core.Predef._
    import io.gatling.http.Predef._
    import scala.concurrent.duration._



    object Login {

      def loginAction(): ChainBuilder = {

        group("Login") {

          exec(http("Main_Request")
            .post("/******/****/login?loginName=c***&password=****")
            .header("Accept", "application/json")
            .header("Content-Type", "application/x-www-form-urlencoded")
            .header("Accept-Encoding", "gzip")
            .header("User-Agent", "okhttp/2.7.5")
            .body(StringBody(""""""))
            .check(status.in(200))

            .check(headerRegex("Set-Cookie", "REFSSessionID(.+?);").find.saveAs("SessionID")))
        }
      }
    }


//Different Action where Login is being imported and issues faced:

package jda.Scheduler.actions

import jda.Scheduler.actions.Login ---> Warning appears (imported 'Login' is permanently hidden by definition of object Login in package actions)


import jda.Scheduler.actions.CreateUserAction ---> Warning appears (imported 'CreateUserAction' is permanently hidden by definition of object CreateUserAction in package actions)

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._

object UpdateEmployeeAction {


  def updateEmployeeAction(): ChainBuilder = {

  group ("updateEmployee"){
    exec(http("Main_Request")
        .get("/******/****/****/api/***-***/employees/${userID}")

    .header("Content-Type", "application/json")

    .header("REFSSessionID", "${SessionID}")  ---> This part is being captured and saved //in Login action

    .body(StringBody("""{

  "id": ${userID}, --> This part (${userID}) is being captured and saved in another action, just //like Login Action. Even this is creating same issues.

    "badgeNumber": ${userloginname},
    "birthDate": "1900-07-31T00:00:00",
    "hireDate": "2019-08-12T00:00:00",
    "seniorityDate": "2019-08-12T00:00:00",
    "minorStatus": "Minor",
    "isManagement": false,
    "managerPassword": null,
    "managerInSchedule": false,
    "generateException": true,
    "generateAlerts": true,
    "canWorkUnassignedJobs": true,
    "schedulingTypeCode": "Manual",
    "ignoreBiometricValidation": false,
    "punchValidationCode": "NoScheduleValidation"
}"""))

    .check(status.in(200))

        )}}
  }
© www.soinside.com 2019 - 2024. All rights reserved.