You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Ernst de Haan (JIRA)" <ji...@codehaus.org> on 2010/05/25 14:07:12 UTC
[jira] Created: (SUREFIRE-620) Ability to access manifest resource
while running unit tests
Ability to access manifest resource while running unit tests
------------------------------------------------------------
Key: SUREFIRE-620
URL: http://jira.codehaus.org/browse/SUREFIRE-620
Project: Maven Surefire
Issue Type: Improvement
Components: Junit 4.x support, Maven Surefire Plugin
Affects Versions: 2.5
Environment: n/a
Reporter: Ernst de Haan
Priority: Minor
Use case:
- my code calls getClass().getPackage().getImplementationVersion() to determine the version specified in the manifest
- I would like to test this code, for example making sure the returned string is not null
Currently, when I run "mvn test" it does not generate the JAR, nor does it not make the META-INF/MANIFEST.MF file available in the classpath.
First question is whether this is a *unit* test or an *integration* test. I would say a unit test, because no other code bases are involved, this should be within a single module, and not testing any dependencies.
Secondly, is the test valid at all if it uses a resource. I would say "yes", because it is even standard functionality offered by J2SE and I consider this a good approach to determining meta data from the codebase self.
Thirdly, should the Surefire plugin depend on the JAR being created or should it just generate the manifest (and copy/generate other resources?) and stick them where the compiled classes go?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] Commented: (SUREFIRE-620) Ability to access manifest
resource while running unit tests
Posted by "Milos Kleint (JIRA)" <ji...@codehaus.org>.
[ http://jira.codehaus.org/browse/SUREFIRE-620?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=222826#action_222826 ]
Milos Kleint commented on SUREFIRE-620:
---------------------------------------
currently the only option is to have the manifest manually created or somehow generated (either the real manifest or a test mockup one) and pass it to the test classpath via a parameter of the surefire plugin
http://maven.apache.org/plugins/maven-surefire-plugin/examples/additional-classpath.html
> Ability to access manifest resource while running unit tests
> ------------------------------------------------------------
>
> Key: SUREFIRE-620
> URL: http://jira.codehaus.org/browse/SUREFIRE-620
> Project: Maven Surefire
> Issue Type: Improvement
> Components: Junit 4.x support, Maven Surefire Plugin
> Affects Versions: 2.5
> Environment: n/a
> Reporter: Ernst de Haan
> Priority: Minor
>
> Use case:
> - my code calls getClass().getPackage().getImplementationVersion() to determine the version specified in the manifest
> - I would like to test this code, for example making sure the returned string is not null
> Currently, when I run "mvn test" it does not generate the JAR, nor does it not make the META-INF/MANIFEST.MF file available in the classpath.
> First question is whether this is a *unit* test or an *integration* test. I would say a unit test, because no other code bases are involved, this should be within a single module, and not testing any dependencies.
> Secondly, is the test valid at all if it uses a resource. I would say "yes", because it is even standard functionality offered by J2SE and I consider this a good approach to determining meta data from the codebase self.
> Thirdly, should the Surefire plugin depend on the JAR being created or should it just generate the manifest (and copy/generate other resources?) and stick them where the compiled classes go?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira