General Framework for Randomized Benchmarking