Skip to main content

Scenario tests with behave

Topology graph of Scenario tests with behaveTopology graph of Scenario tests with behave

Test · RemotiveCar v0.9.0

  • CAN
  • Lighting

Run it​

git clone https://github.com/remotivelabs/remotivelabs-remotive-car.git
cd remotivelabs-remotive-car

remotive topology build \
-f instances/hello_world/main.instance.yaml \
-f settings/can_over_udp.settings.instance.yaml \
build

docker compose -f build/remotive_car_hello_world/docker-compose.yml --profile behave up --build --abort-on-container-exit

Using behave to write test cases allows your domain experts to more easily understand the tests that are being run.

Start topology and run tests:

remotive topology build ...
docker compose -f ... --profile behave up --abort-on-container-exit

Optionally first start topology and then run tests (useful when writing tests)

# build and start
remotive topology build ...
docker compose -f ... up
# run tests in separate shell (dont forget --build)
docker compose -f ... up behave --build

Example with hello_world instance:

remotive topology build -f instances/hello_world/main.instance.yaml build
docker compose -f build/remotive_car_hello_world/docker-compose.yml --profile behave up --abort-on-container-exit --build

Notice:

  • Tests are run in a container as part of the topology.
  • By using a profile you can use the same instance and use the profile to control if the tests should run or not.
  • In this example the same Dockerfile is used for all python code in order to reuse the same base image. You can of course use separate Dockerfile for each container.