Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cosven/e2etest-demo
https://github.com/cosven/e2etest-demo
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/cosven/e2etest-demo
- Owner: cosven
- Created: 2021-07-13T15:21:44.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-07-22T10:15:11.000Z (over 3 years ago)
- Last Synced: 2024-12-04T05:05:06.649Z (20 days ago)
- Language: Go
- Size: 50.8 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# E2E Test Framework
## Quick Start
### Add a new test case
1. Create a new directory to save your test cases.
```sh
cd testcase
mkdir -p examples/
cd examples/
```2. Create a new ginkgo test suite.
```sh
# Install ginkgo first.
go get github.com/onsi/ginkgo/ginkgo# Create a test suite.
ginkgo bootstrap
```3. Run the test suite.
```
$ ginkgoRunning Suite: Examples Suite
=============================
Random Seed: 1626320026
Will run 0 of 0 specsRan 0 of 0 Specs in 0.001 seconds
SUCCESS! -- 0 Passed | 0 Failed | 0 Pending | 0 Skipped
PASSGinkgo ran 1 suite in 1.086402735s
Test Suite Passed
```4. Write your own test case and run it.
```sh
ginkgo generate hello_world
``````golang
$ cat hello_world_test.go
package examples_testimport (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)var _ = Describe("HelloWorld", func() {
It("should be always pass", func() {
err := error(nil)
Expect(err).ShouldNot(HaveOccurred())println("My test case 'hello world' is ok!")
})
})
```Try to run the test case.
```
$ ginkgo
Running Suite: Examples Suite
=============================
Random Seed: 1626320700
Will run 1 of 1 specs•My test case 'hello world' is ok!
Ran 1 of 1 Specs in 0.000 seconds
SUCCESS! -- 1 Passed | 0 Failed | 0 Pending | 0 Skipped
PASSGinkgo ran 1 suite in 1.174906876s
Test Suite Passed
```Actually, this E2E test framework use ginkgo to manage all the test cases.
Check [ginkgo docs](https://onsi.github.io/ginkgo/) for more details.When you want to write a test case which use [infra sdk](https://github.com/pingcap/test-infra),
you can check the example `testcase/oom/tikv_test.go`.