The Power is a bunch of test scripts that share a single centralized configuration file for use with GitHub API's. It's commonly used by folks with a need to teach, learn, debug against GItHub's API's in a rapid fashion. It aims to be the fastest way to demo any feature of GitHub.
The Power is a simple test framework for GitHub’s API’s. It’s goal is to help you learn to interact with and understand GitHub API’s by building test scenarios such as; a repository with a pull request, teams and users on a testing instance of GitHub Enterprise or GitHub.com a pre-existing Organization and Enterprise Account.
The Power can create the following on a blank appliance or organization in <=30 seconds:
main
..gitattributes
files.bug
.There are many other features and test-cases you can use or adapt to build scenarios of your own.
[!NOTE]
The power is not intended as an example of how to write shell scripts.
curl
and jq
to complete most tasks. Only a few of the more complex scenarios have other dependencies.There are hundreds of pre-baked scripts to:
You can stitch together scripts to create demos of features or rapidly test a bug or capability.
build-testcase
.The configuration file .gh-api.examples.conf
is the green fuse that drives The Power. The configuration file format is a simple list of key value pairs:
### [Branches](https://docs.github.com/en/rest/commits/commits)
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/
proposing-changes-to-your-work-with-pull-requests/about-branches
branch_name="new_branch"
protected_branch_name="main"
required_approving_reviewers=1
required_status_check_name="ci-test/this-check-is-required"
enforce_admins="false"
base_branch=main
The use of kv
pairs in .gh-api-examples.conf
provides maximum flexibility and simplicity. It allows the configuration file to provide the basic descriptors for other more advanced tools like Apache JMeter or hurl
.gh-api-examples.conf file
hurl-repo-characteristics.sh shows hurl provisioned with values .gh-api-examples.conf
:
hurl --test --variables-file .gh-api-examples.conf --json hurl-tests/repo-characteristics.hurl | jq -r
The hurl-tests/repo-characteristics
file looks like:
GET /repos//
Accept: application/vnd.github.v3+json
Authorization: token
HTTP/2 200
[Asserts]
status >= 200
status < 300
header "Content-Type" == "application/json; charset=utf-8"
header "x-github-request-id" isString
jsonpath "$.name" == ""
jsonpath "$.full_name" == "/"
There are lots of great tools like JMeter for interacting with API’s and building testsuites and many of the latest API’s come with their own interactive documentation built-in like the swagger petstore. The Power is a solution for times and places where those tools just aren’t available.