|
| 1 | +# METAR Reader Test Cases |
| 2 | + |
| 3 | +## Goal |
| 4 | + |
| 5 | +The goal is to create Robot Framework test cases using copilot when the starting point is |
| 6 | +only some sample data. |
| 7 | + |
| 8 | +## Exericses |
| 9 | + |
| 10 | +### 1. Use copilot to see what the `data` folder contains |
| 11 | + |
| 12 | +Take a look at the `data` folder and ask copilot to explain what it contains. See how |
| 13 | +copilot can identify the contents and parse it for you using just the sample data. |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +### 2. Implement `MetarReader.py` based on `tests/test_metarreader.py` |
| 18 | + |
| 19 | +The `MetarReader` library needs to satisfy the following functional requirements: |
| 20 | + |
| 21 | +- **Data Management** |
| 22 | + - The system should read METAR data from a file and store it internally. |
| 23 | + - Each METAR entry should be associated with a unique site identifier. |
| 24 | + - The system should count the number of unique sites. |
| 25 | + |
| 26 | +- **Site Existence** |
| 27 | + - The system should check if a site exists. |
| 28 | + - The system should check if a site does not exist. |
| 29 | + - If a site is expected to exist but does not, the system should raise an error. |
| 30 | + - If a site is expected not to exist but does, the system should raise an error. |
| 31 | + |
| 32 | +- **Precipitation Check** |
| 33 | + - The system should check if it is raining at a specific site. |
| 34 | + - If it is expected to rain at a site but does not, the system should raise an error. |
| 35 | + - If it is not expected to rain at a site but does, the system should raise an error. |
| 36 | + |
| 37 | +- **Remarks Handling** |
| 38 | + - The system should retrieve remarks for a specific site. |
| 39 | + - If remarks are expected for a site but do not exist, the system should raise an error. |
| 40 | + - If remarks are not expected for a site but exist, the system should raise an error. |
| 41 | + - The system should check if a site has a specific remark (e.g., "AO2" for precipitation sensor). |
| 42 | + |
| 43 | +The unit tests for the `MetarReader` library are already implemented in |
| 44 | +`tests/test_metarreader.py`. Once your library is ready, the unit tests should pass. |
| 45 | + |
| 46 | +To increase readability of the library, ensure the methods that are intended to be keywords |
| 47 | +have the `robot.api.deco.keyword` decorator. |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +### 3. Implement Robot Framework tests based on functional requirements |
| 52 | + |
| 53 | +The Robot Framework test suite `metar_test.robot` must test the following cases: |
| 54 | + |
| 55 | +- **METAR File Contains Data** |
| 56 | + - Initially, the number of sites should be `0`. |
| 57 | + - After adding data from `metar_data.txt`, the number of sites should be `6`. |
| 58 | + |
| 59 | +- **Can Find Entry** |
| 60 | + - Initially, the site `KCPW` should not exist. |
| 61 | + - Expect an error when checking if the site `KCPW` exists. |
| 62 | + - After adding data from metar_data.txt, the site `KCPW` should exist. |
| 63 | + - Expect an error when checking if the site `KCPW` does not exist. |
| 64 | + |
| 65 | +- **Can Check for Rain** |
| 66 | + - Expect an error when checking if it should rain at `MYEG`. |
| 67 | + - Expect an error when checking if it should rain at `KFKA`. |
| 68 | + - After adding data from `metar_data.txt`, it should rain at `KFKA`. |
| 69 | + - Expect an error when checking if it should rain at `MYEG`. |
| 70 | + |
| 71 | +- **Get Remarks** |
| 72 | + - Expect an error when checking if the site `KEHY` has a precipitation sensor. |
| 73 | + - Expect an error when checking if the site `KFDW` has a precipitation sensor. |
| 74 | + - After adding data from `metar_data.txt`, the site `KEHY` should have a precipitation sensor. |
| 75 | + - Expect an error when checking if the site `KFDW` has a precipitation sensor. |
0 commit comments