Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Test runtime dependencies

Hi,

 

Thank you for your answer. I solved it after all, it was a target runtime environment configuration problem.

 

<environment>

  <os>win32</os>

  <ws>win32</ws>

  <arch>x86_64</arch>

</environment>

I erroneously used “x86” instead of “x86_64”.

 

Regards,

Iulia

 

From: tycho-user-bounces@xxxxxxxxxxx [mailto:tycho-user-bounces@xxxxxxxxxxx] On Behalf Of Ed Willink
Sent: Tuesday, February 06, 2018 2:54 PM
To: tycho-user@xxxxxxxxxxx
Subject: Re: [tycho-user] Test runtime dependencies

 

Hi

Firstly be aware that maven-surefire and tycho-surefire are completely different beasts.

maven-surefire is rather like Eclipse non-JUnit plugin testing. It tests locally built classes.

tycho-surefire is rather like Eclipse JUnit testing; but 'better' since it typically tests packaged JARs.

Unfortunately neither launches as an Eclipse launch so both can exhibit irritating errors for a newbie until you have successfully transliterated all your already working launch configuration and accommodated the eccentricities of the different test runner.

If you create intermediate files expect to have to create them as fully fledged independent projects; you can no longer create siblings of your (packaged) class files. I ended up writing a TestFileSystem to manage my intermediate classes for all four permutations of testing.

See GIT\org.eclipse.ocl\tests\org.eclipse.ocl.examples.xtext.tests\src\org\eclipse\ocl\examples\xtext\tests\TestFileSystem.java

Dependencies can be difficult. You may find the Tycho FAQ and entries such as

https://wiki.eclipse.org/Tycho/FAQ#How_do_I_install_the_org.eclipse.osgi.compatibility.state_fragment.3F

helpful.

Regards

Ed Willink

 

 

On 06/02/2018 12:23, Iulia Madalina Vasii wrote:

Hello,

 

I’m new to tycho and I’m struggling to make some Junit tests running with maven/tycho from command line. They work fine from Eclipse IDE (Run As -> Junit Plug-in Test), but fail in command line. More details below:

 

- I have a plug-in: com.nxp.s32ds.cle.uct.core

- I created a fragment for unit tests: com.nxp.s32ds.cle.uct.core.tests

  It contains unit tests which access the workspace (creates and removes projects).

  The packaging is “eclipse-test-plugin” in the pom file.

- I use <tycho-version>0.26.0</tycho-version>

 

These two require other bundles to compile, which I specified in the parent pom.xml:

 

<repositories>

                                <repository>

                                                <id>neon-local</id>

                                                <layout>p2</layout>

                                                <url>${nexus.url}/content/repositories/neon3</url>

                                </repository>

               

                                <repository>

                                                <id>eclipse-updates-4.6</id>

                                                <layout>p2</layout>

                                                <url>${nexus.url}/content/repositories/eclipse-updates-4.6</url>

                                </repository>

                               

                                <repository>

                                                <id>uct</id>

                                                <layout>p2</layout>

                                                <url>jar: ${nexus.url}/builds/com.uct.updatesites-1.0.0-SNAPSHOT.zip!/</url>

                                </repository>

</repositories>

 

Everything works fine from Eclipse IDE, I am able to compile and execute the tests successfully.

 

From command line, “mvn clean verify” it fails in the test plugin with this message:

 

[INFO] Command line:

        [C:\Program Files\Java\jdk1.8.0_101\jre\bin\java.exe, -Dosgi.noShutdown=false, -Dosgi.os=win32, -Dosgi.ws=win32, -Dosgi.arch=x86_64, -ea, -Dosgi.clean=true, -jar, C:\Users\B05648\.m2\repositor

y\p2\osgi\bundle\org.eclipse.equinox.launcher\1.3.201.v20161025-1711\org.eclipse.equinox.launcher-1.3.201.v20161025-1711.jar, -data, C:\HOME\AMP_TOOLS\Repos\DS\cle_uct\tests\com.nxp.s32ds.cle.uct.core

.tests\target\work\data, -install, C:\HOME\AMP_TOOLS\Repos\DS\cle_uct\tests\com.nxp.s32ds.cle.uct.core.tests\target\work, -configuration, C:\HOME\AMP_TOOLS\Repos\DS\cle_uct\tests\com.nxp.s32ds.cle.uct

.core.tests\target\work\configuration, -application, org.eclipse.tycho.surefire.osgibooter.headlesstest, -testproperties, C:\HOME\AMP_TOOLS\Repos\DS\cle_uct\tests\com.nxp.s32ds.cle.uct.core.tests\targ

et\surefire.properties]

 

-------------------------------------------------------

