Add metrics unit tests