add self-test and build automated testing process