{"id":13587213,"url":"https://github.com/phiSgr/gatling-grpc","last_synced_at":"2025-04-07T19:31:00.527Z","repository":{"id":33925753,"uuid":"144457012","full_name":"phiSgr/gatling-grpc","owner":"phiSgr","description":"A Gatling load test plugin for gRPC","archived":true,"fork":false,"pushed_at":"2024-02-07T04:35:09.000Z","size":347,"stargazers_count":126,"open_issues_count":2,"forks_count":42,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-02-07T05:41:26.537Z","etag":null,"topics":["grpc"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phiSgr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-08-12T10:20:37.000Z","updated_at":"2024-04-15T08:04:46.186Z","dependencies_parsed_at":"2023-02-17T23:01:21.363Z","dependency_job_id":"5e9b5bf7-29a0-4b1a-b351-51fe3dd831ad","html_url":"https://github.com/phiSgr/gatling-grpc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phiSgr%2Fgatling-grpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phiSgr%2Fgatling-grpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phiSgr%2Fgatling-grpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phiSgr%2Fgatling-grpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phiSgr","download_url":"https://codeload.github.com/phiSgr/gatling-grpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247716133,"owners_count":20984177,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["grpc"],"created_at":"2024-08-01T15:06:06.263Z","updated_at":"2025-04-07T19:30:59.877Z","avatar_url":"https://github.com/phiSgr.png","language":"Scala","funding_links":[],"categories":["Scala","Tools"],"sub_categories":["Testing","Plugins"],"readme":"# Gatling-gRPC\n\nA [Gatling](http://gatling.io/) load test community plugin for [gRPC](https://grpc.io/).\n\n[Since Gatling 3.10](https://gatling.io/2024/01/gatling-introduces-a-grpc-plugin-for-load-testing/),\nGatling Corp has released [their plugin for gRPC](https://gatling.io/docs/gatling/reference/current/grpc/).\n\n# This plugin will no longer be updated. Feel free to fork and maintain it if you want (to provide) up-to-date free stuff.\n\n### Java/Kotlin API\n\nSince 3.7, Gatling adds Java API for the test to be written in Java or Kotlin.\nSince Gatling-gRPC 0.14.0, [a binding](gatling-grpc-kt) is written in Kotlin for Java and Kotlin users.\nIt is demoed in the [gatling-grpc-gradle-demo](https://github.com/phiSgr/gatling-grpc-gradle-demo/blob/master/src/gatling/kotlin/com/github/phisgr/exampletest/PingPongKt.kt) project.\n\n## Usage\n\nBecause of gRPC's need of code generation,\nI assume you are running the tests using a build tool, e.g. the\n[SBT plugin](https://gatling.io/docs/current/extensions/sbt_plugin/).\nFor a quickstart guide, see this\n[Medium article](https://medium.com/@georgeleung_7777/a-demo-of-gatling-grpc-bc92158ca808).\n\nFor usage with the [Gradle Gatling plugin](https://gatling.io/docs/current/extensions/gradle_plugin/),\nsee this [example project](https://github.com/phiSgr/gatling-grpc-gradle-demo).\n\nTo use this library, add this library to the test dependencies\nalong with the two required by Gatling.\n\n```sbt\nlibraryDependencies ++= Seq(\n  \"io.gatling.highcharts\" % \"gatling-charts-highcharts\" % gatlingVersion % \"test\",\n  \"io.gatling\" % \"gatling-test-framework\" % gatlingVersion % \"test\",\n  \"com.github.phisgr\" % \"gatling-grpc\" % \"0.17.0\" % \"test\"\n)\nenablePlugins(GatlingPlugin)\n```\n\nFor setting up the code generation, see\n[the documentation in ScalaPB](https://scalapb.github.io/sbt-settings.html).\n\nIf your protobuf files are in `src/test/protobuf`\ninstead of `src/main/protobuf`, change `Compile` to `Test`.\n\n```sbt\nTest / PB.targets := Seq(\n  scalapb.gen() -\u003e (Test / sourceManaged).value\n)\n```\n\nTo make a gRPC call:\n\n```scala\nexec(\n  grpc(\"my_request\")\n    .rpc(ChatServiceGrpc.METHOD_GREET)\n    .payload(GreetRequest(\n      username = \"myUserName\",\n      name = \"My name\"\n    ))\n)\n```\n\n__For a complete demo and various examples\nincluding the proper syntax to include\n[session attributes](https://gatling.io/docs/current/session/session_api/)\n(e.g. from a feeder, or saved in a check),\nsee [`GrpcExample` in test](src/test/scala/com/github/phisgr/example/GrpcExample.scala).__\n\nFor more complex manipulations with session attributes and protobuf objects,\nlike repeated fields and map fields,\nsee [the unit test](src/test/scala/com/github/phisgr/gatling/pb/LensExprSpec.scala).\n\n### Dynamic Payload\nThere are helper methods in `gatling-grpc` for\ngenerating dynamic ScalaPB objects with `Lens`es,\nas demonstrated in the example linked above.\nIt makes uses of [extension methods](https://docs.scala-lang.org/overviews/core/implicit-classes.html),\nand requires importing `com.github.phisgr.gatling.pb._`.\n\nIf you want to use Java Protobuf classes,\nyou can use the [`gatling-javapb`](java-pb) library.\n\nIf the expressive power of these two plumbing tools are not enough,\nyou can always resort to [writing a lambda](https://github.com/phiSgr/gatling-grpc/blob/77c9bb1231037ac4a531cfee4c3f88dd09e13fbc/bench/src/main/scala/com/github/phisgr/gatling/pb/bench/TestUpdateExpr.scala#L78).\nBecause an `Expression[T]`is \n[just an alias](https://gatling.io/docs/current/session/expression_el/#expression) \nfor `Session =\u003e Validation[T]`.\n\n### Logging\nIn [`logback.xml`](https://gatling.io/docs/current/general/debugging/#logback), add  \n`\u003clogger name=\"com.github.phisgr.gatling.grpc\" level=\"DEBUG\" /\u003e`  \nto log the requests that are failed;\nor set the `level` to `TRACE` to log all gRPC requests.\n\n## Development\n\n`sbt clean coverage test Gatling/test coverageReport` for a coverage report.  \n`sbt clean bench/clean 'bench/jmh:run -i 3 -wi 3 -f10 -t1 -prof gc'` for JMH tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FphiSgr%2Fgatling-grpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FphiSgr%2Fgatling-grpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FphiSgr%2Fgatling-grpc/lists"}