{"id":22283144,"url":"https://github.com/lchrennew/g-stack","last_synced_at":"2025-07-28T21:32:27.213Z","repository":{"id":39961674,"uuid":"139086859","full_name":"lchrennew/G-Stack","owner":"lchrennew","description":"让你无需写代码就能搞定的自动化验收/接口测试，基于Gauge的全栈测试平台","archived":false,"fork":false,"pushed_at":"2022-06-20T23:35:17.000Z","size":4151,"stargazers_count":6,"open_issues_count":5,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-03-27T18:12:14.053Z","etag":null,"topics":["api","bdd","gauge","uitest"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lchrennew.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-29T01:39:32.000Z","updated_at":"2022-11-22T01:28:13.000Z","dependencies_parsed_at":"2022-09-03T15:13:07.656Z","dependency_job_id":null,"html_url":"https://github.com/lchrennew/G-Stack","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lchrennew%2FG-Stack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lchrennew%2FG-Stack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lchrennew%2FG-Stack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lchrennew%2FG-Stack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lchrennew","download_url":"https://codeload.github.com/lchrennew/G-Stack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227958699,"owners_count":17847457,"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":["api","bdd","gauge","uitest"],"created_at":"2024-12-03T16:38:59.585Z","updated_at":"2024-12-03T16:39:01.150Z","avatar_url":"https://github.com/lchrennew.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# G-Stack\n让你无需写代码就能搞定的自动化验收/接口测试，基于Gauge的全栈测试平台\n\n[![Gauge Badge](https://gauge.org/Gauge_Badge.svg)](https://gauge.org)\n\n## Requirements\n* Maven 3+\n* Java 1.8+\n* Gauge\n* IDEA\n* Gauge plugins: guage-java, gauge-java, gauge-java-maven, gauge-intellij-idea, gauge-html-report\n\n## DSL reference\n### Syntax\nG-Stack Syntax is fully compatible with Gauge, reference [here](https://docs.gauge.org/latest/writing-specifications.html) for more detail on Gauge Syntax\n\n### Basic Syntax\n* If you want to print messages into both console \u0026 reports:\u003cbr\u003e\n`PRINT \"content\"`\n\n* If you want to assert an actual value to an expected value:\n```markdown\n* ASSERT \u003cactual\u003e \u003cmatch\u003e \u003cexpected\u003e\n```\nbuild-in matches: `=`, `\u003c\u003e`, `!=`, `contains`\n\n* If you want to assert multiple actual values to their expected values one by one in one step:\u003cbr\u003e\n```markdown\n* ASSERT \u003ctable\u003e\n```\n`\u003ctable\u003e` format: \n```markdown\n|actual|match|expected|\n|------|-----|--------|\n```\n\n* If you want execution to be paused for seconds:\u003cbr\u003e\n`* WAIT \u003cseconds\u003e`\n\n* If you want to share data between steps, scenarios or specs:\u003cbr\u003e\n``` markdown\n* SET:SCENARIO \u003cname\u003e \u003cvalue\u003e\n* SET:SPEC \u003cname\u003e \u003cvalue\u003e\n* SET:SUITE \u003cname\u003e \u003cvalue\u003e\n```\nor share multiple values:\n```markdown\n* SET:SCENARIO \u003ctable\u003e\n* SET:SPEC \u003ctable\u003e\n* SET:SUITE \u003ctable\u003e\n```\n`\u003ctable\u003e` format: \n```markdown\n|name|value|\n|----|-----|\n|m   |4    |\n|n   |5    |\n// @{m} =\u003e 4\n// @{n} =\u003e 5\n```\nor dynamic table\n```markdown\n|col1|col2|col3|\n|----|----|----|\n|x   |10  |20  |\n// @{col1.x.col2} =\u003e 10\n// @{col1.x.col3} =\u003e 20\n```\nor dynamic table with explicitly id column\n```markdown\n|col1#|col2|col3|\n|-----|----|----|\n|x    |10  |20  |\n// @{col1.x.col2} =\u003e 10\n// @{col1.x.col3} =\u003e 20\n\n```\n\n\n\n\n* After set value to their name, you could get the value by our Argument Syntax: \n`@{name}`\n\n#### Arguments\n```markdown\n* SET:SCENARIO \"hello\" \"world\"\n* SET:SCENARIO \"suffix\" \"llo\"\n* PRINT \"@{hello}\"\n* PRINT \"I will say: @{hello}\"\n* PRINT \"hello, @{he@{suffix}}!\"\n```\n\nThe output will be:\n```text\nworld\nI will say: world\nhello, world!\n```\n\n#### Dynamic Arguments\nThere are some arguments whose value can be generated automatically.\nBuild-in dynamic arguments:\n\n```markdown\n@{timestamp}\n```\n\n### HTTP Syntax\n#### Arrange Request\n* If you want to set baseUri:\n```markdown\n* BASE \u003cbaseUri\u003e\n```\n* If you want to set basePath:\n```markdown\n* PATH \u003cbasePath\u003e\n```\n\n* If you want to add query parameters to Url\n```markdown\n* QUERY \u003cname\u003e \u003cvalue\u003e\n```\nor\n```markdown\n* QUERY \u003ctable\u003e\n```\n`\u003ctable\u003e` format:\n```markdown\n|name|value|\n|----|-----|\n```\ne.g.\n```markdown\n* QUERY \"a\" \"1\"\n* QUERY \"a\" \"2\"\n* QUERY\n|name|value|\n|----|-----|\n|b   |1    |\n|c   |2    |\n|c   |3    |\n```\nthe final query string will be\n```markdown\n?a=1\u0026a=2\u0026b=1\u0026c=2\u0026c=3\n```\n\n* If you want to add request headers:\n```markdown\n* HEADER \u003cname\u003e \u003cvalue\u003e\n```\nor (`\u003ctable\u003e` format is same to `QUERY`)\n```markdown\n* HEADER \u003ctable\u003e\n```\n\n* If you want to add cookies:\n```markdown\n* COOKIE \u003cname\u003e \u003cvalue\u003e\n```\nor (`\u003ctable\u003e` format is same to `QUERY`)\n```markdown\n* COOKIE \u003ctable\u003e\n```\n\n* If you want to set Content-Type\n```markdown\n* CONTENTTYPE \u003ccontentType\u003e\n```\nor\n```markdown\n* CONTENTTYPE \u003ccontentType\u003e \u003ccharSet\u003e\n```\n\n* If you want to add form parameters:\n```markdown\n* BODY:FORM \u003cname\u003e \u003cvalue\u003e\n```\nor (`\u003ctable\u003e` format is same to `QUERY`)\n```markdown\n* BODY:FORM \u003ctable\u003e\n```\n\n* If you want to add text content to body:\n```markdown\n* BODY:CONTENT \u003ccontent\u003e\n```\n\n* If you want to build a whole new request:\n```markdown\n* REQUEST:NEW\n```\n\n* If you want to build a whole new request from a config file:\n```markdown\n* HTTP:SETUP \u003cjsonConfig\u003e\n```\ne.g.\n```markdown\n* HTTP:SETUP \u003cfile:dir/request.config\u003e\n```\n```json\n{\n  \"method\": \"GET\",\n  \"baseUri\": \"https://requestloggerbin.herokuapp.com\",\n  \"basePath\": \"/\",\n  \"httpVersion\": \"HTTP/1.1\",\n  \"cookies\": {\n    \"c1\": \"d4c19a20393919416cc88d29a4dec3cbe1528282256\",\n    \"c2\": \"null\"\n  },\n  \"headers\": {\n    \"accept\": \"application/json\",\n    \"accept-language\": \"zh-CN,zh;q=0.9,en;q=0.8\"\n  },\n  \"queryString\": {\n    \"a\": [\n      \"1\",\n      \"2\"\n    ],\n    \"b\": \"3\"\n  },\n  \"postData\": {\n    \"mimeType\": \"application/x-www-form-urlencoded\",\n    \"forms\": {\n      \"c\": [\n        \"5\",\n        \"4\"\n      ],\n      \"d\": \"6\"\n    }\n  }\n}\n```\n\n\n#### Http Act\n* If you want to send GET request:\n```markdown\n* GET \u003curl\u003e\n```\n\n* If you want to send POST request:\n```markdown\n* POST\n```\nor \n```markdown\n* POST \u003curl\u003e\n```\n\n\n#### Assert Response\n* If you want to assert response status code:\n```markdown\nSTATUS \u003cstatusCode\u003e\n```\n\n* If you want to assert response body content:\n```markdown\n// entirely match\n* CHECK:BODY \u003ccontent\u003e\n\n// partial match\n* CHECK:CONTENT \u003ccontent\u003e\n\n// not match\n* FAIL:BODY \u003ccontent\u003e\n\n// not contain\n* FAIL:CONTENT \u003ccontent\u003e\n\n```\n\n* If you want to check response as a JSON by GPath (Note that the `\u003cjsonPath\u003e` is a GPath)\n```markdown\n* CHECK:JSONPATH \u003cjsonPath\u003e \u003cexpected\u003e\n* FAIL:JSONPATH \u003cjsonPath\u003e \u003cunexpected\u003e\n\n```\nor\n```markdown\n* CHECK:JSONPATH \u003ctable\u003e\n```\n`\u003ctable\u003e` format:\n```markdown\n|path|value|\n|----|-----|\n```\n\n* If you want to check response as a JSON by JSON Schema Validation:\n```markdown\n* CHECK:JSONSCHEMA \u003cschema\u003e\n```\n\n* If you want to check response headers:\n```markdown\n// header with expected value\n* CHECK:HEADER \u003cname\u003e \u003cvalue\u003e\n\n// not exist header\n* CHECK:HEADER \u003cname\u003e null\n```\n\n* If you want to check response cookies:\n```markdown\n* CHECK:COOKIE \u003cname\u003e \u003cvalue\u003e\n* CHECK:COOKIE \u003cname\u003e null\n```\n\n#### Extract response values\nIf you want to share response data between steps or scenarios in current specification, you could use extraction syntax.\n\n* If you want to extract body content:\n```markdown\n* EXTRACT:CONTENT \u003cvariableName\u003e\n```\n\n* If you want to extract value of a GPath\n```markdown\n* EXTRACT:JSONPATH \u003cpath\u003e \u003cvariableName\u003e\n```\n\n* If you want to extract headers\n```markdown\n* EXTRACT:HEADER \u003cheader\u003e \u003cvariableName\u003e\n```\n\n* If you want to extract cookies\n```markdown\n* EXTRACT:HEADER \u003ccookie\u003e \u003cvariableName\u003e\n```\n\n#### Log requests and response\n* If you want to log requests and response into console or report:\n```markdown\n// before the request is sent\n* HTTP:LOG\n```\n\n\n### MySql Syntax\n* If you want to execute single sql statement:\n```markdown\n* SQL:STATEMENT \u003cconnection\u003e \u003csql\u003e\n```\n\n* If you want to execute assertion in sql:\n```markdown\n// \u003csql\u003e returns 0 for fail and 1 for pass\n* SQL:ASSERT \u003cconnection\u003e \u003csql\u003e\n```\n\n* If you want to execute batch sql statements:\n```markdown\n* SQL:SCRIPT \u003cconnection\u003e \u003csql\u003e\n```\n\n* If you want to execute insert and share auto-generated id with other steps:\n```markdown\n* SQL:INSERT \u003cconnection\u003e \u003ctable\u003e\n```\nnote that the `\u003ctable\u003e` is a dynamic table with explicitly id column:\n```markdown\n|col1#|col2|col3|\n|-----|----|----|\n|x    |10  |20  |\n// @{col1.x.id} =\u003e new generated id\n// @{col1.x.col2} =\u003e 10\n// @{col1.x.col3} =\u003e 20\n```\n\n\n### Web UI Syntax\n* If you want to use Web UI Automation, you must use scope syntax first:\n```markdown\n* UI:WEB BEGIN\n// perform some actions here\n* UI:WEB END\n```\n\n* If you want to open browser:\n```markdown\n* OPEN \u003curl\u003e\n```\n\n* If you want to define an element with a name:\n```markdown\nDEF \u003cname\u003e \u003ccssSelector\u003e\n```\n\n* If you want to enter text into element:\n```markdown\n* ENTER \u003cname\u003e \u003ctext\u003e\n```\n\n* If you want to click on an element:\n```markdown\n* CLICK \u003cname\u003e\n```\n\n* If you want to submit an element:\n```markdown\n* SUBMIT \u003cname\u003e\n```\n\n* If you want to close browser:\n```markdown\n* QUIT\n```\n\n\n## License\n\n![GNU Public License version 3.0](http://www.gnu.org/graphics/gplv3-127x51.png)\nG-Stack is released under [GNU Public License version 3.0](http://www.gnu.org/licenses/gpl-3.0.txt)\n\n## Copyright\n\nCopyright 2018 CHUN.LI\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flchrennew%2Fg-stack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flchrennew%2Fg-stack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flchrennew%2Fg-stack/lists"}