The autopkgtest package runs DEP-8 tests.

Direct run

In your test VM, example with the firejail package, stretch syntax:

cd firejail-0.9.58.2/
apt-get build-dep .
debuild

apt install autopkgtest
autopkgtest ../firejail_0.9.58.2-2+deb9u1_amd64.changes -- null
# tests output makes test results/recap hard to get, save the latter separately:
autopkgtest -o ../test.out --summary=../test.summary ../firejail_0.9.58.2-2+deb9u1_amd64.changes -- null

In your test VM, example with LTS/TestSuites/rails, old (jessie) syntax:

cd rails-4.1.8/
apt-get build-dep rails
debuild

apt install autopkgtest
apt install ruby-spring ruby-jquery-rails ruby-sqlite3 ruby-sass-rails ruby-uglifier ruby-coffee-rails ruby-turbolinks ruby-jbuilder ruby-sdoc
apt install ruby-byebug ruby-web-console # stretch
# TODO: autopkgtest should install dependencies automatically, possibly those weren't due to APT::Install-Recommends "false", or it's a bug somewhere

adt-run -B ./ --- null
adt-run ../rails_4.1.8-1+deb8u7_amd64.changes --- null

Full LXC environment

In your test VM, example with apache2, new (stretch+) syntax.

LXC setup:

apt install autopkgtest
apt install lxc debootstrap rsync ebtables
# Create network
apt install libvirt-daemon-system
# edit /etc/libvirt/qemu/networks/default.xml if needed (IP range...)
virsh net-autostart default
service libvirtd restart
cat > /etc/lxc/default.conf <<'EOF'
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = virbr0
EOF

# Create base container
# Add security updates to better match target environment 
cat <<'EOF' > ~/apt-security.sh
#!/bin/bash
echo 'deb http://security.debian.org/debian-security stretch/updates main' >> /etc/apt/sources.list
echo 'deb-src http://security.debian.org/debian-security stretch/updates main' >> /etc/apt/sources.list
apt update
apt -y upgrade
EOF
autopkgtest-build-lxc debian stretch amd64 ~/apt-security.sh

Testing the package:

cd apache2-2.4.25/
apt-get build-dep apache2
debuild

# Test the package you're working on
autopkgtest ../apache2_2.4.25-3+deb9u11_amd64.changes -- lxc autopkgtest-stretch-amd64
# Test the package *from the archive*
# (BUG in this autopkgtest version / lxc virt-server: should be the same as above)
#autopkgtest -B -- lxc autopkgtest-stretch-amd64

Testing the package (jessie syntax):

adt-build-lxc debian jessie amd64
# TODO: fix-up security in adt-jessie-amd64
adt-run ../apache2_2.4.10-10+deb8u19_amd64.changes --- lxc adt-jessie-amd64

Backporting

stretch -> jessie: