bonjour a tous, j ai un probleme avec effectue mes test unitaires.
avec junit et cobertura.
Je vois le probleme dans junit-xml de report généré par cobertura
qui me dit qu il ne voit pas un fichier de spring.xml
pourtant tout est la dans les repertoires classes pour cobertura et dans
sources de cobertura aussi mais pas dans instrumented d' ailleurs, je sais pas pourquoi dans ma tache ant , je lui demande de le faire
voici l erreurdans un fichier TEST-ca.penson.sweep.batch.SweepParameterBatchTest.xml<property name="java.vm.name" value="Java HotSpot(TM) Client VM" />
<property name="bpsa.url" value="jdbc:jtds:sqlserver://ssbr01qa-mtl:1433/HISTORY;sendStringParametersAsUnicode=false" />
<property name="ant.file.SWEEP" value="C:\Documents and Settings\emorisseau\workspace\svn\is\projects\sweep\build.xml" />
<property name="basedir" value="C:\Documents and Settings\emorisseau\workspace\svn\is\projects\sweep" />
<property name="ant.java.version" value="1.5" />
<property name="ant.core.lib" value="C:\eclipse\eclipse\plugins\org.apache.ant_1.7.1.v20090120-1145\lib\ant.jar" />
<property name="file.encoding" value="Cp1252" />
<property name="java.specification.version" value="1.5" />
<property name="src.dir" value="src" />
</properties>
<testcase classname="ca.penson.sweep.batch.SweepParameterBatchTest" name="testMain" time="0.156">
<error message="IOException parsing XML document from class path resource [springAppl-sweep.xml]; nested exception is java.io.FileNotFoundException: class path resource [springAppl-sweep.xml] cannot be opened because it does not exist" type="org.springframework.beans.factory.BeanDefinitionStoreException">org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [springAppl-sweep.xml]; nested exception is java.io.FileNotFoundException: class path resource [springAppl-sweep.xml] cannot be opened because it does not exist
Caused by: java.io.FileNotFoundException: class path resource [springAppl-sweep.xml] cannot be opened because it does not exist
at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:135)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:297)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:280)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:131)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:147)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:173)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:112)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:79)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:101)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:389)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:324)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:91)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:75)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:65)
at ca.penson.sweep.dao.hibernate.service.ServiceSweepBatch.<init>(ServiceSweepBatch.java:21)
at ca.penson.sweep.dao.hibernate.service.ServiceSweepBatch.getInstance(ServiceSweepBatch.java:38)
at ca.penson.sweep.batch.SweepParameterBatch.<init>(SweepParameterBatch.java:16)
at ca.penson.sweep.batch.SweepParameterBatchTest.testMain(SweepParameterBatchTest.java:23)
</error>
et mon fichier ant
avec un build.propertie
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228 <?xml version="1.0" encoding="UTF-8"?> <project name="SWEEP" basedir="." default="compile"> <property file="build.properties"/> <property name="output.build.home" value="${basedir}/build" /> <property name="source.home" value="${basedir}/source" /> <property name="src.dir" value="${basedir}/src" /> <property name="src.dirBase_dao" value="C:/Documents and Settings/emorisseau/workspace/svn/is/projects/daos/base_dao/src" /> <property name="src.dirBpsa_dao" value="C:/Documents and Settings/emorisseau/workspace/svn/is/projects/daos/bpsa_dao/src" /> <property name="src.dirIntact_dao" value="C:/Documents and Settings/emorisseau/workspace/svn/is/projects/daos/intact_dao/src" /> <property name="src.dirSweep_dao" value="C:/Documents and Settings/emorisseau/workspace/svn/is/projects/daos/sweep_dao/src" /> <property name="src.dirdao" value="C:/Documents and Settings/emorisseau/workspace/svn/is/projects/daos" /> <property name="src.dirGateway" value="C:/Documents and Settings/emorisseau/workspace/svn/is/projects/gateway/branches/broadridge - BPSA/Gateway-api/src/main" /> <property name="cobertura.dir" value="C:/cobertura" /> <property name="testcase" value="ca.penson.sweep.batch.SweepParameterBatchTest" /> <property name="basedir.test" value="C:/Documents and Settings/emorisseau/workspace/svn/is/projects/sweep/src/test" /> <path id="sweep.xmlfiles"> <fileset dir="${classes.dir}"> <include name="**/*.xml" /> </fileset> </path> <path id="cobertura.classpath"> <fileset dir="${cobertura.dir}"> <include name="cobertura.jar" /> <include name="lib/*.jar" /> </fileset> </path> <taskdef classpathref="cobertura.classpath" resource="tasks.properties" /> <!-- Build Java Source --> <path id="class.path"> <fileset dir="${lib}"> <include name="*.jar" /> </fileset> </path> <target name="compile" description="Compile Java sources" depends="prepareForSweep"> <!-- Compile Java classes as necessary --> <mkdir dir="${classes.dir}" /> <javac srcdir="${src.dir}:${src.dirBase_dao}:${src.dirBpsa_dao}:${src.dirIntact_dao}:${src.dirSweep_dao}:${src.dirGateway}" destdir="${classes.dir}" debug="yes"> <classpath refid="cobertura.classpath" /> <classpath refid="class.path" /> </javac> </target> <target name="prepareForSweep"> <copy todir="${source.home}"> <fileset dir="${src.dirdao}" /> <mapper type="glob" from="*.xml" to="*.xml" /> </copy> <copy todir="${source.home}"> <fileset dir="${src.dirdao}" /> <mapper type="glob" from="*.java" to="*.java" /> </copy> <copy todir="${source.home}"> <fileset dir="${src.dir}"> <include name="**/*.java" /> <include name="**/*.xml" /> </fileset> </copy> <copy todir="${classes.dir}"> <fileset dir="${src.dir}"> <include name="**/*.xml" /> </fileset> </copy> <copy todir="${classes.dir}"> <fileset dir="${src.dirBase_dao}"> <include name="**/*.xml" /> </fileset> </copy> <copy todir="${classes.dir}"> <fileset dir="${src.dirBpsa_dao}"> <include name="**/*.xml" /> </fileset> </copy> <copy todir="${classes.dir}"> <fileset dir="${src.dirIntact_dao}"> <include name="**/*.xml" /> </fileset> </copy> <copy todir="${classes.dir}"> <fileset dir="${src.dirSweep_dao}"> <include name="**/*.xml" /> </fileset> </copy> <copy todir="${classes.dir}"> <fileset dir="${src.dirGateway}"> <include name="**/*.xml" /> </fileset> </copy> </target> <!-- ============================================================================== Cobertura Target To create instrumented versions of your classes using the instrument task this below assumes your classes are in the directory build/classes for cobertura. ============================================================================== --> <target name="test" depends="init,compile"> <junit fork="yes" dir="${basedir}" failureProperty="test.failed"> <!-- Specify the name of the coverage data file to use. The value specified below is the default. --> <sysproperty key="net.sourceforge.cobertura.datafile" file="${basedir}/cobertura.ser" /> <!-- Note the classpath order: instrumented classes are before the original (uninstrumented) classes. This is important. --> <classpath location="${instrumented.dir}" /> <classpath location="${classes.dir}" /> <!-- The instrumented classes reference classes used by the Cobertura runtime, so Cobertura and its dependencies must be on your classpath. --> <classpath refid="cobertura.classpath" /> <classpath refid="class.path" /> <formatter type="xml" /> <test name="${testcase}" todir="${reports.xml.dir}" if="testcase" /> <batchtest todir="${reports.xml.dir}" unless="testcase"> <fileset dir="${src.dir}"> <include name="**/*Test.java" /> </fileset> </batchtest> </junit> </target> <target name="init"> <mkdir dir="${classes.dir}" /> <mkdir dir="${instrumented.dir}" /> <mkdir dir="${reports.xml.dir}" /> <mkdir dir="${reports.html.dir}" /> <mkdir dir="${coverage.xml.dir}" /> <mkdir dir="${coverage.summaryxml.dir}" /> <mkdir dir="${coverage.html.dir}" /> </target> <target name="instrument" depends="init,compile"> <!-- Remove the coverage data file and any old instrumentation. --> <delete file="cobertura.ser"/> <delete dir="${instrumented.dir}" /> <!-- Instrument the application classes, writing the instrumented classes into ${build.instrumented.dir}. --> <cobertura-instrument todir="${instrumented.dir}"> <!-- The following line causes instrument to ignore any source line containing a reference to log4j, for the purposes of coverage reporting. --> <ignore regex="org.apache.log4j.*" /> <fileset dir="${classes.dir}"> <!-- Instrument all the application classes, but don't instrument the test classes. --> <include name="**/*.class" /> <include name="**/*.xml" /> <exclude name="**/*Test.class" /> </fileset> </cobertura-instrument> </target> <target name="coverage-report"> <!-- Generate an XML file containing the coverage data using the "srcdir" attribute. --> <cobertura-report srcdir="${src.dir}" destdir="${coverage.xml.dir}" format="xml" /> </target> <target name="summary-coverage-report"> <!-- Generate an summary XML file containing the coverage data using the "srcdir" attribute. --> <cobertura-report srcdir="${src.dir}" destdir="${coverage.summaryxml.dir}" format="summaryXml" /> </target> <target name="alternate-coverage-report"> <!-- Generate a series of HTML files containing the coverage data in a user-readable form using nested source filesets. --> <cobertura-report destdir="${coverage.html.dir}"> <fileset dir="${src.dir}"> <include name="**/*.java"/> </fileset> </cobertura-report> </target> <target name="coverage" depends="init,compile,instrument,test,coverage-report,summary-coverage-report,alternate-coverage-report" description="Compile, instrument ourself, run the tests and generate JUnit and coverage reports."/> </project>
je sais pas si quelqu' un peut m aider merci d avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 # Distribution name of the web application. app.name=sweep # Application release version app.version.major=1 app.version.minor=0 app.version.update=0 # jdbc/sweep datasource.sweep=jdbc/sweep sweep.url=jdbc:jtds:sqlserver://SSPR03tst-mtl:1433/MutualFunds sweep.username=a_gateway sweep.password=kU7athax # jdbc/bpsa datasource.bpsa=jdbc/bpsa bpsa.url=jdbc:jtds:sqlserver://ssbr01qa-mtl:1433/HISTORY;sendStringParametersAsUnicode=false bpsa.username=a_talon bpsa.password=talon lib=C:/sweeplib src.dir=src # Classes generated by the javac compiler are deposited in this directory classes.dir=classes # Instrumented classes are deposited into this directory instrumented.dir=instrumented # All reports go into this directory reports.dir=reports # Unit test reports from JUnit are deposited into this directory reports.xml.dir=${reports.dir}/junit-xml reports.html.dir=${reports.dir}/junit-html # Coverage reports are deposited into these directories coverage.xml.dir=${reports.dir}/cobertura-xml coverage.summaryxml.dir=${reports.dir}/cobertura-summary-xml coverage.html.dir=${reports.dir}/cobertura-html
Partager