|
@@ -0,0 +1,142 @@
|
|
|
+<project name="tdd" default="tests" basedir="." xmlns:sonar="antlib:org.sonar.ant" xmlns:jacoco="antlib:org.jacoco.ant">
|
|
|
+ <property name="project.java.version" value="1.8" />
|
|
|
+ <property name="encoding" value="UTF-8" />
|
|
|
+ <property name="sonar.login" value="TOKEN SONAR ICI" />
|
|
|
+ <!-- LE RESTE DOIT ETRE BON -->
|
|
|
+ <property name="build" value="build" />
|
|
|
+ <property name="testreports" value="testreports" />
|
|
|
+ <property name="src" value="src" />
|
|
|
+
|
|
|
+ <!-- Define the SonarQube global properties (the most usual way is to pass these properties via the command line) -->
|
|
|
+ <property name="sonar.host.url" value="https://forge.univ-artois.fr/sonar67" />
|
|
|
+ <property name="sonar.projectKey" value="${etudiant}:2018:MyLisp" />
|
|
|
+ <property name="sonar.projectName" value="${etudiant} Lisp 18" />
|
|
|
+ <property name="sonar.projectVersion" value="1.0" />
|
|
|
+ <property name="sonar.java.source" value="${project.java.version}" />
|
|
|
+ <property name="sonar.java.binaries" value="build" />
|
|
|
+ <property name="sonar.java.libraries" value="lib/*.jar" />
|
|
|
+ <property name="sonar.sources" value="src" />
|
|
|
+ <property name="sonar.exclusions" value="**/*Test*" />
|
|
|
+ <property name="sonar.tests" value="TDD2018TESTS/src,TDD2018OWNTESTS/src" />
|
|
|
+ <property name="sonar.junit.reportPaths" value="${testreports}" />
|
|
|
+ <property name="sonar.jacoco.reportPath" value="${testreports}/jacoco.exec" />
|
|
|
+ <property name="sonar.pitest.reportsDirectory" value="${testreports}" />
|
|
|
+ <property name="sonar.web.javaAdditionalOpts" value="-Dhttps.proxyHost=cache-etu.univ-artois.fr -Dhttps.proxyPort=3128" />
|
|
|
+ <target name="prepare" description="Cree les repertoires et initialise certaines valeurs">
|
|
|
+ <!-- Create the time stamp -->
|
|
|
+ <tstamp />
|
|
|
+ <mkdir dir="${build}" />
|
|
|
+ <mkdir dir="${testreports}" />
|
|
|
+ </target>
|
|
|
+
|
|
|
+ <path id="mypath">
|
|
|
+ <pathelement location="${build}" />
|
|
|
+ <fileset dir="lib">
|
|
|
+ <include name="*.jar" />
|
|
|
+ </fileset>
|
|
|
+ </path>
|
|
|
+
|
|
|
+ <target name="build" description="Compile les fichiers Java" depends="prepare">
|
|
|
+ <javac includeantruntime="true" srcdir="${src}" destdir="${build}" source="${project.java.version}" debug="true" encoding="${encoding}">
|
|
|
+ <classpath refid="mypath" />
|
|
|
+ </javac>
|
|
|
+ </target>
|
|
|
+
|
|
|
+ <target name="clean" description="Efface tous les fichiers generes">
|
|
|
+ <!-- Delete directory trees -->
|
|
|
+ <delete dir="${build}" />
|
|
|
+ <delete dir="${testreports}" />
|
|
|
+ <delete dir="${target}" />
|
|
|
+ </target>
|
|
|
+
|
|
|
+ <target name="compilepublictests">
|
|
|
+ <echo>Compilation des tests publics</echo>
|
|
|
+ <javac includeantruntime="true" srcdir="TDD2018TESTS/src" destdir="${build}" source="${project.java.version}" debug="true" encoding="${encoding}">
|
|
|
+ <classpath refid="mypath" />
|
|
|
+ </javac>
|
|
|
+ <copy todir="${build}">
|
|
|
+ <fileset dir="TDD2018TESTS/src">
|
|
|
+ <include name="**/*.story" />
|
|
|
+ </fileset>
|
|
|
+ </copy>
|
|
|
+ </target>
|
|
|
+ <target name="compileprivatetests" if="private.tests.found">
|
|
|
+ <echo>Compilation des tests privés</echo>
|
|
|
+ <javac includeantruntime="true" srcdir="TDD2018HIDDENTESTS/src" destdir="${build}" source="${project.java.version}" debug="true" encoding="${encoding}">
|
|
|
+ <classpath refid="mypath" />
|
|
|
+ </javac>
|
|
|
+
|
|
|
+ <copy todir="${build}">
|
|
|
+ <fileset dir="TDD2018HIDDENTESTS/src">
|
|
|
+ <include name="**/*.story" />
|
|
|
+ </fileset>
|
|
|
+ </copy>
|
|
|
+ </target>
|
|
|
+ <target name="compileowntests">
|
|
|
+ <echo>Compilation des tests personnels</echo>
|
|
|
+ <javac includeantruntime="true" srcdir="TDD2018OWNTESTS/src" destdir="${build}" source="${project.java.version}" debug="true" encoding="${encoding}">
|
|
|
+ <classpath refid="mypath" />
|
|
|
+ </javac>
|
|
|
+
|
|
|
+ <copy todir="${build}">
|
|
|
+ <fileset dir="TDD2018OWNTESTS/src">
|
|
|
+ <include name="**/*.story" />
|
|
|
+ </fileset>
|
|
|
+ </copy>
|
|
|
+ </target>
|
|
|
+
|
|
|
+ <target name="tests" description="test de l'application web à l'aide de JUnit" depends="build">
|
|
|
+ <taskdef uri="antlib:org.jacoco.ant" resource="org/jacoco/ant/antlib.xml">
|
|
|
+ <classpath path="lib/jacocoant.jar" />
|
|
|
+ </taskdef>
|
|
|
+ <antcall target="compilepublictests" />
|
|
|
+ <available property="private.tests.found" file="TDD2018HIDDENTESTS/src" type="dir" />
|
|
|
+ <antcall target="compileprivatetests" />
|
|
|
+ <antcall target="compileowntests" />
|
|
|
+ <jacoco:coverage destfile="${sonar.jacoco.reportPath}">
|
|
|
+ <junit fork="yes" forkmode="once" printsummary="false" haltonfailure="no" failureproperty="tests.failure">
|
|
|
+ <classpath refid="mypath" />
|
|
|
+ <formatter type="plain" usefile="false" />
|
|
|
+ <formatter type="xml" />
|
|
|
+ <batchtest fork="yes" todir="${testreports}">
|
|
|
+ <fileset dir="${build}">
|
|
|
+ <include name="**/TDD*.class" />
|
|
|
+ <include name="**/*Test*.class" />
|
|
|
+ <include name="**/PeterNorvig*.class" />
|
|
|
+ <exclude name="**/AllTests.class" />
|
|
|
+ <exclude name="**/Abstract*.class" />
|
|
|
+ </fileset>
|
|
|
+ </batchtest>
|
|
|
+ </junit>
|
|
|
+ </jacoco:coverage>
|
|
|
+ </target>
|
|
|
+
|
|
|
+ <target name="m1" description="Verification des projets de TDD2018" depends="clean,build,tests" />
|
|
|
+
|
|
|
+ <!-- Define the SonarQube target -->
|
|
|
+ <target name="sonar" depends="m1" description="Analyse le code avec SonarQube">
|
|
|
+ <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
|
|
|
+ <classpath path="lib/sonarqube-ant-task-2.5.jar" />
|
|
|
+ </taskdef>
|
|
|
+ <!-- To avoid analyzing the tests -->
|
|
|
+ <delete dir="${build}" />
|
|
|
+ <mkdir dir="${build}" />
|
|
|
+ <antcall target="build" />
|
|
|
+ <!-- Execute the SonarQube analysis -->
|
|
|
+ <sonar:sonar />
|
|
|
+ <fail message="Il reste des tests qui ne passent pas !" if="tests.failure" />
|
|
|
+ </target>
|
|
|
+ <target name="mutationCoverage">
|
|
|
+ <taskdef name="pitest" classname="org.pitest.ant.PitestTask" classpathref="mypath" />
|
|
|
+ <pitest
|
|
|
+ pitClasspath="mypath"
|
|
|
+ classPath="mypath"
|
|
|
+ targetClasses="migl.*"
|
|
|
+ excludedClasses="*Test*,*Eval*"
|
|
|
+ targetTests="migl.*"
|
|
|
+ reportDir="${testreports}"
|
|
|
+ outputFormats="XML,HTML"
|
|
|
+ sourceDir="${src}"/>
|
|
|
+ </target>
|
|
|
+</project>
|
|
|
+
|