From d82c9bfc914829048f14571163edef4ebcf3087e Mon Sep 17 00:00:00 2001 From: Joonas Jauhiainen Date: Tue, 10 Dec 2024 13:10:32 +0200 Subject: [PATCH 01/10] Initial draft of the workshop exercise --- exercisefiles/robotframework/README.md | 100 ++++++++++++++++++ .../robotframework/data/metar_data.txt | 6 ++ .../robot/libraries/MetarReader.py | 4 + .../robotframework/robot/metar_test.robot | 4 + .../robot/tests/test_metarreader.py | 43 ++++++++ 5 files changed, 157 insertions(+) create mode 100644 exercisefiles/robotframework/README.md create mode 100644 exercisefiles/robotframework/data/metar_data.txt create mode 100644 exercisefiles/robotframework/robot/libraries/MetarReader.py create mode 100644 exercisefiles/robotframework/robot/metar_test.robot create mode 100644 exercisefiles/robotframework/robot/tests/test_metarreader.py diff --git a/exercisefiles/robotframework/README.md b/exercisefiles/robotframework/README.md new file mode 100644 index 0000000..e039b67 --- /dev/null +++ b/exercisefiles/robotframework/README.md @@ -0,0 +1,100 @@ +#Workflow + +1. Check with copilot that what does the data folder contain +2. Implement MetarReader.py based on tests/test_metarreader.py +3. Implement tests based on functional requirements found from this readme + + +# Functional requirements for METAR Reader + +## Data Management +- The system should read METAR data from a file and store it internally. +- Each METAR entry should be associated with a unique site identifier. +- The system should count the number of unique sites. + +## Site Existence +- The system should check if a site exists. +- The system should check if a site does not exist. +- If a site is expected to exist but does not, the system should raise an error. +- If a site is expected not to exist but does, the system should raise an error. + +## Precipitation Check +- The system should check if it is raining at a specific site. +- If it is expected to rain at a site but does not, the system should raise an error. +- If it is not expected to rain at a site but does, the system should raise an error. + +## Remarks Handling +- The system should retrieve remarks for a specific site. +- If remarks are expected for a site but do not exist, the system should raise an error. +- If remarks are not expected for a site but exist, the system should raise an error. +- The system should check if a site has a specific remark (e.g., "AO2" for precipitation sensor). + +# Test Cases + +## Metar File Contains Data +- Initially, the number of sites should be 0. +- After adding data from metar_data.txt, the number of sites should be 6. + +## Can Find Entry +- Initially, the site "KCPW" should not exist. +- Expect an error when checking if the site "KCPW" exists. +- After adding data from metar_data.txt, the site "KCPW" should exist. +- Expect an error when checking if the site "KCPW" does not exist. + +## Can Check for Rain +- Expect an error when checking if it should rain at "MYEG". +- Expect an error when checking if it should rain at "KFKA". +- After adding data from metar_data.txt, it should rain at "KFKA". +- Expect an error when checking if it should rain at "MYEG". + +## Get Remarks +- Expect an error when checking if the site "KEHY" has a precipitation sensor. +- Expect an error when checking if the site "KFDW" has a precipitation sensor. +- After adding data from metar_data.txt, the site "KEHY" should have a precipitation sensor. +- Expect an error when checking if the site "KFDW" has a precipitation sensor. +Requirements for METAR Reader +Data Management + +The system should be able to read METAR data from a file and store it internally. +Each METAR entry should be associated with a unique site identifier. +The system should be able to count the number of unique sites. +Site Existence + +The system should provide functionality to check if a site exists. +The system should provide functionality to check if a site does not exist. +If a site is expected to exist but does not, the system should raise an error. +If a site is expected not to exist but does, the system should raise an error. +Precipitation Check + +The system should provide functionality to check if it is raining at a specific site. +If it is expected to rain at a site but does not, the system should raise an error. +If it is not expected to rain at a site but does, the system should raise an error. +Remarks Handling + +The system should provide functionality to retrieve remarks for a specific site. +If remarks are expected for a site but do not exist, the system should raise an error. +If remarks are not expected for a site but exist, the system should raise an error. +The system should be able to check if a site has a specific remark (e.g., "AO2" for precipitation sensor). +Test Cases +Metar File Contains Data + +Initially, the number of sites should be 0. +After adding data from metar_data.txt, the number of sites should be 6. +Can Find Entry + +Initially, the site "KCPW" should not exist. +Expect an error when checking if the site "KCPW" exists. +After adding data from metar_data.txt, the site "KCPW" should exist. +Expect an error when checking if the site "KCPW" does not exist. +Can Check for Rain + +Expect an error when checking if it should rain at "MYEG". +Expect an error when checking if it should rain at "KFKA". +After adding data from metar_data.txt, it should rain at "KFKA". +Expect an error when checking if it should rain at "MYEG". +Get Remarks + +Expect an error when checking if the site "KEHY" has a precipitation sensor. +Expect an error when checking if the site "KFDW" has a precipitation sensor. +After adding data from metar_data.txt, the site "KEHY" should have a precipitation sensor. +Expect an error when checking if the site "KFDW" has a precipitation sensor. \ No newline at end of file diff --git a/exercisefiles/robotframework/data/metar_data.txt b/exercisefiles/robotframework/data/metar_data.txt new file mode 100644 index 0000000..8cba232 --- /dev/null +++ b/exercisefiles/robotframework/data/metar_data.txt @@ -0,0 +1,6 @@ +MYEG 251359Z AUTO 09009KT 10SM SCT029 27/20 A2998 RMK AO2 +KVTP 251358Z AUTO 23010G16KT 10SM CLR 00/M03 A3016 RMK AO2 +KEHY 251428Z AUTO 26018G25KT 10SM CLR 06/M01 A3009 RMK AO2 T00551007 +KFKA 251348Z AUTO 05009G15KT 7SM RA SCT010 BKN015 OVC044 10/08 A2977 RMK AO2 LTG DSNT E P0002 T01000075 +KCPW 251347Z AUTO 36003KT 10SM CLR 00/M07 A3025 RMK AO2 +KFDW 251355Z AUTO 22004KT 10SM CLR 29/15 A3000 RMK AO1 \ No newline at end of file diff --git a/exercisefiles/robotframework/robot/libraries/MetarReader.py b/exercisefiles/robotframework/robot/libraries/MetarReader.py new file mode 100644 index 0000000..91d62a0 --- /dev/null +++ b/exercisefiles/robotframework/robot/libraries/MetarReader.py @@ -0,0 +1,4 @@ +class MetarReader(object): + + def __init__(self): + pass \ No newline at end of file diff --git a/exercisefiles/robotframework/robot/metar_test.robot b/exercisefiles/robotframework/robot/metar_test.robot new file mode 100644 index 0000000..d881cdc --- /dev/null +++ b/exercisefiles/robotframework/robot/metar_test.robot @@ -0,0 +1,4 @@ +*** Settings *** +Library MetarReader + +*** Test Cases *** diff --git a/exercisefiles/robotframework/robot/tests/test_metarreader.py b/exercisefiles/robotframework/robot/tests/test_metarreader.py new file mode 100644 index 0000000..382d318 --- /dev/null +++ b/exercisefiles/robotframework/robot/tests/test_metarreader.py @@ -0,0 +1,43 @@ +import unittest +from metarreader import MetarReader + +class TestMetarReader(unittest.TestCase): + + def setUp(self): + self.reader = MetarReader() + self.sample_data = [ + "SITE1 RA RMK Remark1", + "SITE2 RMK Remark2", + "SITE3" + ] + self.reader._add_lines(self.sample_data) + + def test_add_data(self): + self.reader.add_data('sample_metar.txt') + self.assertEqual(self.reader.get_number_of_sites(), 3) + + def test_get_number_of_sites(self): + self.assertEqual(self.reader.get_number_of_sites(), 3) + + def test_site_should_not_exist(self): + with self.assertRaises(AssertionError): + self.reader.site_should_not_exist("SITE1") + + def test_site_should_exist(self): + self.reader.site_should_exist("SITE1") + with self.assertRaises(AssertionError): + self.reader.site_should_exist("SITE4") + + def test_it_should_rain(self): + self.reader.it_should_rain("SITE1") + with self.assertRaises(AssertionError): + self.reader.it_should_rain("SITE2") + + def test_get_remarks(self): + self.assertEqual(self.reader.get_remarks("SITE1"), ["Remark1"]) + self.assertEqual(self.reader.get_remarks("SITE2"), ["Remark2"]) + with self.assertRaises(AssertionError): + self.reader.get_remarks("SITE3") + +if __name__ == '__main__': + unittest.main() \ No newline at end of file From 9e15130ef80e5d7e80eb63b0ab29f3dd986fab16 Mon Sep 17 00:00:00 2001 From: Aleksi Simell Date: Tue, 10 Dec 2024 13:47:34 +0200 Subject: [PATCH 02/10] Improve readme syntax --- exercisefiles/robotframework/README.md | 92 +++++++++++++------------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/exercisefiles/robotframework/README.md b/exercisefiles/robotframework/README.md index e039b67..c130ea9 100644 --- a/exercisefiles/robotframework/README.md +++ b/exercisefiles/robotframework/README.md @@ -1,4 +1,4 @@ -#Workflow +# Workflow 1. Check with copilot that what does the data folder contain 2. Implement MetarReader.py based on tests/test_metarreader.py @@ -52,49 +52,51 @@ - Expect an error when checking if the site "KFDW" has a precipitation sensor. - After adding data from metar_data.txt, the site "KEHY" should have a precipitation sensor. - Expect an error when checking if the site "KFDW" has a precipitation sensor. -Requirements for METAR Reader -Data Management - -The system should be able to read METAR data from a file and store it internally. -Each METAR entry should be associated with a unique site identifier. -The system should be able to count the number of unique sites. -Site Existence - -The system should provide functionality to check if a site exists. -The system should provide functionality to check if a site does not exist. -If a site is expected to exist but does not, the system should raise an error. -If a site is expected not to exist but does, the system should raise an error. -Precipitation Check - -The system should provide functionality to check if it is raining at a specific site. -If it is expected to rain at a site but does not, the system should raise an error. -If it is not expected to rain at a site but does, the system should raise an error. + + +# Requirements for METAR Reader +## Data Management + +- The system should be able to read METAR data from a file and store it internally. +- Each METAR entry should be associated with a unique site identifier. +- The system should be able to count the number of unique sites. + +## Site Existence +- The system should provide functionality to check if a site exists. +- The system should provide functionality to check if a site does not exist. +- If a site is expected to exist but does not, the system should raise an error. +- If a site is expected not to exist but does, the system should raise an error. + +## Precipitation Check +- The system should provide functionality to check if it is raining at a specific site. +- If it is expected to rain at a site but does not, the system should raise an error. +- If it is not expected to rain at a site but does, the system should raise an error. + Remarks Handling +- The system should provide functionality to retrieve remarks for a specific site. +- If remarks are expected for a site but do not exist, the system should raise an error. +- If remarks are not expected for a site but exist, the system should raise an error. +- The system should be able to check if a site has a specific remark (e.g., "AO2" for precipitation sensor). + +# Test Cases +## Metar File Contains Data +- Initially, the number of sites should be 0. +- After adding data from metar_data.txt, the number of sites should be 6. + +## Can Find Entry +- Initially, the site "KCPW" should not exist. +- Expect an error when checking if the site "KCPW" exists. +- After adding data from metar_data.txt, the site "KCPW" should exist. +- Expect an error when checking if the site "KCPW" does not exist. -The system should provide functionality to retrieve remarks for a specific site. -If remarks are expected for a site but do not exist, the system should raise an error. -If remarks are not expected for a site but exist, the system should raise an error. -The system should be able to check if a site has a specific remark (e.g., "AO2" for precipitation sensor). -Test Cases -Metar File Contains Data - -Initially, the number of sites should be 0. -After adding data from metar_data.txt, the number of sites should be 6. -Can Find Entry - -Initially, the site "KCPW" should not exist. -Expect an error when checking if the site "KCPW" exists. -After adding data from metar_data.txt, the site "KCPW" should exist. -Expect an error when checking if the site "KCPW" does not exist. -Can Check for Rain - -Expect an error when checking if it should rain at "MYEG". -Expect an error when checking if it should rain at "KFKA". -After adding data from metar_data.txt, it should rain at "KFKA". -Expect an error when checking if it should rain at "MYEG". -Get Remarks - -Expect an error when checking if the site "KEHY" has a precipitation sensor. -Expect an error when checking if the site "KFDW" has a precipitation sensor. -After adding data from metar_data.txt, the site "KEHY" should have a precipitation sensor. -Expect an error when checking if the site "KFDW" has a precipitation sensor. \ No newline at end of file +## Can Check for Rain +- Expect an error when checking if it should rain at "MYEG". +- Expect an error when checking if it should rain at "KFKA". +- After adding data from metar_data.txt, it should rain at "KFKA". +- Expect an error when checking if it should rain at "MYEG". + +## Get Remarks +- Expect an error when checking if the site "KEHY" has a precipitation sensor. +- Expect an error when checking if the site "KFDW" has a precipitation sensor. +- After adding data from metar_data.txt, the site "KEHY" should have a precipitation sensor. +- Expect an error when checking if the site "KFDW" has a precipitation sensor. From b1c00b3b51b3b4705ae2e7fc24c5a901addc4199 Mon Sep 17 00:00:00 2001 From: Aleksi Simell Date: Tue, 10 Dec 2024 14:03:49 +0200 Subject: [PATCH 03/10] Refactor first portion of exercise --- exercisefiles/robotframework/README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/exercisefiles/robotframework/README.md b/exercisefiles/robotframework/README.md index c130ea9..d9c334c 100644 --- a/exercisefiles/robotframework/README.md +++ b/exercisefiles/robotframework/README.md @@ -1,7 +1,14 @@ -# Workflow +# METAR Reader Test Cases -1. Check with copilot that what does the data folder contain -2. Implement MetarReader.py based on tests/test_metarreader.py +## Goal + +The goal is to create Robot Framework test cases using copilot when the starting point is +only some sample data. + +## Workflow + +1. Use copilot to see what the `data` folder contains +2. Implement `MetarReader.py` based on `tests/test_metarreader.py` 3. Implement tests based on functional requirements found from this readme From 4654196caf7c6d228e509eb0289f0d078dac7065 Mon Sep 17 00:00:00 2001 From: Aleksi Simell Date: Tue, 10 Dec 2024 14:13:23 +0200 Subject: [PATCH 04/10] Fix heading levels --- exercisefiles/robotframework/README.md | 55 ++++++++++++++++---------- 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/exercisefiles/robotframework/README.md b/exercisefiles/robotframework/README.md index d9c334c..8983f5a 100644 --- a/exercisefiles/robotframework/README.md +++ b/exercisefiles/robotframework/README.md @@ -11,98 +11,113 @@ only some sample data. 2. Implement `MetarReader.py` based on `tests/test_metarreader.py` 3. Implement tests based on functional requirements found from this readme +## Functional requirements for METAR Reader -# Functional requirements for METAR Reader +### Data Management -## Data Management - The system should read METAR data from a file and store it internally. - Each METAR entry should be associated with a unique site identifier. - The system should count the number of unique sites. -## Site Existence +### Site Existence + - The system should check if a site exists. - The system should check if a site does not exist. - If a site is expected to exist but does not, the system should raise an error. - If a site is expected not to exist but does, the system should raise an error. -## Precipitation Check +### Precipitation Check + - The system should check if it is raining at a specific site. - If it is expected to rain at a site but does not, the system should raise an error. - If it is not expected to rain at a site but does, the system should raise an error. -## Remarks Handling +### Remarks Handling + - The system should retrieve remarks for a specific site. - If remarks are expected for a site but do not exist, the system should raise an error. - If remarks are not expected for a site but exist, the system should raise an error. - The system should check if a site has a specific remark (e.g., "AO2" for precipitation sensor). -# Test Cases +## Test Cases + +### METAR File Contains Data -## Metar File Contains Data - Initially, the number of sites should be 0. - After adding data from metar_data.txt, the number of sites should be 6. -## Can Find Entry +### Can Find Entry + - Initially, the site "KCPW" should not exist. - Expect an error when checking if the site "KCPW" exists. - After adding data from metar_data.txt, the site "KCPW" should exist. - Expect an error when checking if the site "KCPW" does not exist. -## Can Check for Rain +### Can Check for Rain + - Expect an error when checking if it should rain at "MYEG". - Expect an error when checking if it should rain at "KFKA". - After adding data from metar_data.txt, it should rain at "KFKA". - Expect an error when checking if it should rain at "MYEG". -## Get Remarks +### Get Remarks + - Expect an error when checking if the site "KEHY" has a precipitation sensor. - Expect an error when checking if the site "KFDW" has a precipitation sensor. - After adding data from metar_data.txt, the site "KEHY" should have a precipitation sensor. - Expect an error when checking if the site "KFDW" has a precipitation sensor. +## Requirements for METAR Reader -# Requirements for METAR Reader -## Data Management +### Data Management - The system should be able to read METAR data from a file and store it internally. - Each METAR entry should be associated with a unique site identifier. - The system should be able to count the number of unique sites. -## Site Existence +### Site Existence + - The system should provide functionality to check if a site exists. - The system should provide functionality to check if a site does not exist. - If a site is expected to exist but does not, the system should raise an error. - If a site is expected not to exist but does, the system should raise an error. -## Precipitation Check +### Precipitation Check + - The system should provide functionality to check if it is raining at a specific site. - If it is expected to rain at a site but does not, the system should raise an error. - If it is not expected to rain at a site but does, the system should raise an error. -Remarks Handling +### Remarks Handling + - The system should provide functionality to retrieve remarks for a specific site. - If remarks are expected for a site but do not exist, the system should raise an error. - If remarks are not expected for a site but exist, the system should raise an error. - The system should be able to check if a site has a specific remark (e.g., "AO2" for precipitation sensor). -# Test Cases -## Metar File Contains Data +## Test Cases + +### METAR File Contains Data + - Initially, the number of sites should be 0. - After adding data from metar_data.txt, the number of sites should be 6. -## Can Find Entry +### Can Find Entry + - Initially, the site "KCPW" should not exist. - Expect an error when checking if the site "KCPW" exists. - After adding data from metar_data.txt, the site "KCPW" should exist. - Expect an error when checking if the site "KCPW" does not exist. -## Can Check for Rain +### Can Check for Rain + - Expect an error when checking if it should rain at "MYEG". - Expect an error when checking if it should rain at "KFKA". - After adding data from metar_data.txt, it should rain at "KFKA". - Expect an error when checking if it should rain at "MYEG". -## Get Remarks +### Get Remarks + - Expect an error when checking if the site "KEHY" has a precipitation sensor. - Expect an error when checking if the site "KFDW" has a precipitation sensor. - After adding data from metar_data.txt, the site "KEHY" should have a precipitation sensor. From 3cfc5446ce1f85be4cc99473f29e65018802cbd0 Mon Sep 17 00:00:00 2001 From: Aleksi Simell Date: Tue, 10 Dec 2024 15:35:22 +0200 Subject: [PATCH 05/10] Clarify exercise syntax --- exercisefiles/robotframework/README.md | 142 ++++++++----------------- 1 file changed, 46 insertions(+), 96 deletions(-) diff --git a/exercisefiles/robotframework/README.md b/exercisefiles/robotframework/README.md index 8983f5a..2ad3adb 100644 --- a/exercisefiles/robotframework/README.md +++ b/exercisefiles/robotframework/README.md @@ -11,114 +11,64 @@ only some sample data. 2. Implement `MetarReader.py` based on `tests/test_metarreader.py` 3. Implement tests based on functional requirements found from this readme -## Functional requirements for METAR Reader +## Exericses -### Data Management +### Use copilot to see what the `data` folder contains -- The system should read METAR data from a file and store it internally. -- Each METAR entry should be associated with a unique site identifier. -- The system should count the number of unique sites. +Take a look at the `data` folder and ask copilot to explain what it contains. See how +copilot can identify the contents and parse it for you using just the sample data. -### Site Existence +### Implement `MetarReader.py` based on `tests/test_metarreader.py` -- The system should check if a site exists. -- The system should check if a site does not exist. -- If a site is expected to exist but does not, the system should raise an error. -- If a site is expected not to exist but does, the system should raise an error. +The `MetarReader` library needs to satisfy the following functional requirements: -### Precipitation Check +- **Data Management** + - The system should read METAR data from a file and store it internally. + - Each METAR entry should be associated with a unique site identifier. + - The system should count the number of unique sites. -- The system should check if it is raining at a specific site. -- If it is expected to rain at a site but does not, the system should raise an error. -- If it is not expected to rain at a site but does, the system should raise an error. +- **Site Existence** + - The system should check if a site exists. + - The system should check if a site does not exist. + - If a site is expected to exist but does not, the system should raise an error. + - If a site is expected not to exist but does, the system should raise an error. -### Remarks Handling +- **Precipitation Check** + - The system should check if it is raining at a specific site. + - If it is expected to rain at a site but does not, the system should raise an error. + - If it is not expected to rain at a site but does, the system should raise an error. -- The system should retrieve remarks for a specific site. -- If remarks are expected for a site but do not exist, the system should raise an error. -- If remarks are not expected for a site but exist, the system should raise an error. -- The system should check if a site has a specific remark (e.g., "AO2" for precipitation sensor). +- **Remarks Handling** + - The system should retrieve remarks for a specific site. + - If remarks are expected for a site but do not exist, the system should raise an error. + - If remarks are not expected for a site but exist, the system should raise an error. + - The system should check if a site has a specific remark (e.g., "AO2" for precipitation sensor). -## Test Cases +The unit tests for the `MetarReader` library are already implemented in +`tests/test_metarreader.py`. -### METAR File Contains Data +### Implement Robot Framework tests based on functional requirements -- Initially, the number of sites should be 0. -- After adding data from metar_data.txt, the number of sites should be 6. +The Robot Framework must test the following test cases: -### Can Find Entry +- **METAR File Contains Data** + - Initially, the number of sites should be `0`. + - After adding data from `metar_data.txt`, the number of sites should be `6`. -- Initially, the site "KCPW" should not exist. -- Expect an error when checking if the site "KCPW" exists. -- After adding data from metar_data.txt, the site "KCPW" should exist. -- Expect an error when checking if the site "KCPW" does not exist. +- **Can Find Entry** + - Initially, the site `KCPW` should not exist. + - Expect an error when checking if the site `KCPW` exists. + - After adding data from metar_data.txt, the site `KCPW` should exist. + - Expect an error when checking if the site `KCPW` does not exist. -### Can Check for Rain +- **Can Check for Rain** + - Expect an error when checking if it should rain at `MYEG`. + - Expect an error when checking if it should rain at `KFKA`. + - After adding data from `metar_data.txt`, it should rain at `KFKA`. + - Expect an error when checking if it should rain at `MYEG`. -- Expect an error when checking if it should rain at "MYEG". -- Expect an error when checking if it should rain at "KFKA". -- After adding data from metar_data.txt, it should rain at "KFKA". -- Expect an error when checking if it should rain at "MYEG". - -### Get Remarks - -- Expect an error when checking if the site "KEHY" has a precipitation sensor. -- Expect an error when checking if the site "KFDW" has a precipitation sensor. -- After adding data from metar_data.txt, the site "KEHY" should have a precipitation sensor. -- Expect an error when checking if the site "KFDW" has a precipitation sensor. - -## Requirements for METAR Reader - -### Data Management - -- The system should be able to read METAR data from a file and store it internally. -- Each METAR entry should be associated with a unique site identifier. -- The system should be able to count the number of unique sites. - -### Site Existence - -- The system should provide functionality to check if a site exists. -- The system should provide functionality to check if a site does not exist. -- If a site is expected to exist but does not, the system should raise an error. -- If a site is expected not to exist but does, the system should raise an error. - -### Precipitation Check - -- The system should provide functionality to check if it is raining at a specific site. -- If it is expected to rain at a site but does not, the system should raise an error. -- If it is not expected to rain at a site but does, the system should raise an error. - -### Remarks Handling - -- The system should provide functionality to retrieve remarks for a specific site. -- If remarks are expected for a site but do not exist, the system should raise an error. -- If remarks are not expected for a site but exist, the system should raise an error. -- The system should be able to check if a site has a specific remark (e.g., "AO2" for precipitation sensor). - -## Test Cases - -### METAR File Contains Data - -- Initially, the number of sites should be 0. -- After adding data from metar_data.txt, the number of sites should be 6. - -### Can Find Entry - -- Initially, the site "KCPW" should not exist. -- Expect an error when checking if the site "KCPW" exists. -- After adding data from metar_data.txt, the site "KCPW" should exist. -- Expect an error when checking if the site "KCPW" does not exist. - -### Can Check for Rain - -- Expect an error when checking if it should rain at "MYEG". -- Expect an error when checking if it should rain at "KFKA". -- After adding data from metar_data.txt, it should rain at "KFKA". -- Expect an error when checking if it should rain at "MYEG". - -### Get Remarks - -- Expect an error when checking if the site "KEHY" has a precipitation sensor. -- Expect an error when checking if the site "KFDW" has a precipitation sensor. -- After adding data from metar_data.txt, the site "KEHY" should have a precipitation sensor. -- Expect an error when checking if the site "KFDW" has a precipitation sensor. +- **Get Remarks** + - Expect an error when checking if the site `KEHY` has a precipitation sensor. + - Expect an error when checking if the site `KFDW` has a precipitation sensor. + - After adding data from `metar_data.txt`, the site `KEHY` should have a precipitation sensor. + - Expect an error when checking if the site `KFDW` has a precipitation sensor. From 98d6be9980b2b52a02dfc49eff5ae5cc6a16478d Mon Sep 17 00:00:00 2001 From: Aleksi Simell Date: Tue, 10 Dec 2024 15:36:15 +0200 Subject: [PATCH 06/10] Remove duplicate info --- exercisefiles/robotframework/README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/exercisefiles/robotframework/README.md b/exercisefiles/robotframework/README.md index 2ad3adb..22ac12b 100644 --- a/exercisefiles/robotframework/README.md +++ b/exercisefiles/robotframework/README.md @@ -5,12 +5,6 @@ The goal is to create Robot Framework test cases using copilot when the starting point is only some sample data. -## Workflow - -1. Use copilot to see what the `data` folder contains -2. Implement `MetarReader.py` based on `tests/test_metarreader.py` -3. Implement tests based on functional requirements found from this readme - ## Exericses ### Use copilot to see what the `data` folder contains From 136e6cc439ff76ffa17ecb42d282eb67886d5a3b Mon Sep 17 00:00:00 2001 From: Aleksi Simell Date: Tue, 10 Dec 2024 15:36:49 +0200 Subject: [PATCH 07/10] Add exercise numbers --- exercisefiles/robotframework/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exercisefiles/robotframework/README.md b/exercisefiles/robotframework/README.md index 22ac12b..2f7371c 100644 --- a/exercisefiles/robotframework/README.md +++ b/exercisefiles/robotframework/README.md @@ -7,12 +7,12 @@ only some sample data. ## Exericses -### Use copilot to see what the `data` folder contains +### 1. Use copilot to see what the `data` folder contains Take a look at the `data` folder and ask copilot to explain what it contains. See how copilot can identify the contents and parse it for you using just the sample data. -### Implement `MetarReader.py` based on `tests/test_metarreader.py` +### 2. Implement `MetarReader.py` based on `tests/test_metarreader.py` The `MetarReader` library needs to satisfy the following functional requirements: @@ -41,7 +41,7 @@ The `MetarReader` library needs to satisfy the following functional requirements The unit tests for the `MetarReader` library are already implemented in `tests/test_metarreader.py`. -### Implement Robot Framework tests based on functional requirements +### 3. Implement Robot Framework tests based on functional requirements The Robot Framework must test the following test cases: From 70f2736c14a9d695d9e47d5da36c994f09936329 Mon Sep 17 00:00:00 2001 From: Aleksi Simell Date: Wed, 11 Dec 2024 08:30:02 +0200 Subject: [PATCH 08/10] Include the name of the robot file --- exercisefiles/robotframework/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercisefiles/robotframework/README.md b/exercisefiles/robotframework/README.md index 2f7371c..814c3f2 100644 --- a/exercisefiles/robotframework/README.md +++ b/exercisefiles/robotframework/README.md @@ -43,7 +43,7 @@ The unit tests for the `MetarReader` library are already implemented in ### 3. Implement Robot Framework tests based on functional requirements -The Robot Framework must test the following test cases: +The Robot Framework test suite `metar_test.robot` must test the following cases: - **METAR File Contains Data** - Initially, the number of sites should be `0`. @@ -64,5 +64,5 @@ The Robot Framework must test the following test cases: - **Get Remarks** - Expect an error when checking if the site `KEHY` has a precipitation sensor. - Expect an error when checking if the site `KFDW` has a precipitation sensor. - - After adding data from `metar_data.txt`, the site `KEHY` should have a precipitation sensor. + - After adding data from `metar_data.txt`, the site `KEHY` should have a precipitation sensor. - Expect an error when checking if the site `KFDW` has a precipitation sensor. From 350d38eb508af3232228d965ba9f5cf6f49c2a54 Mon Sep 17 00:00:00 2001 From: Aleksi Simell Date: Wed, 11 Dec 2024 09:32:03 +0200 Subject: [PATCH 09/10] Add note about keyword decorator --- exercisefiles/robotframework/README.md | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/exercisefiles/robotframework/README.md b/exercisefiles/robotframework/README.md index 814c3f2..22bd831 100644 --- a/exercisefiles/robotframework/README.md +++ b/exercisefiles/robotframework/README.md @@ -12,6 +12,8 @@ only some sample data. Take a look at the `data` folder and ask copilot to explain what it contains. See how copilot can identify the contents and parse it for you using just the sample data. +--- + ### 2. Implement `MetarReader.py` based on `tests/test_metarreader.py` The `MetarReader` library needs to satisfy the following functional requirements: @@ -39,7 +41,12 @@ The `MetarReader` library needs to satisfy the following functional requirements - The system should check if a site has a specific remark (e.g., "AO2" for precipitation sensor). The unit tests for the `MetarReader` library are already implemented in -`tests/test_metarreader.py`. +`tests/test_metarreader.py`. Once your library is ready, the unit tests should pass. + +To increase readability of the library, ensure the methods that are intended to be keywords +have the `robot.api.deco.keyword` decorator. + +--- ### 3. Implement Robot Framework tests based on functional requirements From 9f140e33ca7f0226febd347db2dbf74ae9de27a5 Mon Sep 17 00:00:00 2001 From: Aleksi Simell Date: Wed, 11 Dec 2024 09:34:25 +0200 Subject: [PATCH 10/10] Add final newline --- exercisefiles/robotframework/robot/libraries/MetarReader.py | 4 ++-- exercisefiles/robotframework/robot/tests/test_metarreader.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/exercisefiles/robotframework/robot/libraries/MetarReader.py b/exercisefiles/robotframework/robot/libraries/MetarReader.py index 91d62a0..22e1229 100644 --- a/exercisefiles/robotframework/robot/libraries/MetarReader.py +++ b/exercisefiles/robotframework/robot/libraries/MetarReader.py @@ -1,4 +1,4 @@ class MetarReader(object): - + def __init__(self): - pass \ No newline at end of file + pass diff --git a/exercisefiles/robotframework/robot/tests/test_metarreader.py b/exercisefiles/robotframework/robot/tests/test_metarreader.py index 382d318..9a5d181 100644 --- a/exercisefiles/robotframework/robot/tests/test_metarreader.py +++ b/exercisefiles/robotframework/robot/tests/test_metarreader.py @@ -40,4 +40,4 @@ def test_get_remarks(self): self.reader.get_remarks("SITE3") if __name__ == '__main__': - unittest.main() \ No newline at end of file + unittest.main()