On Tue, Apr 26, 2011 at 8:14 PM, Yuri de Wit <yde...@gmail.com> wrote:

> Pete,
>
> How are you dealing with your JUnit tests in src/test/java? Does your
> target platform also includes the test dependencies and you have
> another runtime target platform for when you are building you app? Or
> are you adding the test dependencies manually to the .classpath (afaik
> there is no way to tell maven-eclipse-plugin to only generate imports
> for test dependencies)?
>

Runs same from command line or IDE, and I never touch the .classpath file
ever, m2eclipse takes care of that - has for years. My .classpath file is
about 4 lines long, and basically just tells eclipse to use the maven
container. I think all my .classpath files are either identical or virtually
identical.

HelloWorld level example:
Basically I'm running all my junit tests as conventional java, only
using SpringJUnit4ClassRunner
Because it uses reflection (or for some reason) it uses junit3, otherwise
I'm perfectly happy with it for the first 15 modules I've used it with.

Please note in the fictitious example below that the locations line DOES
indeed have to point to other bundle contexts when external services are
called, but that's a spring related deficiency in the system and not
applicable otherwise.


@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {
"/META-INF/spring/npu-bundle-context.xml",
      "/META-INF/spring/foo-bundle-context.xml",
      "/META-INF/spring/bar-bundle-context.xml"  }, inheritLocations = true)
@Component
public class NpuaTest {

@Autowired
INpua npua;
 @Test
public void myTest() throws Exception {
assertTrue(true);
assertEquals("hi 6", npua.getResult(6));
_______________________________________________
general mailing list
general@lists.ops4j.org
http://lists.ops4j.org/mailman/listinfo/general

Reply via email to