Dev Thoughts

Musings from my development journey.

Topics

How to Write Better Code Using Mutation Testing

large

Talk by John Backus at Rails Conf 2017.

Mutation Coverage

"The idea is that if code can be changed and your tests do not notice, then either that code isn't being covered or it does not have a speced side effect." - mbj

mutant gem automatically checks for mutation coverage in order to improve the test suite.

Implementation can help to assist with crafting more strict interfaces for a program. Examples can be: forcing type casting, raising errors instead of failing silently, and structuring dates.

Other use cases are for hardening Regular Expressions to catch pattern matching edge cases.

Additionally, mutation coverage can help with cleaning up API service calls.

Legacy Code Refactoring

  • Can help finding an original dev's intent
  • Can reveal how the component is being used currently
  • Supplies a checklist prior to modifying legacy code

Mutation testing also assists with detecting dead code.

Benefits

  • Learning faster
  • Shipping with fewer bugs
  • Fewer regression issues
  • Writing simpler code
6205288ecbfff3df3e44008f296d7d76
Eskeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeetit
Comment posted by Ducko almost 3 years ago
6f560065e46f26926e606868731ea15c
asdddssssssssssssssaaaaaaaaaaaaaaa
Comment posted by Soner over 2 years ago
6f560065e46f26926e606868731ea15c
ben bsoodsadsa sjiadjasi
Comment posted by Soner over 2 years ago
6f560065e46f26926e606868731ea15c
dssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
Comment posted by Soner over 2 years ago
6f560065e46f26926e606868731ea15c
xcsdads sdsadsa dsadsadasdsads sadsadsdas sdadsasdassda sadasdadsa
Comment posted by Soner over 2 years ago
7a1bbb84db3e763b15cf8295265636a7
123123123
Comment posted by Juan over 2 years ago
7a1bbb84db3e763b15cf8295265636a7
12312312312312312312312312312312312312312222222222222222222222222222222222222222222222222222222222222222222222222222222
Comment posted by Juan over 2 years ago
8872afa72f5176b15f6ef4b6569f0242
hello
Comment posted by nha over 1 year ago
8872afa72f5176b15f6ef4b6569f0242
hello
Comment posted by nha over 1 year ago
B0aa3b0f6fc4e854a2aed690392bf1c8
mvmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Comment posted by Mahak 5 months ago
B0aa3b0f6fc4e854a2aed690392bf1c8
RandomText is a tool designers and developers can use to quickly grab dummy text in either Lorem Ipsum or Gibberish format.
Comment posted by Mahak 5 months ago
B0aa3b0f6fc4e854a2aed690392bf1c8
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Sit amet venenatis urna cursus eget nunc. Faucibus turpis in eu mi bibendum. Egestas sed sed risus pretium. Pharetra magna ac placerat vestibulum lectus. Purus faucibus ornare suspendisse sed nisi lacus. Diam sollicitudin tempor id eu nisl nunc. Morbi tristique senectus et netus et malesuada fames ac turpis. Ut sem nulla pharetra diam sit. Ut lectus arcu bibendum at. Mi proin sed libero enim. Amet massa vitae tortor condimentum lacinia quis vel eros. Sit amet justo donec enim diam vulputate ut pharetra. Tortor vitae purus faucibus ornare suspendisse sed nisi lacus. Nulla facilisi cras fermentum odio eu feugiat pretium nibh ipsum. Pharetra pharetra massa massaultricies mi quis hendrerit dolor magnammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Comment posted by Mahak 5 months ago
B0aa3b0f6fc4e854a2aed690392bf1c8
vnv nvbdjfbd jcvdfvd mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Comment posted by Mahak 5 months ago
B0aa3b0f6fc4e854a2aed690392bf1c8
ndfkjvbdf fboerfvoer eurfeoryvfoe ufgeryfger8yf rugf8eryg8tg fge8rg8e8er efg8eryf8er eufe8rgf8erf ufer8gyf8ergf ufg8yregf8 uhfgeryfye ufgy8efg8yer ufgegfer ufg8ygfr yfge8rfg8erf yefg8eyr feryfyer rf8erg8 efgery8g uferyfber yfge8yfe8r fgeyufrf ufbeurybfueyrbf fehfbheurbfer rehbfeurbfueru ehfbeurb
Comment posted by Mahak 5 months ago
2b99f6fc0c2faad343ed3c05b734c9f9
any thing in recent
Comment posted by sravya 3 months ago