BLOG# 9 -Edible Algae System - (Growing Spirulina in space)
Developmental Unit Testing
This is my 9th blog post in a series of blog post for the Design Challenge 1 Meter of Pi
Updated version 1.2
,<<< PREVIOUS BLOG | NEX BLOG >> |
---|---|
Blog# 10 Application Implementation and Tests |
INTRODUCTION
- This blog will describe the Unit Test done on each component of the system
- the test will be broken into 2 groups Electronic and Software
- The Software Only Test section
- I will contain sections on the python code used to test the database,alerts and and timer classes from the class diagram described in Blog#8.1
- The Software/Electronic Test section
- I will Test the controller(Automation hat) and sensor(Environ Hat) classes along with the devices attached as described in Blog# 8.1
- The Software/Electronic Test section
Problem 1
I ws unable to get a circut working to connect output 1,2,3 to a working Circut containing the LED Light, WaterPump and the WaterHeater Pad.
I gesign the controller class to tun on/off these devices from the outputs of the Automation hat
I will be working on this hopefully I'l figure it out
Problem 2
With output 2 from the Automation HAT, It wil turn on but the test circut will not light the LED?
For the Controller test I have attached all 3 outputs to the test circuit that will turn ON/OFf an LED. This will allow me to Unit test the controller module. This is how I found theat output2 was not working?
Software Only Test
- This section will contain sections on the python code used to test the database,alerts and and timer clases from the class diagram described in Blog#8.1
- Each class module contains testing code which I will run and document the results
- When I was developing each class I placed a "if __name__ == __main__" at the end of each module file.
- I made sure each child class or module was working as I coded. This process is commonly refered to as Test-Driven Development (TDD)
- I will run each test and document my results
Alerts
alerts.py
--CODE
TEST run and results
- the following screenshot shows:
- THe Visual Studio run of the test script
- The test run output is display in the Terminal window beneath the code.
- the Mongodb Alerts Collection is displayed on the left, indicating that the data was saved properly.
- Later section in this blog will display the test run in this format.
Timers
timer.py
--CODE
TEST run and results
Test 1
- Showing the first timer being set and the data saved to the collection Timers
Test 2
- showing the second timer running and the data added to the colection Timers.
Test 3
- Showing the third timer running
- I did not refresh the data collection screen, so the data in the clolection is not displayed. It will be displayed in the next screenshot.
Test 4
Showing the forth and final timer running
And the 4 documents in the alerts collection view on the Left.
DATA
db.py
--CODE
TEST run and results
Test 1
- THe run of the test THere is no logging in the out.
- The MongoDB database list is shown on the left. It list all the tables created in the script. showing on document for each.
- I stated out with an empty database before this test run(I deleted all the data in the database)
- It should be noted here, that if a collection is not present in the database the insert statement will create it and put the data into it.
Test 2
- I wanted to show the putSensore() method in the screen
- I'm displaying the Light collection with the docuent inserted from the test run
Test 3
- I wanted to show the putController() method() in the screen
- I'm displaying the LedLight collection with the docuent inserted from the test run
Test 3
- I wanted to show the putAlerts() method in the screen
- I'm displaying the Alerts collection with the docuent inserted from the test run
Test 4
- I wanted to show the putTimer() method in the screen
- I'm displaying the timers collection with the docuent inserted from the test run
That does it for these three class modules. THe next section will describe the Controller and Sensor class test.
Software/Electronic Test
This section will Test the controller(Automation hat) and sensor(Environ Hat) classes along with the devices attached as described in Blog# 8.1
Sensors
sensors.py
--CODE
TEST run and results
- Environ Hat - the three sensors used for:
- Roomtemp
- RoomHumiidity
- RoomLight
- Water temp Sensor used for:
- WaterTemp
Test 1 the start of the test run
Test 2
I let the test Runn for a little while acumulating documents
Test 3 Atlass Chart Dashboard
Test 4 -- Document list
showing the number of documents in each sensor collection.
Test 5 - Atlase charts
Showing the Roomlight and the Water Tempreture during the Run
Controllers
controllers.py
--CODE
TEST run and results
The following video will show the controller test running and turning ON and OFF the Test circut LED.
Notice that the LED does not light for WaterPump on output2 even though the driver status indicated it's on.?
I spent a while trying to figure out why but had to move on.
- AutomationHat -- output 1-3
- LEDLight output1
- WaterPump output2
- WaterHeaterPad output3
- There was not enough outputs for these devices, so they are Not implemented yet. But the classes are included.
- RoomHeater
- IntakeFan
- OutTakeFan
TEST 1
- the Light section of the test script is displayed
- Shows the entire run with the LedLight collection display with the 2 documents with the on/off times
TEST 2
- The waterpump test script is shown
- the WaterPump and the WaterHeater collections are displayed on the left.
Conclusion and Summary
in this blog I ran test on the devices connected to the system and the Classes that I implemented in the previous blog# 8.1
Ans: NO
- I had problems with the following
- See above 2 problems
- Test Completed with Sucesss
- Alerts
- DB
- Timers
- Sensors
- What Test Failed and Why?
- Controller
- DId not Turn on the LED for output1 the waterpump
- Controller
- I was not able to implement the following because I was unble to get these devices connected to the Automation Hat
- Water Heater
- Water Pum
- LED Lamp
Now onto the Implementation of scripts to use these classes in my next Blog......
,<<< PREVIOUS BLOG | NEX BLOG >> |
---|---|
Blog# 10 Application Implementation and Test |
Top Comments