T E S T S

-------------------------------------------------------

Running com.nxp.s32ds.cle.uct.core.tests.ProjectAdapterTest

Tests run: 6, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.11 sec <<< FAILURE! - in com.nxp.s32ds.cle.uct.core.tests.ProjectAdapterTest

testToolchainId(com.nxp.s32ds.cle.uct.core.tests.ProjectAdapterTest)  Time elapsed: 0.001 sec

testPartNumber(com.nxp.s32ds.cle.uct.core.tests.ProjectAdapterTest)  Time elapsed: 0 sec

testEclipsePrj(com.nxp.s32ds.cle.uct.core.tests.ProjectAdapterTest)  Time elapsed: 0.085 sec  <<< ERROR!

java.lang.NoClassDefFoundError: com/nxp/swtools/sdkproject/EclipseProjectAdapterParams

        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:461)

        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:372)

        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:364)

        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

        at java.lang.Class.getDeclaredConstructors0(Native Method)

        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)

        at java.lang.Class.getConstructor0(Class.java:3075)

        at java.lang.Class.newInstance(Class.java:412)

        at org.eclipse.osgi.internal.framework.BundleContextImpl.loadBundleActivator(BundleContextImpl.java:758)

        at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:711)

        at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:932)

        at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309)

        at org.eclipse.osgi.container.Module.doStart(Module.java:581)

        at org.eclipse.osgi.container.Module.start(Module.java:449)

        at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:470)

        at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)

        at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)

        at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:325)

        at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:345)

        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:423)

        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:372)

        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:364)

        at org.eclipse.osgi.internal.framework.BundleContextImpl.loadBundleActivator(BundleContextImpl.java:757)

        at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:711)

        at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:932)

        at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309)

        at org.eclipse.osgi.container.Module.doStart(Module.java:581)

        at org.eclipse.osgi.container.Module.start(Module.java:449)

        at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:470)

        at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)

        at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)

        at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:325)

        at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:345)

        at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:36)

        at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:419)

        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:372)

        at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:364)

        at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:161)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

        at com.nxp.s32ds.cle.uct.core.tests.ProjectAdapterTest.testEclipsePrj(ProjectAdapterTest.java:100)

 

testProcessor(com.nxp.s32ds.cle.uct.core.tests.ProjectAdapterTest)  Time elapsed: 0 sec

testToolchain(com.nxp.s32ds.cle.uct.core.tests.ProjectAdapterTest)  Time elapsed: 0 sec

testIncludePaths(com.nxp.s32ds.cle.uct.core.tests.ProjectAdapterTest)  Time elapsed: 0 sec

 

Results :

 

Tests in error:

  ProjectAdapterTest.testEclipsePrj:100 NoClassDefFound com/nxp/swtools/sdkproje...

 

Tests run: 6, Failures: 0, Errors: 1, Skipped: 0

 

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Summary:

[INFO]

[INFO] com.nxp.s32ds.cle.uct.root ......................... SUCCESS [  0.056 s]

[INFO] com.nxp.s32ds.cle.uct.branding ..................... SUCCESS [  1.501 s]

[INFO] com.nxp.s32ds.cle.uct.core ......................... SUCCESS [  0.809 s]

[INFO] com.nxp.s32ds.cle.uct.feature ...................... SUCCESS [  0.230 s]

[INFO] com.nxp.s32ds.cle.uct.repository ................... SUCCESS [  9.386 s]

[INFO] com.nxp.s32ds.cle.uct.core.tests ................... FAILURE [  3.870 s]

[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 32.712 s

[INFO] Finished at: 2018-02-06T14:12:24+02:00

[INFO] Final Memory: 118M/1091M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.eclipse.tycho:tycho-surefire-plugin:0.26.0:test (default-test) on project com.nxp.s32ds.cle.uct.core.tests: There are test failures.

[ERROR]

[ERROR] Please refer to C:\HOME\AMP_TOOLS\Repos\DS\cle_uct\tests\com.nxp.s32ds.cle.uct.core.tests\target\surefire-reports for the individual test results.

[ERROR] -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

[ERROR]

[ERROR] After correcting the problems, you can resume the build with the command

[ERROR]   mvn <goals> -rf :com.nxp.s32ds.cle.uct.core.tests

 

The class it doesn’t find com/nxp/swtools/sdkproject/EclipseProjectAdapterParams is part of “uct” repo specified in the parent pom.xml. However, it seems that the test runtime does not find it. There is no problem with that specified class, I tested and no class is found from that repo.

 

Any suggestions how to add the dependencies in the test runtime?

 

Thank you!

 

 




_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user

 

 

Virus-free. www.avast.com

 


Back to the top