Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary,...
Transcript of Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary,...
![Page 1: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/1.jpg)
Git Gud with Property Based Testing
Katie Cleary, Reluctant Tester
![Page 2: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/2.jpg)
![Page 3: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/3.jpg)
PROPERTY BASED TESTING
![Page 4: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/4.jpg)
What is it?
![Page 5: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/5.jpg)
QuickCheck vs Proptest
![Page 6: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/6.jpg)
![Page 7: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/7.jpg)
![Page 8: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/8.jpg)
![Page 9: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/9.jpg)
![Page 10: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/10.jpg)
3 C’s of PBT’s
● CONCENTRATED● COMPREHENSIVE● CONSTRUCTIVE
![Page 11: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/11.jpg)
● CONCENTRATED● COMPREHENSIVE● CONSTRUCTIVE
![Page 12: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/12.jpg)
So many tests
![Page 13: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/13.jpg)
Shrinking
![Page 14: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/14.jpg)
[167, 31467, -7529, 2381][104, 35, 0, -87, -94][-16, -86] [-2, -6, -13][-1]
![Page 15: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/15.jpg)
Properties make sense
![Page 16: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/16.jpg)
#[test]
fn test_weird() {
let s1 = "Hello, World!";
assert_eq!(get_weird(s1), "Hello, Weird");
let s2 = "We are the World";
assert_eq!(get_weird(s2), "We are the Weird");
let s3 = "2018 World Champions";
assert_eq!(get_weird(s3),
"2018 Weird Champions");
}
![Page 17: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/17.jpg)
proptest! {
#[test]
fn makes_weirder(ref s in "\\PC*") {
assert_eq!(
get_weird(s),
s.replace("World", "Weird")
);
}
}
![Page 18: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/18.jpg)
● CONCENTRATED● COMPREHENSIVE● CONSTRUCTIVE
![Page 19: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/19.jpg)
Generators?Generators made of Generators?
STRATEGIES??
![Page 20: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/20.jpg)
# Seeds for failure cases proptest has generated in the past. It is
# automatically read and these particular cases re-run before any
# novel cases are generated.
#
# It is recommended to check this file in to source control so that
# everyone who runs the test benefits from these saved cases.
xs 3463929736 50936258 545782822 2853614950
# shrinks to (ref state, ref attack) = (State { num_locals: 2, prev_action: Some(Push(0, "chemical-crayon-repo-0")) }, Teleport("master", "faithful-ocean-repo-1"))
xs 4163602398 953157749 2801114720 42941762
# shrinks to (ref state, ref attack) = (State { num_locals: 4, prev_action: Some(Branch(0, "instinctive-dinosaurs-repo-0")) }, Deletion("excellent-pan-repo-3"))
![Page 21: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/21.jpg)
Generators make your tests better
![Page 22: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/22.jpg)
Even if it’s your fault they were bad :(
![Page 23: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/23.jpg)
● CONCENTRATED● COMPREHENSIVE● CONSTRUCTIVE
![Page 24: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/24.jpg)
More fun & complex >:}
![Page 25: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/25.jpg)
Better teamwork <3
![Page 26: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/26.jpg)
![Page 27: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/27.jpg)
PROPERTY BASED TESTING
![Page 28: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/28.jpg)
Resource guide
Hypothesis: What is Property Based Testing
F# for Fun and Profit: Choosing Properties
QuickCheck for Rust
proptest
On Omitting Commits and Committing Omissions
![Page 29: Git Gud with Property Based Testing - QCon New YorkGit Gud with Property Based Testing Katie Cleary, Reluctant Tester . PROPERTY BASED TESTING. What is it? QuickCheck vs Proptest.](https://reader035.fdocuments.in/reader035/viewer/2022070712/5ece2c89ee11c142a623db24/html5/thumbnails/29.jpg)
?@clearydude