Run Tensorflow unit tests
The easiest way to run the TensorFlow unit tests is using Bazel, assuming you have downloaded the source from Git:
# All tests (for C++ changes).
$ bazel test //tensorflow/...
# All Python tests (for Python front-end changes).
$ bazel test //tensorflow/python/...
# All tests (with GPU support).
$ bazel test -c opt --config=cuda //tensorflow/...
$ bazel test -c opt --config=cuda //tensorflow/python/...
In addition to the above answer, you can run individual tests as shown instead of full packages, which can save a significant amount of time.
bazel run //tensorflow/python/kernel_tests:string_split_op_test
bazel run //tensorflow/python:special_math_ops_test
Or you can go to the individual directory and run all the tests there
cd python/kernel_tests
bazel run :one_hot_op_test