Skip to content

NateLevin1/field-modify-flaky

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

field-modify-flaky

A flaky test example using a direct field modification

The victim test is in.natelev.NumbersTest.testNumbers
The polluter test is in.natelev.NumbersModifierTest.testAdd

The problem is that the victim assumes that the public static field Numbers.num is equal to 0 when the test starts, but the polluter adds 10 to it via the NumbersModifier.add method (which directly modifies the field).

The solution is to add in a call to numbersModifier.reset() at the end of the body of the polluter.

About

A flaky test example using a direct field modification

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages