Tests and support for integrating gradient