Skip to content

Commit

Permalink
chore(examples): Add simple README w instructions
Browse files Browse the repository at this point in the history
This should hopefully make it clear how to use the given example

Signed-off-by: Stefan Kraus <[email protected]>
  • Loading branch information
MP-StefanKraus authored and schlotter committed Sep 17, 2024
1 parent 8fc6e25 commit 9d35993
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
57 changes: 57 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Fretish robot examples

This folder contains some examples to demonstrate the use of `fret-to-robot`.

## Preparation

You should be familiar with Zephyr and the basic setup as described in the
(Getting Started Guide)[https://docs.zephyrproject.org/latest/develop/getting_started/index.html].

For a setup in an example, create a virtual environment, source it, and install `west` (Step 1 - 5)
in the Getting Started Guide.

Now, also install the `fretish_robot` library. If you are in the current directory, do
this by calling

```
pip install ../
```

Then, create a new workspace for the example by calling (e.g. for digital_microscope)

```sh
west init -l digital_microscope
west update
```

This also fetches a zephyr with (currently custom) `robotframework` harness support for twister, and all
necessary modules

## Creating tests for example

To create robot tests for an example, move into the `assets` folder of the example and call `fret-to-robot`
properly. For example:

```sh
fret-to-robot req_fret.json --extra-libraries DigitalMicroscopeLib
```

The `extra-libraries` argument is necessary as we implement keyword functionality in a library
called `DigitalMicroscopeLib` (see `assets/robot_files/DigitalMicroscopeLib.py`)

Now, the generated files can be found in `assets/robot_files/tests.robot`

## Execute tests

Now, you can execute the tests with a proper twister execution.

To execute all tests for `native_sim_64` platform, do

```
PYTHONPATH=digital_microscope/assets/robot_files west twister -p native_sim_64 -vvv -c -T digital_microscope/
```

The setting of `PYTHONPATH` is necessary as we have a custom library for implementation,
`-vvv` makes it more verbose to see progress.

Afterwards, the results of the test executions are shown (4 of 15 fail, as `always` FRET keyword is not implemented)
8 changes: 8 additions & 0 deletions examples/digital_microscope/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Digital Microscope

This is a simple example of a digital microscope that functioned as an
example in the conference talk "Level Up Your Embedded Testing Game:
FRETish, Robot, and Twister: A Dream Team" on the "Open Source Summit Europe 2024"

This is just for illustration purposes of FRET to RobotFramework tests
and does not guarantee correctness or best-practices of Zephyr.

0 comments on commit 9d35993

Please sign in to comment.