1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-11 07:06:16 +01:00
github.com_openSUSE_osc/behave/README.md

91 lines
2.0 KiB
Markdown
Raw Normal View History

Install requirements
--------------------
2022-01-24 09:57:40 +01:00
On openSUSE:
```
$ zypper install osc podman python3-behave
2022-01-24 09:57:40 +01:00
```
On Fedora:
2022-01-24 09:57:40 +01:00
```
$ dnf install osc podman python3-behave
```
Build a container with OBS
--------------------------
2022-01-24 09:57:40 +01:00
```
$ cd behave
2022-01-24 09:57:40 +01:00
# optional: refresh the base image
$ podman pull opensuse/leap:15.4
2022-01-24 09:57:40 +01:00
# build the container image
$ ./container-build.sh [--no-cache]
```
2022-01-24 09:57:40 +01:00
We can also use the built container outside the test suite
2022-01-24 09:57:40 +01:00
```
$ cd behave
# run 'obs-server' container on port 1443
$ ./container-run.sh
# shell into the started container
$ ./container-shell.sh
# stop the started container
$ podman stop|kill obs-server
# remove container image
$ podman rmi obs-server
2022-01-24 09:57:40 +01:00
```
Run tests
---------
Run all tests
2022-01-24 09:57:40 +01:00
```
$ cd behave
$ behave -Dosc=../osc-wrapper.py
2022-01-24 09:57:40 +01:00
```
Run selected tests
2022-01-24 09:57:40 +01:00
```
$ cd behave
$ behave -Dosc=../osc-wrapper.py features/<file>.feature
2022-01-24 09:57:40 +01:00
```
Run tests being worked on (decorated with `@wip`)
2022-01-24 09:57:40 +01:00
```
$ cd behave
behave -Dosc=../osc-wrapper.py --wip -k
2022-01-24 09:57:40 +01:00
```
Filesystem layout
-----------------
```
<project topdir>
+- behave
+- features
+- *.feature # tests (that use steps defined in the `steps` directory)
# * https://behave.readthedocs.io/en/stable/tutorial.html#feature-files
+- environment.py # code that runs before/after certain events (steps, features, etc.)
# * https://behave.readthedocs.io/en/stable/tutorial.html#environmental-controls
# * frequently used to modify ``context``
+- steps # step definitions, support code
# * https://behave.readthedocs.io/en/stable/tutorial.html#python-step-implementations
+- fixtures # test data
+- * # additional support files
```
Good to know
------------
* `context` provides state information to the tests; you can think of it as passing `self` to python methods.
* `context.config.userdata` contains values of defines specified on the command-line:
``-D NAME=VALUE`` -> ``context.config.userdata[NAME] = VALUE``