Home | History | Annotate | Download | only in ant
      1 <?xml version="1.0" encoding="UTF-8"?>
      2 
      3 <!-- 
      4    Copyright (c) 2009, 2018 Mountainminds GmbH & Co. KG and Contributors
      5    All rights reserved. This program and the accompanying materials
      6    are made available under the terms of the Eclipse Public License v1.0
      7    which accompanies this distribution, and is available at
      8    http://www.eclipse.org/legal/epl-v10.html
      9   
     10    Contributors:
     11       Brock Janiczak - initial API and implementation
     12 -->
     13 
     14 <project name="JaCoCo Agent Task Tests" xmlns:au="antlib:org.apache.ant.antunit" xmlns:jacoco="antlib:org.jacoco.ant">
     15 			
     16 	<target name="testCoverageAgent">
     17 		<jacoco:agent property="jacocoagent" append="false" destfile="test.exec"
     18 			exclClassLoader="EvilClassLoader" includes="org.example.*" excludes="*Test"
     19 			inclbootstrapclasses="true" inclnolocationclasses="true"
     20 		    sessionid="testid" dumponexit="false"
     21 			output="file" address="remotehost" port="1234" jmx="true"
     22 			classdumpdir="target/dump"/>
     23 		<au:assertPropertySet name="jacocoagent"/>
     24 		<au:assertPropertyContains name="jacocoagent" value="-javaagent:"/>
     25 		<au:assertPropertyContains name="jacocoagent" value="append=false"/>
     26 		<property name="exec.file" location="test.exec"/>
     27 		<au:assertPropertyContains name="jacocoagent" value="destfile=${exec.file}"/>
     28 		<au:assertPropertyContains name="jacocoagent" value="exclclassloader=EvilClassLoader"/>
     29 		<au:assertPropertyContains name="jacocoagent" value="includes=org.example.*"/>
     30 		<au:assertPropertyContains name="jacocoagent" value="excludes=*Test"/>
     31 		<au:assertPropertyContains name="jacocoagent" value="inclbootstrapclasses=true"/>
     32 		<au:assertPropertyContains name="jacocoagent" value="inclnolocationclasses=true"/>
     33 		<au:assertPropertyContains name="jacocoagent" value="sessionid=testid"/>
     34 		<au:assertPropertyContains name="jacocoagent" value="dumponexit=false"/>
     35 		<au:assertPropertyContains name="jacocoagent" value="output=file"/>
     36 		<au:assertPropertyContains name="jacocoagent" value="address=remotehost"/>
     37 		<au:assertPropertyContains name="jacocoagent" value="port=1234"/>
     38 		<au:assertPropertyContains name="jacocoagent" value="jmx=true"/>
     39 		<property name="dump.dir" location="target/dump"/>
     40 		<au:assertPropertyContains name="jacocoagent" value="classdumpdir=${dump.dir}"/>
     41 	</target>
     42 	
     43 	<target name="testCoverageAgentDisabled">
     44 		<jacoco:agent enabled="false" property="jacocoagent" append="false" destfile="${basedir}/test.exec" exclClassLoader="sun.reflect.DelegatingClassLoader"/>
     45 		<au:assertPropertyEquals name="jacocoagent" value=""/>
     46 	</target>
     47 	
     48 	<target name="testCoverageAgentWithNoProperty">
     49 		<au:expectfailure expectedMessage="Property is mandatory">
     50 			<jacoco:agent/>
     51 		</au:expectfailure>
     52 	</target>
     53 
     54 	<target name="testCoverageAgentWithEmptyProperty">
     55 		<au:expectfailure expectedMessage="Property is mandatory">
     56 			<jacoco:agent property=""/>
     57 		</au:expectfailure>
     58 	</target>
     59 
     60 	<target name="testCoverageAgentReuseAgentJar">
     61 		<jacoco:agent property="agent1"/>
     62 		<jacoco:agent property="agent2"/>
     63 		<au:assertEquals expected="${agent1}" actual="${agent2}"/>
     64 	</target>
     65 	
     66 </project>