TA engineers usually don’t write source code (SUT) and therefore are often not involved in unit testing. Firstly, I’ll address this issue by explaining how this originated and why it’s an issue. To lower the threshold, I’ll compare ‘what we already do’ (UI/API testing) to ‘what we often not do’ (unit testing) by answering the following questions:  Can TA engineers review and improve (unit) test code?  Is the significant difference between UI/API testing and unit testing just the abstraction layer (like selenium code VS class instances and methods)?  Are unit tests using the same libraries, runners, assertions and reporters?

Secondly, I’ll explain how research- and (data) science projects are more difficult to test because of 2 main reasons: 1) They lack (testable) interfaces and often come as packaged modules and scripts or even as (jupiter) notebooks. 2) They often use complex data structures like NumPy arrays, data frames (and more) as input parameters for methods and functions. Writing (I/O) unit tests is painful because each input example needs so much preparation.

In the last part I tell how I managed to get developers and scientists/researchers less opposed to the (considered) ‘hideous’ art of unit testing and how I had to find them a technique that could solve the data preparation issue. Now I’ll introduce ‘property-based-testing’ by explaining the different approach: Describing (I/O) properties VS specifying (I/O). With Python code examples I’ll show how one test can run hundreds of times with different inputs matching the described properties to find bugs by coming up with edge cases you may not have thought of.

Wrapping up I’ll state that PBT isn’t a substitute for I/O testing, but how it has proven to be a technique that solves common objections on unit testing for me. That’s why this talk will be an eye-opener for anyone.

Ewald Verhoeven, Consultant Test Automation & Quality at TestCoders will host the session B4 “Crossing the threshold: Test automation for research- and (data) science code” on Thursday June 16. Interested to see more of the program? Visit the program page!

Meet world’s leading Test Automation experts!
Register now and ensure your place at this unique conference. Get a combi ticket for a fee of € 840,- or register for Day 1 for € 495,- or for Day 2 for € 395,-.