Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] [newbie] failure loading test resources from tycho but OK in IDE?

Thanks Tobias. Didn't realise the 'platform' url syntax was not generic.

I don't need it specifically: just need a way for tests to find test resources that is (a) not dependent on absolute paths and (b) works both from maven/tycho and in IDE.

Any suggestions?

Thanks,
Scott.

On Sep 21, 2012 2:45 PM, "Oberlies, Tobias" <tobias.oberlies@xxxxxxx> wrote:
Where does the platform: syntax comes from? It is possible that some bundle contributes this syntax via some extension mechanism, but that bundle is not in Tycho's test runtime. Unlike the PDE, Tycho only includes the transitive dependencies of your test bundle in the test runtime. So if there is something else needed, you need to configure this on the tycho-surefire-plugin.

Regards
Tobias

> -----Original Message-----
> From: tycho-user-bounces@xxxxxxxxxxx [mailto:tycho-user-
> bounces@xxxxxxxxxxx] On Behalf Of Scott Finnie
> Sent: Donnerstag, 20. September 2012 15:55
> To: tycho-user@xxxxxxxxxxx
> Subject: [tycho-user] [newbie] failure loading test resources from tycho
> but OK in IDE?
>
> Apologies if this is answered somewhere else.  If so link(s) appreciated.
>
> Context: complete newbie to maven & tycho, trying to run junit tests for
> xtext-based project.
>
> I have integration tests that need to load test resources.  When run from
> the IDE it works fine but fails in tycho
> because it can't find the test resources.  Code as follows:
>
> //...
> final String pathroot =
> "org.domainmodels.ooa.tests/testdata/TestOoaStructure/"
> URI uri = URI.createPlatformResourceURI(pathroot+filename, true);
> System.out.println("Loading model from URI: " + uri.toString());
> rootElement = loadModel(resourceSet, uri, getRootObjectType(uri));
> //...
>
> When run from IDE this prints e.g.:
>
>    Loading model from URI:
> platform:/resource/org.domainmodels.ooa.tests/testdata/TestOoaStructure/Te
> stDomain.ooa
>
> and tests run fine.
>
> However from tycho it fails:
>
> Loading model from URI:
> platform:/resource/org.domainmodels.ooa.tests/testdata/TestOoaStructure/Te
> stDomain.ooa
> ...
> org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Resource
> '/org.domainmodels.ooa.tests/testdata/TestOoaStructure/ClassTest.ooa' does
> not exist.
>
> I have tried with absolute file-based URLs (using URI.createFileURI) and
> it works; however absolute paths is obviously
> not a sustainable solution.
>
> So my questions are:
> 1. Why does the platform-based URI scheme work in the IDE - but not from
> tycho?
> 2. Any suggestions for how I solve the problem?  Really don't want to use
> absolute paths.
>
> Thanks,
> Scott.
> _______________________________________________
> tycho-user mailing list
> tycho-user@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/tycho-user
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user

Back to the top