Thursday, May 14, 2020

property-based testing

From 1 to 10,000 test cases in under an hour: A beginner's guide to property-based testing - DEV Community 


How does property-based testing differ from example-based?

While they're from different concepts, property-based tests share many characteristics with example-based tests. This is illustrated in the following comparison of steps you'd take to write a given test:
Example basedProperty based
1. Set up some example data1. Define data type matching a specification
2. Perform some operations on the data2. Perform some operations on the data
3. Assert something about the result3. Assert properties about the result
Episode #178 Build a PyPI package from a Jupyter notebook - [Python Bytes Podcast]

  • Carolyn Stransky, @carolynstran
  • Excellent intro to property based testing and hypothesis
  • Starts with a unit test that uses example based testing.
  • Before showing similar test using hypothesis, she talks about the different mindset of testing for properties instead of exact examples.
  • Like not the exact sorted list you should
  • but instead,
  • the length should be the same
  • the contents should contain the same things, for instance, using set for that assertion
  • you could element-wise walk the list and make sure i <= i+1
  • She walks through the hypothesis decorators to come up with input and shows how to use some.lists and some.integers and max_examples
  • Goes on to discuss coming up with properties to test for, which really is the hard part of property based testing.
  • Checking for expected exceptions
  • Using a naive method technique, useful in property based testing, to compare two versions of a method. This is super useful for refactoring and testing new vs old versions on tons of input data.
  • json5 lib

Retry Pattern With Exponential Back-Off

Exponential backoff - Wikipedia

Understanding Retry Pattern With Exponential Back-Off and Circuit Breaker Pattern - DZone Integration

Error retries and exponential backoff in AWS - AWS General Reference

Exponential Backoff And Jitter | AWS Architecture Bloga



ws-samples/aws-arch-backoff-simulator: Simulator for AWS architecture blog (http://www.awsarchitectureblog.com/ ) about jitter and backoff


exponential-backoff - npm