Byte-sized RSE: Session 3
Testing your Python Code
Session Introduction
Jeremy Cohen, EPSRC RSE Fellow, Imperial College London
Steve Crouch, SSI Research Software Group Leader, University of Southampton
The UNIVERSE-HPC (EP/W035731/1) project is funded through the ExCALIBUR programme and is a collaboration between the universities of Edinburgh, Oxford, Southampton and Imperial College London.
The content of these slides is licensed under CC-BY 4.0 © Jeremy Cohen, Imperial College London, Steve Crouch, University of Southampton.
Session Overview
Byte-sized RSE
Testing your (Python) code
The content of these slides is licensed under CC-BY 4.0 © Jeremy Cohen, Imperial College London, Steve Crouch, University of Southampton.
Testing your code - Why test your code?
The content of these slides is licensed under CC-BY 4.0 © Jeremy Cohen, Imperial College London, Steve Crouch, University of Southampton.
Byte-sized RSE
Testing your (Python) code
Testing your code
The content of these slides is licensed under CC-BY 4.0 © Jeremy Cohen, Imperial College London, Steve Crouch, University of Southampton.
Byte-sized RSE
Testing your (Python) code
Testing your code
A passing test suite (even with 100% code coverage)
DOES NOT MEAN that your code is bug free!!
(Writing tests can also be very time consuming - your initial focus should be on prioritising the most critical parts of the code - those that deliver greatest value or involve the most complexity.)
The content of these slides is licensed under CC-BY 4.0 © Jeremy Cohen, Imperial College London, Steve Crouch, University of Southampton.
Byte-sized RSE
Testing your (Python) code
Testing your code
Time for a quick quiz!...
Go to menti.com and enter code 1762 1286
The content of these slides is licensed under CC-BY 4.0 © Jeremy Cohen, Imperial College London, Steve Crouch, University of Southampton.
Byte-sized RSE
Testing your (Python) code
Types of testing - Levels
The content of these slides is licensed under CC-BY 4.0 © Jeremy Cohen, Imperial College London, Steve Crouch, University of Southampton.
Byte-sized RSE
Testing your (Python) code
Types of testing - Approaches
The content of these slides is licensed under CC-BY 4.0 © Jeremy Cohen, Imperial College London, Steve Crouch, University of Southampton.
Byte-sized RSE
Testing your (Python) code
Mocking
The content of these slides is licensed under CC-BY 4.0 © Jeremy Cohen, Imperial College London, Steve Crouch, University of Southampton.
Byte-sized RSE
Testing your (Python) code
Related best practices
The content of these slides is licensed under CC-BY 4.0 © Jeremy Cohen, Imperial College London, Steve Crouch, University of Southampton.
Byte-sized RSE
Testing your (Python) code
Testing in Python, in practice
…over to Steve for the interactive part of the session
The content of these slides is licensed under CC-BY 4.0 © Jeremy Cohen, Imperial College London, Steve Crouch, University of Southampton.
Byte-sized RSE
Testing your (Python) code