# # Makefile for running Cobertura with TestNG. # # Path to TestNG jar TESTNG = /home/gfisher/classes/309/lib/testng/testng-6.8.jar # Path to Cobertura jar COBERTURA = $(COBERTURA_DIR)/cobertura.jar # Path to Cobertura directory, from the unpacked Cobertura jar COBERTURA_DIR = /home/gfisher/classes/309/lib/cobertura-1.9.3 # Directory for testing .class files; this corresponds to the project directory # testing/implementation/executables/JVM, or the equivalent for your project. EXECUTABLES = classes # # Example source file; this corresponds to the files in the project # implementation directory. # IMPLE_SRC = \ CoverageExample.java TESTING_FILES = \ CoverageExampleTest.java $(IMPLE_SRC) # # Compile, run the tests, run the coverage report. # test: compile run cover # # Compile the implementation and testing files. In a full project Makefile, # the -sourcepath argument is both testing and implementation directories, # e.g., "-sourcepath .:$(IMPLE_SRC_DIR)" # compile: @echo "Compiling tests ..." javac -g \ -classpath $(TESTNG) \ -sourcepath . \ -d $(EXECUTABLES) \ $(TEST_FILES) # # Run the TestNG tests alone, without a coverage report. # run: @echo "Running tests ..." @csh -q -c 'cd classes ; ./.run.csh' # # Run the TestNG tests under Cobertrua, and generate a coverage report. # cover: @echo "Running code coverage ..." $(COBERTURA_DIR)/cobertura-instrument csh -q -c 'cd classes ; \ java -cp $(COBERTURA_JAR):../instrumented:./classes:$(TESTNG):. \ -Dnet.sourceforge.cobertura.datafile=../cobertura.ser \ org.testng.TestNG testng.xml' open_test_output: @csh -q -c 'open $(EXECUTABLES)/test-output/index.html' # Remove all .class files from the classes dir. clean: csh -q -c ".make-clean.csh"