Published on February 2, 2014
Retro Testing Allon Mureinik Team Lead, Cloud Storage, Red Hat email@example.com / @mureinik January 2014 Allon Mureinik - Retro Testing 1
TDD Is Easy... Allon Mureinik - Retro Testing 2
... or is it? ● The first two part should be ● Write a test ● Make sure it fails ● The question is why it fails. ● In a legacy system, it will often fail for “bad” reasons: ● Unable to access the database ● Some static resource not set up ● Need to spin up an application server ● Etc., etc., etc... Allon Mureinik - Retro Testing 3
Will the mistakes of the past haunt me forever? Allon Mureinik - Retro Testing 4
It’s not an all-or-nothing situation Allon Mureinik - Retro Testing 5
One baby step at a time Allon Mureinik - Retro Testing 6
Refactor, refactor, refactor ● ● Your first task would probably be to do some refactoring Resist the urge to improve the code ● ● Frankly, this step may make the code look worse Your only goal here is to create an opportunity to write tests Allon Mureinik - Retro Testing 7
Refacroting with no tests is like... Allon Mureinik - Retro Testing 8
Example : Bad Code Allon Mureinik - Retro Testing 9
Some minimal refactoring Allon Mureinik - Retro Testing 10
Now we can start writing tests... ● ● Now we have the tools to separate external resources from logic There are a couple of ways to do so: ● Override the relevant methods in your test ● Use Mockito/EasyMock to spy the tested object ● Use @Rules to set up common mocking once Allon Mureinik - Retro Testing 11
I @Spy With My Little Eye Allon Mureinik - Retro Testing 12
Some more refactoring Allon Mureinik - Retro Testing 13
Let’s modernize our code Allon Mureinik - Retro Testing 14
But how can I write asserts? ● Overriding, mocking and all that jazz are fine and well ● But any test boils down to writing an assert... ● ... and I have no idea what this function is supposed to do ● Remember this is a legacy system ● You may not need to test it for correctness ... ● Just for backwards compatibility Allon Mureinik - Retro Testing 15
Allon Mureinik - Retro Testing 16
The real challenge is changing mindset ● We can discusses refactoring till we’re blue in the face ● But the real challenge isn’t changing the way we code ● It’s changing the way we approach the problem Allon Mureinik - Retro Testing 17
It’s all too easy to slip back to bad habits ● This bug is blocking the release... ● It’s a ton of work to refactor this logic out... ● The rest of the code is bad anyway... Allon Mureinik - Retro Testing 18
Have the courage to stand up to excuses Allon Mureinik - Retro Testing 19
Questions? Allon Mureinik - Retro Testing 20
Jack Breckner Jan. 2014 measurements, movement, and testing ... Published on Jan 13, 2014. measurements, movement drills, and testing footage ...
JAN -2 2014 Premarked Notification 510(k) ... (060832 Retro-Tech, ... The above testing demonstrates that the Hydrofera Blue PU Antibacterial Wound
Retro. MENS; WOMENS; DENIM; SHOES; ACCESSORIES; Lookbook; Campaign; 1. 2. Prev Next. 1. 2. 3. 4. Prev Next . TAVASZI/ NYÁRI KOLLEKCIÓNK ELÉRHETŐ ...
Ghetto retro testrig. Testing old highend 3DFX, ... Published on Jan 1, 2014. In this video I test some new video cards! 3DFX Voodoo3 3000 3500
Release Date: 05/26/2014 Price: $150 ... Air Jordan 10 Retro “Bobcats ...
Air Jordan 10 - 2014 New Retro Teaser. Jul 22, 2013 11:45 PM 66,462 views ...
Multiple Blower Door tests of Large Buildings from 4 Pros who’ve performed over 1000 tests (Jan 28, 2016) ... Testing for peak pressures and hold times.
Trend Micro Titanium Maximum Security 2014: Protection. Performance. Usability. Bitdefender Endpoint Security 5.3: ... Testing Facilities Products ...