I\'m new to Docker and was reading up on Docker. It\'s a great way to test systems in a self contained and reproducible standardized configuration (when done correctly).
I don't think you'd dockerize the tests themselves as the process that runs the tests.
For example if you need to run unit tests in php with phpunit, you would dockerize phpunit and use that to run tests against your code, and similarly for any other test framework you use (i.e. testng, junit... etc.)
Here's an example of the Dockerfile I use to encapsulate Java/Maven/TestNG for a Java test project which includes some selenium tests:
FROM maven:3-jdk-8
# Selectively add stuff we need
COPY pom.xml /usr/src/testng/
# Get a clean build immediately after and 'go-offline' to improve subsequent builds
RUN cd /usr/src/testng && mvn dependency:go-offline
COPY src /usr/src/testng/src
WORKDIR /usr/src/testng/
# Additional support files that's needed but not for the build
COPY supportfiles /usr/src/testng/supportfiles
CMD [ "mvn test" ]