Closed Hayden-Reeve closed 5 years ago
Update:
All devices I checked (6/8) are using T_restore and dT_hold_limit so I will update the report as such.
PV past the test when start and current time =now and ts is ~1 sec. However, it did not pass when using an older start-time/current time and 30 second timestep. Will create separate issue for this.
Electrolyzer fleet at one point divides a parameter by P_request. So if P_request = zero (a valid input) it crashes. Will put in separate issue tracker.
@Hayden-Reeve The template looks good to me. In practice, the unit tests should be done and used by device developers instead of test.py in each device fleet folder.
@hlngo , @emayhorn , @DavidWiniarski-pnnl (cc: @afernandezcanosa , @jmaguire1 , @raselmahmud02 , @raselmahmud02 , @ORNLJD )
I have updated the test_unit.py PR with the latest tests implemented (including frequency response, forecasts, fleet scaling etc). Please feel free to try it out and provide feedback.
I still plan to implement parametric testing of timesteps and timestamps and I need to spend some time verifying (and improving) how variables are assigned in these test classes to make sure variable settings in one test set do not contaminate another. I also hope to speed it up. Probably won't get to that this week before Peer Review.
@hlngo - please merge these files.
@hlngo , @emayhorn , @DavidWiniarski-pnnl ,
I have created the basis of a unit test file to automate and formalize the testing we are doing for the assignments. To start with I am focusing on the device API returned variables (there are 23 in total). Please let me know your thoughts (as I am still new to unit testing in Python). In the future I would like to extend this to other tests (timestamp and step testing, self-consistency checks on the P-togrid and P_service etc) and use pytest and hypothesis for greater capability.
For the API testing a couple of issues have come up that we can discuss in the team meeting tomorrow.
I am testing to a requirement that assertIsNotNone. Is this too strict a test? For EVs and Fuelcells SOC_cost, C and Strike_price are 'none'. Not sure is this is sufficient.
The test will also differentiate missing parameters. In this case dt_hold_limit and ts_restore are named different in the report than the EV and FuelCell cases (T_restore and dT_hold_limit). If the later is common across all devices and services I will update the report.
The unit test is not running successfully with all device fleets. I need to debug this.