Quantcast

Eclipse UI-Tests with maven-osgi-test-plugin

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Eclipse UI-Tests with maven-osgi-test-plugin

Johannes Lerch
Hi,

I'm using SWTBot for doing UI-Testing in Eclipse. The tests work quite
well when started as "SWTBot-Tests" from Eclipse. When executed from
Maven, however, they fail because the Eclipse instance started by
Maven fails to resolve the dependencies of our test data fixture
project we use for testing.

Our setup is as follows:

We start Eclipse and import a test fixture project into the workspace.
The project is a plug-in project. It declares a dependency to
"org.eclipse.ui" which Eclipse fails to resolve during Maven test
execution.

I figured out why it is not working with maven: The per default
enabled target platform does not provide “org.eclipse.ui”. It merely
provides some “org.eclipse.equinox.launcher.*” and “org.eclipse.osgi”
plug-ins.  Consequently, Eclipse cannot build the project.

The default target platform path points to a "plugins" directory
located in %ECLIPSE_HOME% which in turn points to
"myTestProject/target/work/" during the maven test run. But
"myTestProject/target/work/plugins" only contains the launcher bundles
- which makes perfectly sense given the configuration but isn’t
exactly what we need.

I'm now searching for means to specify a target platform that contains
org.eclipse.ui. My preferred solution would be to copy all bundles
used to start eclipse into  %ECLIPSE_HOME%/plugins. Is there an option
in maven-osgi-test-plugin to enable this?

Greets
Johannes Lerch
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Eclipse UI-Tests with maven-osgi-test-plugin

Igor Fedorenko-2
Tycho is expected to resolve project dependencies from p2 repositories
specified in pom.xml. Demo project [1] shows how to do it.

Although not related to the problem you see, you will also need to
specify useUIHarness=true and useUIThread=false maven-osgi-test-plugin
plugin parameters, in order to avoid some swtbot related test deadlocks.

[1] https://github.com/sonatype/sonatype-tycho/tree/master/tycho-demo/itp01

--
Regards,
Igor

On 11-02-17 11:03 AM, Johannes Lerch wrote:

> Hi,
>
> I'm using SWTBot for doing UI-Testing in Eclipse. The tests work quite
> well when started as "SWTBot-Tests" from Eclipse. When executed from
> Maven, however, they fail because the Eclipse instance started by
> Maven fails to resolve the dependencies of our test data fixture
> project we use for testing.
>
> Our setup is as follows:
>
> We start Eclipse and import a test fixture project into the workspace.
> The project is a plug-in project. It declares a dependency to
> "org.eclipse.ui" which Eclipse fails to resolve during Maven test
> execution.
>
> I figured out why it is not working with maven: The per default
> enabled target platform does not provide “org.eclipse.ui”. It merely
> provides some “org.eclipse.equinox.launcher.*” and “org.eclipse.osgi”
> plug-ins.  Consequently, Eclipse cannot build the project.
>
> The default target platform path points to a "plugins" directory
> located in %ECLIPSE_HOME% which in turn points to
> "myTestProject/target/work/" during the maven test run. But
> "myTestProject/target/work/plugins" only contains the launcher bundles
> - which makes perfectly sense given the configuration but isn’t
> exactly what we need.
>
> I'm now searching for means to specify a target platform that contains
> org.eclipse.ui. My preferred solution would be to copy all bundles
> used to start eclipse into  %ECLIPSE_HOME%/plugins. Is there an option
> in maven-osgi-test-plugin to enable this?
>
> Greets
> Johannes Lerch
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Eclipse UI-Tests with maven-osgi-test-plugin

Johannes Lerch
Hi,

thanks for your reply. I guess you mean something similar to this snippet:
     <plugin>
        <groupId>org.sonatype.tycho</groupId>
        <artifactId>target-platform-configuration</artifactId>
        <version>${tycho-version}</version>
        <configuration>
          <resolver>p2</resolver>
        </configuration>
      </plugin>

I have that already in my configuration, but is that snippet really
responsible for the target platform in eclipse? My understanding was,
that this is required to resolve bundle dependencies during the build
process using update-sites.

Just to be clear, my problem is not resolving the dependencies to
launch my test. My problem ist that the default target platform in the
eclipse instance launched by maven is nearly empty causing my tests to
fail.

I attached an example test project so you can see what I mean. Just
unpack it and run mvn clean install. It should launch eclipse and
SWTBot will automatically create a Plug-in Project with dependencies
to org.eclipse.ui and org.eclipse.core.runtime. The bot will fall to
sleep after that so you can click around in eclipse to see, that there
are errors in MANIFEST.MF telling you the dependencies are not
resolvable. If you check the target platform in
Window->Preferences->Plug-In Project Development->Target Platform you
can see that the default target platform is pointing to a nearly empty
location.

Regards,
Johannes Lerch


2011/2/17 Igor Fedorenko <[hidden email]>:

> Tycho is expected to resolve project dependencies from p2 repositories
> specified in pom.xml. Demo project [1] shows how to do it.
>
> Although not related to the problem you see, you will also need to
> specify useUIHarness=true and useUIThread=false maven-osgi-test-plugin
> plugin parameters, in order to avoid some swtbot related test deadlocks.
>
> [1] https://github.com/sonatype/sonatype-tycho/tree/master/tycho-demo/itp01
>
> --
> Regards,
> Igor
>
> On 11-02-17 11:03 AM, Johannes Lerch wrote:
>>
>> Hi,
>>
>> I'm using SWTBot for doing UI-Testing in Eclipse. The tests work quite
>> well when started as "SWTBot-Tests" from Eclipse. When executed from
>> Maven, however, they fail because the Eclipse instance started by
>> Maven fails to resolve the dependencies of our test data fixture
>> project we use for testing.
>>
>> Our setup is as follows:
>>
>> We start Eclipse and import a test fixture project into the workspace.
>> The project is a plug-in project. It declares a dependency to
>> "org.eclipse.ui" which Eclipse fails to resolve during Maven test
>> execution.
>>
>> I figured out why it is not working with maven: The per default
>> enabled target platform does not provide “org.eclipse.ui”. It merely
>> provides some “org.eclipse.equinox.launcher.*” and “org.eclipse.osgi”
>> plug-ins.  Consequently, Eclipse cannot build the project.
>>
>> The default target platform path points to a "plugins" directory
>> located in %ECLIPSE_HOME% which in turn points to
>> "myTestProject/target/work/" during the maven test run. But
>> "myTestProject/target/work/plugins" only contains the launcher bundles
>> - which makes perfectly sense given the configuration but isn’t
>> exactly what we need.
>>
>> I'm now searching for means to specify a target platform that contains
>> org.eclipse.ui. My preferred solution would be to copy all bundles
>> used to start eclipse into  %ECLIPSE_HOME%/plugins. Is there an option
>> in maven-osgi-test-plugin to enable this?
>>
>> Greets
>> Johannes Lerch
>

example-project.zip (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Eclipse UI-Tests with maven-osgi-test-plugin

Igor Fedorenko-2
What dependencies are missing and how do you expect Tycho to know about
them?

Generally, Tycho is expected to populate test runtime with contents of
project build target platform plus dependencies specified via
<dependencies/> maven-osgi-test-plugin maven plugin configuration. If
your test depends on a particular bundle to be present, add the required
bundle as a dependency in test bundle manifest.

--
Regards,
Igor

On 11-02-17 11:50 AM, Johannes Lerch wrote:

> Hi,
>
> thanks for your reply. I guess you mean something similar to this snippet:
>       <plugin>
>          <groupId>org.sonatype.tycho</groupId>
>          <artifactId>target-platform-configuration</artifactId>
>          <version>${tycho-version}</version>
>          <configuration>
>            <resolver>p2</resolver>
>          </configuration>
>        </plugin>
>
> I have that already in my configuration, but is that snippet really
> responsible for the target platform in eclipse? My understanding was,
> that this is required to resolve bundle dependencies during the build
> process using update-sites.
>
> Just to be clear, my problem is not resolving the dependencies to
> launch my test. My problem ist that the default target platform in the
> eclipse instance launched by maven is nearly empty causing my tests to
> fail.
>
> I attached an example test project so you can see what I mean. Just
> unpack it and run mvn clean install. It should launch eclipse and
> SWTBot will automatically create a Plug-in Project with dependencies
> to org.eclipse.ui and org.eclipse.core.runtime. The bot will fall to
> sleep after that so you can click around in eclipse to see, that there
> are errors in MANIFEST.MF telling you the dependencies are not
> resolvable. If you check the target platform in
> Window->Preferences->Plug-In Project Development->Target Platform you
> can see that the default target platform is pointing to a nearly empty
> location.
>
> Regards,
> Johannes Lerch
>
>
> 2011/2/17 Igor Fedorenko<[hidden email]>:
>> Tycho is expected to resolve project dependencies from p2 repositories
>> specified in pom.xml. Demo project [1] shows how to do it.
>>
>> Although not related to the problem you see, you will also need to
>> specify useUIHarness=true and useUIThread=false maven-osgi-test-plugin
>> plugin parameters, in order to avoid some swtbot related test deadlocks.
>>
>> [1] https://github.com/sonatype/sonatype-tycho/tree/master/tycho-demo/itp01
>>
>> --
>> Regards,
>> Igor
>>
>> On 11-02-17 11:03 AM, Johannes Lerch wrote:
>>>
>>> Hi,
>>>
>>> I'm using SWTBot for doing UI-Testing in Eclipse. The tests work quite
>>> well when started as "SWTBot-Tests" from Eclipse. When executed from
>>> Maven, however, they fail because the Eclipse instance started by
>>> Maven fails to resolve the dependencies of our test data fixture
>>> project we use for testing.
>>>
>>> Our setup is as follows:
>>>
>>> We start Eclipse and import a test fixture project into the workspace.
>>> The project is a plug-in project. It declares a dependency to
>>> "org.eclipse.ui" which Eclipse fails to resolve during Maven test
>>> execution.
>>>
>>> I figured out why it is not working with maven: The per default
>>> enabled target platform does not provide “org.eclipse.ui”. It merely
>>> provides some “org.eclipse.equinox.launcher.*” and “org.eclipse.osgi”
>>> plug-ins.  Consequently, Eclipse cannot build the project.
>>>
>>> The default target platform path points to a "plugins" directory
>>> located in %ECLIPSE_HOME% which in turn points to
>>> "myTestProject/target/work/" during the maven test run. But
>>> "myTestProject/target/work/plugins" only contains the launcher bundles
>>> - which makes perfectly sense given the configuration but isn’t
>>> exactly what we need.
>>>
>>> I'm now searching for means to specify a target platform that contains
>>> org.eclipse.ui. My preferred solution would be to copy all bundles
>>> used to start eclipse into  %ECLIPSE_HOME%/plugins. Is there an option
>>> in maven-osgi-test-plugin to enable this?
>>>
>>> Greets
>>> Johannes Lerch
>>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Eclipse UI-Tests with maven-osgi-test-plugin

Johannes Lerch
My test (not the example) depends on particular bundles to be present,
but i manged to have them available! Again, that's not my problem.

For the build itself no dependencies are missing. Did you run the
example? If yes, did it work that SWTBot creates the plug-in project?
If you look into that created project you can see, that there are
dependencies in the MANIFEST.MF that can not be resolved. This is as
described in my first mail caused by the fact that %ECLIPSE_HOME%
contains not what it normally contains if the test would be executed
without maven.

You may decide that Tycho is not responsible to setup %ECLIPSE_HOME%
directory contents correctly, but if that is your decision, I wonder
why %ECLIPSE_HOME% is defined by Tycho.


2011/2/17 Igor Fedorenko <[hidden email]>:

> What dependencies are missing and how do you expect Tycho to know about
> them?
>
> Generally, Tycho is expected to populate test runtime with contents of
> project build target platform plus dependencies specified via
> <dependencies/> maven-osgi-test-plugin maven plugin configuration. If
> your test depends on a particular bundle to be present, add the required
> bundle as a dependency in test bundle manifest.
>
> --
> Regards,
> Igor
>
> On 11-02-17 11:50 AM, Johannes Lerch wrote:
>>
>> Hi,
>>
>> thanks for your reply. I guess you mean something similar to this snippet:
>>      <plugin>
>>         <groupId>org.sonatype.tycho</groupId>
>>         <artifactId>target-platform-configuration</artifactId>
>>         <version>${tycho-version}</version>
>>         <configuration>
>>           <resolver>p2</resolver>
>>         </configuration>
>>       </plugin>
>>
>> I have that already in my configuration, but is that snippet really
>> responsible for the target platform in eclipse? My understanding was,
>> that this is required to resolve bundle dependencies during the build
>> process using update-sites.
>>
>> Just to be clear, my problem is not resolving the dependencies to
>> launch my test. My problem ist that the default target platform in the
>> eclipse instance launched by maven is nearly empty causing my tests to
>> fail.
>>
>> I attached an example test project so you can see what I mean. Just
>> unpack it and run mvn clean install. It should launch eclipse and
>> SWTBot will automatically create a Plug-in Project with dependencies
>> to org.eclipse.ui and org.eclipse.core.runtime. The bot will fall to
>> sleep after that so you can click around in eclipse to see, that there
>> are errors in MANIFEST.MF telling you the dependencies are not
>> resolvable. If you check the target platform in
>> Window->Preferences->Plug-In Project Development->Target Platform you
>> can see that the default target platform is pointing to a nearly empty
>> location.
>>
>> Regards,
>> Johannes Lerch
>>
>>
>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>
>>> Tycho is expected to resolve project dependencies from p2 repositories
>>> specified in pom.xml. Demo project [1] shows how to do it.
>>>
>>> Although not related to the problem you see, you will also need to
>>> specify useUIHarness=true and useUIThread=false maven-osgi-test-plugin
>>> plugin parameters, in order to avoid some swtbot related test deadlocks.
>>>
>>> [1]
>>> https://github.com/sonatype/sonatype-tycho/tree/master/tycho-demo/itp01
>>>
>>> --
>>> Regards,
>>> Igor
>>>
>>> On 11-02-17 11:03 AM, Johannes Lerch wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm using SWTBot for doing UI-Testing in Eclipse. The tests work quite
>>>> well when started as "SWTBot-Tests" from Eclipse. When executed from
>>>> Maven, however, they fail because the Eclipse instance started by
>>>> Maven fails to resolve the dependencies of our test data fixture
>>>> project we use for testing.
>>>>
>>>> Our setup is as follows:
>>>>
>>>> We start Eclipse and import a test fixture project into the workspace.
>>>> The project is a plug-in project. It declares a dependency to
>>>> "org.eclipse.ui" which Eclipse fails to resolve during Maven test
>>>> execution.
>>>>
>>>> I figured out why it is not working with maven: The per default
>>>> enabled target platform does not provide “org.eclipse.ui”. It merely
>>>> provides some “org.eclipse.equinox.launcher.*” and “org.eclipse.osgi”
>>>> plug-ins.  Consequently, Eclipse cannot build the project.
>>>>
>>>> The default target platform path points to a "plugins" directory
>>>> located in %ECLIPSE_HOME% which in turn points to
>>>> "myTestProject/target/work/" during the maven test run. But
>>>> "myTestProject/target/work/plugins" only contains the launcher bundles
>>>> - which makes perfectly sense given the configuration but isn’t
>>>> exactly what we need.
>>>>
>>>> I'm now searching for means to specify a target platform that contains
>>>> org.eclipse.ui. My preferred solution would be to copy all bundles
>>>> used to start eclipse into  %ECLIPSE_HOME%/plugins. Is there an option
>>>> in maven-osgi-test-plugin to enable this?
>>>>
>>>> Greets
>>>> Johannes Lerch
>>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Eclipse UI-Tests with maven-osgi-test-plugin

Igor Fedorenko-2
Tycho uses perfectly correct eclipse installation layout for test
runtime, where all bundles are specified via
target/work/configuration/config.ini file. If you check this file,
you'll see that org.eclipse.ui bundle with correct version is listed there.

Looks like PDE does not like this layout and, quite honestly, I am happy
to blame this on PDE because unresolved dependencies are clearly part of
the test eclipse runtime.

I think there are three approaches to solve this.

Change Tycho to use PDE-compatible test eclipse installation layout. I
do not know enough about PDE IDE to tell what layouts it likes, so
somebody will have to provide more information before we can tell if
this is something we'll consider.

Another option is to manage workspace target platform from within your
swtbot test. This is probably the most "correct" solution as it properly
separates ide and workspace target platform.

And, of course, you can talk to PDE developers to see if they can adjust
their code to work with installation layout created by Tycho.

--
Regards,
Igor

On 11-02-17 12:26 PM, Johannes Lerch wrote:

> My test (not the example) depends on particular bundles to be present,
> but i manged to have them available! Again, that's not my problem.
>
> For the build itself no dependencies are missing. Did you run the
> example? If yes, did it work that SWTBot creates the plug-in project?
> If you look into that created project you can see, that there are
> dependencies in the MANIFEST.MF that can not be resolved. This is as
> described in my first mail caused by the fact that %ECLIPSE_HOME%
> contains not what it normally contains if the test would be executed
> without maven.
>
> You may decide that Tycho is not responsible to setup %ECLIPSE_HOME%
> directory contents correctly, but if that is your decision, I wonder
> why %ECLIPSE_HOME% is defined by Tycho.
>
>
> 2011/2/17 Igor Fedorenko<[hidden email]>:
>> What dependencies are missing and how do you expect Tycho to know about
>> them?
>>
>> Generally, Tycho is expected to populate test runtime with contents of
>> project build target platform plus dependencies specified via
>> <dependencies/>  maven-osgi-test-plugin maven plugin configuration. If
>> your test depends on a particular bundle to be present, add the required
>> bundle as a dependency in test bundle manifest.
>>
>> --
>> Regards,
>> Igor
>>
>> On 11-02-17 11:50 AM, Johannes Lerch wrote:
>>>
>>> Hi,
>>>
>>> thanks for your reply. I guess you mean something similar to this snippet:
>>>       <plugin>
>>>          <groupId>org.sonatype.tycho</groupId>
>>>          <artifactId>target-platform-configuration</artifactId>
>>>          <version>${tycho-version}</version>
>>>          <configuration>
>>>            <resolver>p2</resolver>
>>>          </configuration>
>>>        </plugin>
>>>
>>> I have that already in my configuration, but is that snippet really
>>> responsible for the target platform in eclipse? My understanding was,
>>> that this is required to resolve bundle dependencies during the build
>>> process using update-sites.
>>>
>>> Just to be clear, my problem is not resolving the dependencies to
>>> launch my test. My problem ist that the default target platform in the
>>> eclipse instance launched by maven is nearly empty causing my tests to
>>> fail.
>>>
>>> I attached an example test project so you can see what I mean. Just
>>> unpack it and run mvn clean install. It should launch eclipse and
>>> SWTBot will automatically create a Plug-in Project with dependencies
>>> to org.eclipse.ui and org.eclipse.core.runtime. The bot will fall to
>>> sleep after that so you can click around in eclipse to see, that there
>>> are errors in MANIFEST.MF telling you the dependencies are not
>>> resolvable. If you check the target platform in
>>> Window->Preferences->Plug-In Project Development->Target Platform you
>>> can see that the default target platform is pointing to a nearly empty
>>> location.
>>>
>>> Regards,
>>> Johannes Lerch
>>>
>>>
>>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>>
>>>> Tycho is expected to resolve project dependencies from p2 repositories
>>>> specified in pom.xml. Demo project [1] shows how to do it.
>>>>
>>>> Although not related to the problem you see, you will also need to
>>>> specify useUIHarness=true and useUIThread=false maven-osgi-test-plugin
>>>> plugin parameters, in order to avoid some swtbot related test deadlocks.
>>>>
>>>> [1]
>>>> https://github.com/sonatype/sonatype-tycho/tree/master/tycho-demo/itp01
>>>>
>>>> --
>>>> Regards,
>>>> Igor
>>>>
>>>> On 11-02-17 11:03 AM, Johannes Lerch wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I'm using SWTBot for doing UI-Testing in Eclipse. The tests work quite
>>>>> well when started as "SWTBot-Tests" from Eclipse. When executed from
>>>>> Maven, however, they fail because the Eclipse instance started by
>>>>> Maven fails to resolve the dependencies of our test data fixture
>>>>> project we use for testing.
>>>>>
>>>>> Our setup is as follows:
>>>>>
>>>>> We start Eclipse and import a test fixture project into the workspace.
>>>>> The project is a plug-in project. It declares a dependency to
>>>>> "org.eclipse.ui" which Eclipse fails to resolve during Maven test
>>>>> execution.
>>>>>
>>>>> I figured out why it is not working with maven: The per default
>>>>> enabled target platform does not provide “org.eclipse.ui”. It merely
>>>>> provides some “org.eclipse.equinox.launcher.*” and “org.eclipse.osgi”
>>>>> plug-ins.  Consequently, Eclipse cannot build the project.
>>>>>
>>>>> The default target platform path points to a "plugins" directory
>>>>> located in %ECLIPSE_HOME% which in turn points to
>>>>> "myTestProject/target/work/" during the maven test run. But
>>>>> "myTestProject/target/work/plugins" only contains the launcher bundles
>>>>> - which makes perfectly sense given the configuration but isn’t
>>>>> exactly what we need.
>>>>>
>>>>> I'm now searching for means to specify a target platform that contains
>>>>> org.eclipse.ui. My preferred solution would be to copy all bundles
>>>>> used to start eclipse into  %ECLIPSE_HOME%/plugins. Is there an option
>>>>> in maven-osgi-test-plugin to enable this?
>>>>>
>>>>> Greets
>>>>> Johannes Lerch
>>>>
>>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Eclipse UI-Tests with maven-osgi-test-plugin

Johannes Lerch
Okay. Thanks for your estimation. I already thought about the SWTBot
solution, but my project lead is not that happy with it.
I'm primarily looking for a solution I can get within the next days,
what will not be possible for PDE I think. Hopefully there is a way to
do it with maven. But if I get you right, the tycho plugin must be
updated too?



2011/2/17 Igor Fedorenko <[hidden email]>:

> Tycho uses perfectly correct eclipse installation layout for test
> runtime, where all bundles are specified via
> target/work/configuration/config.ini file. If you check this file,
> you'll see that org.eclipse.ui bundle with correct version is listed there.
>
> Looks like PDE does not like this layout and, quite honestly, I am happy
> to blame this on PDE because unresolved dependencies are clearly part of
> the test eclipse runtime.
>
> I think there are three approaches to solve this.
>
> Change Tycho to use PDE-compatible test eclipse installation layout. I
> do not know enough about PDE IDE to tell what layouts it likes, so
> somebody will have to provide more information before we can tell if
> this is something we'll consider.
>
> Another option is to manage workspace target platform from within your
> swtbot test. This is probably the most "correct" solution as it properly
> separates ide and workspace target platform.
>
> And, of course, you can talk to PDE developers to see if they can adjust
> their code to work with installation layout created by Tycho.
>
> --
> Regards,
> Igor
>
> On 11-02-17 12:26 PM, Johannes Lerch wrote:
>>
>> My test (not the example) depends on particular bundles to be present,
>> but i manged to have them available! Again, that's not my problem.
>>
>> For the build itself no dependencies are missing. Did you run the
>> example? If yes, did it work that SWTBot creates the plug-in project?
>> If you look into that created project you can see, that there are
>> dependencies in the MANIFEST.MF that can not be resolved. This is as
>> described in my first mail caused by the fact that %ECLIPSE_HOME%
>> contains not what it normally contains if the test would be executed
>> without maven.
>>
>> You may decide that Tycho is not responsible to setup %ECLIPSE_HOME%
>> directory contents correctly, but if that is your decision, I wonder
>> why %ECLIPSE_HOME% is defined by Tycho.
>>
>>
>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>
>>> What dependencies are missing and how do you expect Tycho to know about
>>> them?
>>>
>>> Generally, Tycho is expected to populate test runtime with contents of
>>> project build target platform plus dependencies specified via
>>> <dependencies/>  maven-osgi-test-plugin maven plugin configuration. If
>>> your test depends on a particular bundle to be present, add the required
>>> bundle as a dependency in test bundle manifest.
>>>
>>> --
>>> Regards,
>>> Igor
>>>
>>> On 11-02-17 11:50 AM, Johannes Lerch wrote:
>>>>
>>>> Hi,
>>>>
>>>> thanks for your reply. I guess you mean something similar to this
>>>> snippet:
>>>>      <plugin>
>>>>         <groupId>org.sonatype.tycho</groupId>
>>>>         <artifactId>target-platform-configuration</artifactId>
>>>>         <version>${tycho-version}</version>
>>>>         <configuration>
>>>>           <resolver>p2</resolver>
>>>>         </configuration>
>>>>       </plugin>
>>>>
>>>> I have that already in my configuration, but is that snippet really
>>>> responsible for the target platform in eclipse? My understanding was,
>>>> that this is required to resolve bundle dependencies during the build
>>>> process using update-sites.
>>>>
>>>> Just to be clear, my problem is not resolving the dependencies to
>>>> launch my test. My problem ist that the default target platform in the
>>>> eclipse instance launched by maven is nearly empty causing my tests to
>>>> fail.
>>>>
>>>> I attached an example test project so you can see what I mean. Just
>>>> unpack it and run mvn clean install. It should launch eclipse and
>>>> SWTBot will automatically create a Plug-in Project with dependencies
>>>> to org.eclipse.ui and org.eclipse.core.runtime. The bot will fall to
>>>> sleep after that so you can click around in eclipse to see, that there
>>>> are errors in MANIFEST.MF telling you the dependencies are not
>>>> resolvable. If you check the target platform in
>>>> Window->Preferences->Plug-In Project Development->Target Platform you
>>>> can see that the default target platform is pointing to a nearly empty
>>>> location.
>>>>
>>>> Regards,
>>>> Johannes Lerch
>>>>
>>>>
>>>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>>>
>>>>> Tycho is expected to resolve project dependencies from p2 repositories
>>>>> specified in pom.xml. Demo project [1] shows how to do it.
>>>>>
>>>>> Although not related to the problem you see, you will also need to
>>>>> specify useUIHarness=true and useUIThread=false maven-osgi-test-plugin
>>>>> plugin parameters, in order to avoid some swtbot related test
>>>>> deadlocks.
>>>>>
>>>>> [1]
>>>>> https://github.com/sonatype/sonatype-tycho/tree/master/tycho-demo/itp01
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Igor
>>>>>
>>>>> On 11-02-17 11:03 AM, Johannes Lerch wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm using SWTBot for doing UI-Testing in Eclipse. The tests work quite
>>>>>> well when started as "SWTBot-Tests" from Eclipse. When executed from
>>>>>> Maven, however, they fail because the Eclipse instance started by
>>>>>> Maven fails to resolve the dependencies of our test data fixture
>>>>>> project we use for testing.
>>>>>>
>>>>>> Our setup is as follows:
>>>>>>
>>>>>> We start Eclipse and import a test fixture project into the workspace.
>>>>>> The project is a plug-in project. It declares a dependency to
>>>>>> "org.eclipse.ui" which Eclipse fails to resolve during Maven test
>>>>>> execution.
>>>>>>
>>>>>> I figured out why it is not working with maven: The per default
>>>>>> enabled target platform does not provide “org.eclipse.ui”. It merely
>>>>>> provides some “org.eclipse.equinox.launcher.*” and “org.eclipse.osgi”
>>>>>> plug-ins.  Consequently, Eclipse cannot build the project.
>>>>>>
>>>>>> The default target platform path points to a "plugins" directory
>>>>>> located in %ECLIPSE_HOME% which in turn points to
>>>>>> "myTestProject/target/work/" during the maven test run. But
>>>>>> "myTestProject/target/work/plugins" only contains the launcher bundles
>>>>>> - which makes perfectly sense given the configuration but isn’t
>>>>>> exactly what we need.
>>>>>>
>>>>>> I'm now searching for means to specify a target platform that contains
>>>>>> org.eclipse.ui. My preferred solution would be to copy all bundles
>>>>>> used to start eclipse into  %ECLIPSE_HOME%/plugins. Is there an option
>>>>>> in maven-osgi-test-plugin to enable this?
>>>>>>
>>>>>> Greets
>>>>>> Johannes Lerch
>>>>>
>>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Eclipse UI-Tests with maven-osgi-test-plugin

Igor Fedorenko-2
I don't know what PDE IDE expects, so can't tell if/how Tycho needs to
be changed to make PDE happy.

--
Regards,
Igor

On 11-02-17 02:03 PM, Johannes Lerch wrote:

> Okay. Thanks for your estimation. I already thought about the SWTBot
> solution, but my project lead is not that happy with it.
> I'm primarily looking for a solution I can get within the next days,
> what will not be possible for PDE I think. Hopefully there is a way to
> do it with maven. But if I get you right, the tycho plugin must be
> updated too?
>
>
>
> 2011/2/17 Igor Fedorenko<[hidden email]>:
>> Tycho uses perfectly correct eclipse installation layout for test
>> runtime, where all bundles are specified via
>> target/work/configuration/config.ini file. If you check this file,
>> you'll see that org.eclipse.ui bundle with correct version is listed there.
>>
>> Looks like PDE does not like this layout and, quite honestly, I am happy
>> to blame this on PDE because unresolved dependencies are clearly part of
>> the test eclipse runtime.
>>
>> I think there are three approaches to solve this.
>>
>> Change Tycho to use PDE-compatible test eclipse installation layout. I
>> do not know enough about PDE IDE to tell what layouts it likes, so
>> somebody will have to provide more information before we can tell if
>> this is something we'll consider.
>>
>> Another option is to manage workspace target platform from within your
>> swtbot test. This is probably the most "correct" solution as it properly
>> separates ide and workspace target platform.
>>
>> And, of course, you can talk to PDE developers to see if they can adjust
>> their code to work with installation layout created by Tycho.
>>
>> --
>> Regards,
>> Igor
>>
>> On 11-02-17 12:26 PM, Johannes Lerch wrote:
>>>
>>> My test (not the example) depends on particular bundles to be present,
>>> but i manged to have them available! Again, that's not my problem.
>>>
>>> For the build itself no dependencies are missing. Did you run the
>>> example? If yes, did it work that SWTBot creates the plug-in project?
>>> If you look into that created project you can see, that there are
>>> dependencies in the MANIFEST.MF that can not be resolved. This is as
>>> described in my first mail caused by the fact that %ECLIPSE_HOME%
>>> contains not what it normally contains if the test would be executed
>>> without maven.
>>>
>>> You may decide that Tycho is not responsible to setup %ECLIPSE_HOME%
>>> directory contents correctly, but if that is your decision, I wonder
>>> why %ECLIPSE_HOME% is defined by Tycho.
>>>
>>>
>>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>>
>>>> What dependencies are missing and how do you expect Tycho to know about
>>>> them?
>>>>
>>>> Generally, Tycho is expected to populate test runtime with contents of
>>>> project build target platform plus dependencies specified via
>>>> <dependencies/>    maven-osgi-test-plugin maven plugin configuration. If
>>>> your test depends on a particular bundle to be present, add the required
>>>> bundle as a dependency in test bundle manifest.
>>>>
>>>> --
>>>> Regards,
>>>> Igor
>>>>
>>>> On 11-02-17 11:50 AM, Johannes Lerch wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> thanks for your reply. I guess you mean something similar to this
>>>>> snippet:
>>>>>       <plugin>
>>>>>          <groupId>org.sonatype.tycho</groupId>
>>>>>          <artifactId>target-platform-configuration</artifactId>
>>>>>          <version>${tycho-version}</version>
>>>>>          <configuration>
>>>>>            <resolver>p2</resolver>
>>>>>          </configuration>
>>>>>        </plugin>
>>>>>
>>>>> I have that already in my configuration, but is that snippet really
>>>>> responsible for the target platform in eclipse? My understanding was,
>>>>> that this is required to resolve bundle dependencies during the build
>>>>> process using update-sites.
>>>>>
>>>>> Just to be clear, my problem is not resolving the dependencies to
>>>>> launch my test. My problem ist that the default target platform in the
>>>>> eclipse instance launched by maven is nearly empty causing my tests to
>>>>> fail.
>>>>>
>>>>> I attached an example test project so you can see what I mean. Just
>>>>> unpack it and run mvn clean install. It should launch eclipse and
>>>>> SWTBot will automatically create a Plug-in Project with dependencies
>>>>> to org.eclipse.ui and org.eclipse.core.runtime. The bot will fall to
>>>>> sleep after that so you can click around in eclipse to see, that there
>>>>> are errors in MANIFEST.MF telling you the dependencies are not
>>>>> resolvable. If you check the target platform in
>>>>> Window->Preferences->Plug-In Project Development->Target Platform you
>>>>> can see that the default target platform is pointing to a nearly empty
>>>>> location.
>>>>>
>>>>> Regards,
>>>>> Johannes Lerch
>>>>>
>>>>>
>>>>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>>>>
>>>>>> Tycho is expected to resolve project dependencies from p2 repositories
>>>>>> specified in pom.xml. Demo project [1] shows how to do it.
>>>>>>
>>>>>> Although not related to the problem you see, you will also need to
>>>>>> specify useUIHarness=true and useUIThread=false maven-osgi-test-plugin
>>>>>> plugin parameters, in order to avoid some swtbot related test
>>>>>> deadlocks.
>>>>>>
>>>>>> [1]
>>>>>> https://github.com/sonatype/sonatype-tycho/tree/master/tycho-demo/itp01
>>>>>>
>>>>>> --
>>>>>> Regards,
>>>>>> Igor
>>>>>>
>>>>>> On 11-02-17 11:03 AM, Johannes Lerch wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm using SWTBot for doing UI-Testing in Eclipse. The tests work quite
>>>>>>> well when started as "SWTBot-Tests" from Eclipse. When executed from
>>>>>>> Maven, however, they fail because the Eclipse instance started by
>>>>>>> Maven fails to resolve the dependencies of our test data fixture
>>>>>>> project we use for testing.
>>>>>>>
>>>>>>> Our setup is as follows:
>>>>>>>
>>>>>>> We start Eclipse and import a test fixture project into the workspace.
>>>>>>> The project is a plug-in project. It declares a dependency to
>>>>>>> "org.eclipse.ui" which Eclipse fails to resolve during Maven test
>>>>>>> execution.
>>>>>>>
>>>>>>> I figured out why it is not working with maven: The per default
>>>>>>> enabled target platform does not provide “org.eclipse.ui”. It merely
>>>>>>> provides some “org.eclipse.equinox.launcher.*” and “org.eclipse.osgi”
>>>>>>> plug-ins.  Consequently, Eclipse cannot build the project.
>>>>>>>
>>>>>>> The default target platform path points to a "plugins" directory
>>>>>>> located in %ECLIPSE_HOME% which in turn points to
>>>>>>> "myTestProject/target/work/" during the maven test run. But
>>>>>>> "myTestProject/target/work/plugins" only contains the launcher bundles
>>>>>>> - which makes perfectly sense given the configuration but isn’t
>>>>>>> exactly what we need.
>>>>>>>
>>>>>>> I'm now searching for means to specify a target platform that contains
>>>>>>> org.eclipse.ui. My preferred solution would be to copy all bundles
>>>>>>> used to start eclipse into  %ECLIPSE_HOME%/plugins. Is there an option
>>>>>>> in maven-osgi-test-plugin to enable this?
>>>>>>>
>>>>>>> Greets
>>>>>>> Johannes Lerch
>>>>>>
>>>>
>>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Eclipse UI-Tests with maven-osgi-test-plugin

Johannes Lerch
I asked in the PDE forum about what they expect, especially what is
wrong with the configuration tycho provides.
Link to the topic: http://www.eclipse.org/forums/index.php?t=msg&goto=655133


2011/2/17 Igor Fedorenko <[hidden email]>:

> I don't know what PDE IDE expects, so can't tell if/how Tycho needs to
> be changed to make PDE happy.
>
> --
> Regards,
> Igor
>
> On 11-02-17 02:03 PM, Johannes Lerch wrote:
>>
>> Okay. Thanks for your estimation. I already thought about the SWTBot
>> solution, but my project lead is not that happy with it.
>> I'm primarily looking for a solution I can get within the next days,
>> what will not be possible for PDE I think. Hopefully there is a way to
>> do it with maven. But if I get you right, the tycho plugin must be
>> updated too?
>>
>>
>>
>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>
>>> Tycho uses perfectly correct eclipse installation layout for test
>>> runtime, where all bundles are specified via
>>> target/work/configuration/config.ini file. If you check this file,
>>> you'll see that org.eclipse.ui bundle with correct version is listed
>>> there.
>>>
>>> Looks like PDE does not like this layout and, quite honestly, I am happy
>>> to blame this on PDE because unresolved dependencies are clearly part of
>>> the test eclipse runtime.
>>>
>>> I think there are three approaches to solve this.
>>>
>>> Change Tycho to use PDE-compatible test eclipse installation layout. I
>>> do not know enough about PDE IDE to tell what layouts it likes, so
>>> somebody will have to provide more information before we can tell if
>>> this is something we'll consider.
>>>
>>> Another option is to manage workspace target platform from within your
>>> swtbot test. This is probably the most "correct" solution as it properly
>>> separates ide and workspace target platform.
>>>
>>> And, of course, you can talk to PDE developers to see if they can adjust
>>> their code to work with installation layout created by Tycho.
>>>
>>> --
>>> Regards,
>>> Igor
>>>
>>> On 11-02-17 12:26 PM, Johannes Lerch wrote:
>>>>
>>>> My test (not the example) depends on particular bundles to be present,
>>>> but i manged to have them available! Again, that's not my problem.
>>>>
>>>> For the build itself no dependencies are missing. Did you run the
>>>> example? If yes, did it work that SWTBot creates the plug-in project?
>>>> If you look into that created project you can see, that there are
>>>> dependencies in the MANIFEST.MF that can not be resolved. This is as
>>>> described in my first mail caused by the fact that %ECLIPSE_HOME%
>>>> contains not what it normally contains if the test would be executed
>>>> without maven.
>>>>
>>>> You may decide that Tycho is not responsible to setup %ECLIPSE_HOME%
>>>> directory contents correctly, but if that is your decision, I wonder
>>>> why %ECLIPSE_HOME% is defined by Tycho.
>>>>
>>>>
>>>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>>>
>>>>> What dependencies are missing and how do you expect Tycho to know about
>>>>> them?
>>>>>
>>>>> Generally, Tycho is expected to populate test runtime with contents of
>>>>> project build target platform plus dependencies specified via
>>>>> <dependencies/>    maven-osgi-test-plugin maven plugin configuration.
>>>>> If
>>>>> your test depends on a particular bundle to be present, add the
>>>>> required
>>>>> bundle as a dependency in test bundle manifest.
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Igor
>>>>>
>>>>> On 11-02-17 11:50 AM, Johannes Lerch wrote:
>>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> thanks for your reply. I guess you mean something similar to this
>>>>>> snippet:
>>>>>>      <plugin>
>>>>>>         <groupId>org.sonatype.tycho</groupId>
>>>>>>         <artifactId>target-platform-configuration</artifactId>
>>>>>>         <version>${tycho-version}</version>
>>>>>>         <configuration>
>>>>>>           <resolver>p2</resolver>
>>>>>>         </configuration>
>>>>>>       </plugin>
>>>>>>
>>>>>> I have that already in my configuration, but is that snippet really
>>>>>> responsible for the target platform in eclipse? My understanding was,
>>>>>> that this is required to resolve bundle dependencies during the build
>>>>>> process using update-sites.
>>>>>>
>>>>>> Just to be clear, my problem is not resolving the dependencies to
>>>>>> launch my test. My problem ist that the default target platform in the
>>>>>> eclipse instance launched by maven is nearly empty causing my tests to
>>>>>> fail.
>>>>>>
>>>>>> I attached an example test project so you can see what I mean. Just
>>>>>> unpack it and run mvn clean install. It should launch eclipse and
>>>>>> SWTBot will automatically create a Plug-in Project with dependencies
>>>>>> to org.eclipse.ui and org.eclipse.core.runtime. The bot will fall to
>>>>>> sleep after that so you can click around in eclipse to see, that there
>>>>>> are errors in MANIFEST.MF telling you the dependencies are not
>>>>>> resolvable. If you check the target platform in
>>>>>> Window->Preferences->Plug-In Project Development->Target Platform you
>>>>>> can see that the default target platform is pointing to a nearly empty
>>>>>> location.
>>>>>>
>>>>>> Regards,
>>>>>> Johannes Lerch
>>>>>>
>>>>>>
>>>>>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>>>>>
>>>>>>> Tycho is expected to resolve project dependencies from p2
>>>>>>> repositories
>>>>>>> specified in pom.xml. Demo project [1] shows how to do it.
>>>>>>>
>>>>>>> Although not related to the problem you see, you will also need to
>>>>>>> specify useUIHarness=true and useUIThread=false
>>>>>>> maven-osgi-test-plugin
>>>>>>> plugin parameters, in order to avoid some swtbot related test
>>>>>>> deadlocks.
>>>>>>>
>>>>>>> [1]
>>>>>>>
>>>>>>> https://github.com/sonatype/sonatype-tycho/tree/master/tycho-demo/itp01
>>>>>>>
>>>>>>> --
>>>>>>> Regards,
>>>>>>> Igor
>>>>>>>
>>>>>>> On 11-02-17 11:03 AM, Johannes Lerch wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> I'm using SWTBot for doing UI-Testing in Eclipse. The tests work
>>>>>>>> quite
>>>>>>>> well when started as "SWTBot-Tests" from Eclipse. When executed from
>>>>>>>> Maven, however, they fail because the Eclipse instance started by
>>>>>>>> Maven fails to resolve the dependencies of our test data fixture
>>>>>>>> project we use for testing.
>>>>>>>>
>>>>>>>> Our setup is as follows:
>>>>>>>>
>>>>>>>> We start Eclipse and import a test fixture project into the
>>>>>>>> workspace.
>>>>>>>> The project is a plug-in project. It declares a dependency to
>>>>>>>> "org.eclipse.ui" which Eclipse fails to resolve during Maven test
>>>>>>>> execution.
>>>>>>>>
>>>>>>>> I figured out why it is not working with maven: The per default
>>>>>>>> enabled target platform does not provide “org.eclipse.ui”. It merely
>>>>>>>> provides some “org.eclipse.equinox.launcher.*” and
>>>>>>>> “org.eclipse.osgi”
>>>>>>>> plug-ins.  Consequently, Eclipse cannot build the project.
>>>>>>>>
>>>>>>>> The default target platform path points to a "plugins" directory
>>>>>>>> located in %ECLIPSE_HOME% which in turn points to
>>>>>>>> "myTestProject/target/work/" during the maven test run. But
>>>>>>>> "myTestProject/target/work/plugins" only contains the launcher
>>>>>>>> bundles
>>>>>>>> - which makes perfectly sense given the configuration but isn’t
>>>>>>>> exactly what we need.
>>>>>>>>
>>>>>>>> I'm now searching for means to specify a target platform that
>>>>>>>> contains
>>>>>>>> org.eclipse.ui. My preferred solution would be to copy all bundles
>>>>>>>> used to start eclipse into  %ECLIPSE_HOME%/plugins. Is there an
>>>>>>>> option
>>>>>>>> in maven-osgi-test-plugin to enable this?
>>>>>>>>
>>>>>>>> Greets
>>>>>>>> Johannes Lerch
>>>>>>>
>>>>>
>>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Eclipse UI-Tests with maven-osgi-test-plugin

Johannes Lerch
Hi again,

just got some time to look deeper into the code of PDE. What I found
is, that they do not use the bundles listed in config.ini for the
default target platform. Yes, we already noticed that, but i also
found that they use a bundles.info file instead. This file is located
in ${eclipse_home}/configuration/org.eclipse.equinox.simpleconfigurator/
and contains a list of bundle names including their version and
location.
I tried to create that file manually and got the default target
platform running as expected. I guess this file could be easily
created by tycho, as it's content is similar to the config.ini file.

You can find the PDE code reading the bundles.info file in
P2Utils.readBundles(home, configUrl). It is called by resolveBundles()
in class ProfileBundleContainer.

Hopefully this can be fixed now,
Johannes



2011/2/18 Johannes Lerch <[hidden email]>:

> I asked in the PDE forum about what they expect, especially what is
> wrong with the configuration tycho provides.
> Link to the topic: http://www.eclipse.org/forums/index.php?t=msg&goto=655133
>
>
> 2011/2/17 Igor Fedorenko <[hidden email]>:
>> I don't know what PDE IDE expects, so can't tell if/how Tycho needs to
>> be changed to make PDE happy.
>>
>> --
>> Regards,
>> Igor
>>
>> On 11-02-17 02:03 PM, Johannes Lerch wrote:
>>>
>>> Okay. Thanks for your estimation. I already thought about the SWTBot
>>> solution, but my project lead is not that happy with it.
>>> I'm primarily looking for a solution I can get within the next days,
>>> what will not be possible for PDE I think. Hopefully there is a way to
>>> do it with maven. But if I get you right, the tycho plugin must be
>>> updated too?
>>>
>>>
>>>
>>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>>
>>>> Tycho uses perfectly correct eclipse installation layout for test
>>>> runtime, where all bundles are specified via
>>>> target/work/configuration/config.ini file. If you check this file,
>>>> you'll see that org.eclipse.ui bundle with correct version is listed
>>>> there.
>>>>
>>>> Looks like PDE does not like this layout and, quite honestly, I am happy
>>>> to blame this on PDE because unresolved dependencies are clearly part of
>>>> the test eclipse runtime.
>>>>
>>>> I think there are three approaches to solve this.
>>>>
>>>> Change Tycho to use PDE-compatible test eclipse installation layout. I
>>>> do not know enough about PDE IDE to tell what layouts it likes, so
>>>> somebody will have to provide more information before we can tell if
>>>> this is something we'll consider.
>>>>
>>>> Another option is to manage workspace target platform from within your
>>>> swtbot test. This is probably the most "correct" solution as it properly
>>>> separates ide and workspace target platform.
>>>>
>>>> And, of course, you can talk to PDE developers to see if they can adjust
>>>> their code to work with installation layout created by Tycho.
>>>>
>>>> --
>>>> Regards,
>>>> Igor
>>>>
>>>> On 11-02-17 12:26 PM, Johannes Lerch wrote:
>>>>>
>>>>> My test (not the example) depends on particular bundles to be present,
>>>>> but i manged to have them available! Again, that's not my problem.
>>>>>
>>>>> For the build itself no dependencies are missing. Did you run the
>>>>> example? If yes, did it work that SWTBot creates the plug-in project?
>>>>> If you look into that created project you can see, that there are
>>>>> dependencies in the MANIFEST.MF that can not be resolved. This is as
>>>>> described in my first mail caused by the fact that %ECLIPSE_HOME%
>>>>> contains not what it normally contains if the test would be executed
>>>>> without maven.
>>>>>
>>>>> You may decide that Tycho is not responsible to setup %ECLIPSE_HOME%
>>>>> directory contents correctly, but if that is your decision, I wonder
>>>>> why %ECLIPSE_HOME% is defined by Tycho.
>>>>>
>>>>>
>>>>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>>>>
>>>>>> What dependencies are missing and how do you expect Tycho to know about
>>>>>> them?
>>>>>>
>>>>>> Generally, Tycho is expected to populate test runtime with contents of
>>>>>> project build target platform plus dependencies specified via
>>>>>> <dependencies/>    maven-osgi-test-plugin maven plugin configuration.
>>>>>> If
>>>>>> your test depends on a particular bundle to be present, add the
>>>>>> required
>>>>>> bundle as a dependency in test bundle manifest.
>>>>>>
>>>>>> --
>>>>>> Regards,
>>>>>> Igor
>>>>>>
>>>>>> On 11-02-17 11:50 AM, Johannes Lerch wrote:
>>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> thanks for your reply. I guess you mean something similar to this
>>>>>>> snippet:
>>>>>>>      <plugin>
>>>>>>>         <groupId>org.sonatype.tycho</groupId>
>>>>>>>         <artifactId>target-platform-configuration</artifactId>
>>>>>>>         <version>${tycho-version}</version>
>>>>>>>         <configuration>
>>>>>>>           <resolver>p2</resolver>
>>>>>>>         </configuration>
>>>>>>>       </plugin>
>>>>>>>
>>>>>>> I have that already in my configuration, but is that snippet really
>>>>>>> responsible for the target platform in eclipse? My understanding was,
>>>>>>> that this is required to resolve bundle dependencies during the build
>>>>>>> process using update-sites.
>>>>>>>
>>>>>>> Just to be clear, my problem is not resolving the dependencies to
>>>>>>> launch my test. My problem ist that the default target platform in the
>>>>>>> eclipse instance launched by maven is nearly empty causing my tests to
>>>>>>> fail.
>>>>>>>
>>>>>>> I attached an example test project so you can see what I mean. Just
>>>>>>> unpack it and run mvn clean install. It should launch eclipse and
>>>>>>> SWTBot will automatically create a Plug-in Project with dependencies
>>>>>>> to org.eclipse.ui and org.eclipse.core.runtime. The bot will fall to
>>>>>>> sleep after that so you can click around in eclipse to see, that there
>>>>>>> are errors in MANIFEST.MF telling you the dependencies are not
>>>>>>> resolvable. If you check the target platform in
>>>>>>> Window->Preferences->Plug-In Project Development->Target Platform you
>>>>>>> can see that the default target platform is pointing to a nearly empty
>>>>>>> location.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Johannes Lerch
>>>>>>>
>>>>>>>
>>>>>>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>>>>>>
>>>>>>>> Tycho is expected to resolve project dependencies from p2
>>>>>>>> repositories
>>>>>>>> specified in pom.xml. Demo project [1] shows how to do it.
>>>>>>>>
>>>>>>>> Although not related to the problem you see, you will also need to
>>>>>>>> specify useUIHarness=true and useUIThread=false
>>>>>>>> maven-osgi-test-plugin
>>>>>>>> plugin parameters, in order to avoid some swtbot related test
>>>>>>>> deadlocks.
>>>>>>>>
>>>>>>>> [1]
>>>>>>>>
>>>>>>>> https://github.com/sonatype/sonatype-tycho/tree/master/tycho-demo/itp01
>>>>>>>>
>>>>>>>> --
>>>>>>>> Regards,
>>>>>>>> Igor
>>>>>>>>
>>>>>>>> On 11-02-17 11:03 AM, Johannes Lerch wrote:
>>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I'm using SWTBot for doing UI-Testing in Eclipse. The tests work
>>>>>>>>> quite
>>>>>>>>> well when started as "SWTBot-Tests" from Eclipse. When executed from
>>>>>>>>> Maven, however, they fail because the Eclipse instance started by
>>>>>>>>> Maven fails to resolve the dependencies of our test data fixture
>>>>>>>>> project we use for testing.
>>>>>>>>>
>>>>>>>>> Our setup is as follows:
>>>>>>>>>
>>>>>>>>> We start Eclipse and import a test fixture project into the
>>>>>>>>> workspace.
>>>>>>>>> The project is a plug-in project. It declares a dependency to
>>>>>>>>> "org.eclipse.ui" which Eclipse fails to resolve during Maven test
>>>>>>>>> execution.
>>>>>>>>>
>>>>>>>>> I figured out why it is not working with maven: The per default
>>>>>>>>> enabled target platform does not provide “org.eclipse.ui”. It merely
>>>>>>>>> provides some “org.eclipse.equinox.launcher.*” and
>>>>>>>>> “org.eclipse.osgi”
>>>>>>>>> plug-ins.  Consequently, Eclipse cannot build the project.
>>>>>>>>>
>>>>>>>>> The default target platform path points to a "plugins" directory
>>>>>>>>> located in %ECLIPSE_HOME% which in turn points to
>>>>>>>>> "myTestProject/target/work/" during the maven test run. But
>>>>>>>>> "myTestProject/target/work/plugins" only contains the launcher
>>>>>>>>> bundles
>>>>>>>>> - which makes perfectly sense given the configuration but isn’t
>>>>>>>>> exactly what we need.
>>>>>>>>>
>>>>>>>>> I'm now searching for means to specify a target platform that
>>>>>>>>> contains
>>>>>>>>> org.eclipse.ui. My preferred solution would be to copy all bundles
>>>>>>>>> used to start eclipse into  %ECLIPSE_HOME%/plugins. Is there an
>>>>>>>>> option
>>>>>>>>> in maven-osgi-test-plugin to enable this?
>>>>>>>>>
>>>>>>>>> Greets
>>>>>>>>> Johannes Lerch
>>>>>>>>
>>>>>>
>>>>
>>
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Eclipse UI-Tests with maven-osgi-test-plugin

Igor Fedorenko-2
To set the expectations right... there are no immediate plans to change
Tycho to use and/or rely on simpleconfigurator for execution of unit
tests. If you are interested to see such supported added to Tycho you
will have to provide a patch that will allow Tycho users to use
p2-enabled test runtime layout via pom.xml configuration property.

FYI, simpleconfigurator is part of p2 and you can read more about
bundles.info in [1].

[1] http://wiki.eclipse.org/Equinox_p2_Getting_Started
--
Regards,
Igor

On 11-03-25 03:57 AM, Johannes Lerch wrote:

> Hi again,
>
> just got some time to look deeper into the code of PDE. What I found
> is, that they do not use the bundles listed in config.ini for the
> default target platform. Yes, we already noticed that, but i also
> found that they use a bundles.info file instead. This file is located
> in ${eclipse_home}/configuration/org.eclipse.equinox.simpleconfigurator/
> and contains a list of bundle names including their version and
> location.
> I tried to create that file manually and got the default target
> platform running as expected. I guess this file could be easily
> created by tycho, as it's content is similar to the config.ini file.
>
> You can find the PDE code reading the bundles.info file in
> P2Utils.readBundles(home, configUrl). It is called by resolveBundles()
> in class ProfileBundleContainer.
>
> Hopefully this can be fixed now,
> Johannes
>
>
>
> 2011/2/18 Johannes Lerch<[hidden email]>:
>> I asked in the PDE forum about what they expect, especially what is
>> wrong with the configuration tycho provides.
>> Link to the topic: http://www.eclipse.org/forums/index.php?t=msg&goto=655133
>>
>>
>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>> I don't know what PDE IDE expects, so can't tell if/how Tycho needs to
>>> be changed to make PDE happy.
>>>
>>> --
>>> Regards,
>>> Igor
>>>
>>> On 11-02-17 02:03 PM, Johannes Lerch wrote:
>>>>
>>>> Okay. Thanks for your estimation. I already thought about the SWTBot
>>>> solution, but my project lead is not that happy with it.
>>>> I'm primarily looking for a solution I can get within the next days,
>>>> what will not be possible for PDE I think. Hopefully there is a way to
>>>> do it with maven. But if I get you right, the tycho plugin must be
>>>> updated too?
>>>>
>>>>
>>>>
>>>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>>>
>>>>> Tycho uses perfectly correct eclipse installation layout for test
>>>>> runtime, where all bundles are specified via
>>>>> target/work/configuration/config.ini file. If you check this file,
>>>>> you'll see that org.eclipse.ui bundle with correct version is listed
>>>>> there.
>>>>>
>>>>> Looks like PDE does not like this layout and, quite honestly, I am happy
>>>>> to blame this on PDE because unresolved dependencies are clearly part of
>>>>> the test eclipse runtime.
>>>>>
>>>>> I think there are three approaches to solve this.
>>>>>
>>>>> Change Tycho to use PDE-compatible test eclipse installation layout. I
>>>>> do not know enough about PDE IDE to tell what layouts it likes, so
>>>>> somebody will have to provide more information before we can tell if
>>>>> this is something we'll consider.
>>>>>
>>>>> Another option is to manage workspace target platform from within your
>>>>> swtbot test. This is probably the most "correct" solution as it properly
>>>>> separates ide and workspace target platform.
>>>>>
>>>>> And, of course, you can talk to PDE developers to see if they can adjust
>>>>> their code to work with installation layout created by Tycho.
>>>>>
>>>>> --
>>>>> Regards,
>>>>> Igor
>>>>>
>>>>> On 11-02-17 12:26 PM, Johannes Lerch wrote:
>>>>>>
>>>>>> My test (not the example) depends on particular bundles to be present,
>>>>>> but i manged to have them available! Again, that's not my problem.
>>>>>>
>>>>>> For the build itself no dependencies are missing. Did you run the
>>>>>> example? If yes, did it work that SWTBot creates the plug-in project?
>>>>>> If you look into that created project you can see, that there are
>>>>>> dependencies in the MANIFEST.MF that can not be resolved. This is as
>>>>>> described in my first mail caused by the fact that %ECLIPSE_HOME%
>>>>>> contains not what it normally contains if the test would be executed
>>>>>> without maven.
>>>>>>
>>>>>> You may decide that Tycho is not responsible to setup %ECLIPSE_HOME%
>>>>>> directory contents correctly, but if that is your decision, I wonder
>>>>>> why %ECLIPSE_HOME% is defined by Tycho.
>>>>>>
>>>>>>
>>>>>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>>>>>
>>>>>>> What dependencies are missing and how do you expect Tycho to know about
>>>>>>> them?
>>>>>>>
>>>>>>> Generally, Tycho is expected to populate test runtime with contents of
>>>>>>> project build target platform plus dependencies specified via
>>>>>>> <dependencies/>      maven-osgi-test-plugin maven plugin configuration.
>>>>>>> If
>>>>>>> your test depends on a particular bundle to be present, add the
>>>>>>> required
>>>>>>> bundle as a dependency in test bundle manifest.
>>>>>>>
>>>>>>> --
>>>>>>> Regards,
>>>>>>> Igor
>>>>>>>
>>>>>>> On 11-02-17 11:50 AM, Johannes Lerch wrote:
>>>>>>>>
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> thanks for your reply. I guess you mean something similar to this
>>>>>>>> snippet:
>>>>>>>>       <plugin>
>>>>>>>>          <groupId>org.sonatype.tycho</groupId>
>>>>>>>>          <artifactId>target-platform-configuration</artifactId>
>>>>>>>>          <version>${tycho-version}</version>
>>>>>>>>          <configuration>
>>>>>>>>            <resolver>p2</resolver>
>>>>>>>>          </configuration>
>>>>>>>>        </plugin>
>>>>>>>>
>>>>>>>> I have that already in my configuration, but is that snippet really
>>>>>>>> responsible for the target platform in eclipse? My understanding was,
>>>>>>>> that this is required to resolve bundle dependencies during the build
>>>>>>>> process using update-sites.
>>>>>>>>
>>>>>>>> Just to be clear, my problem is not resolving the dependencies to
>>>>>>>> launch my test. My problem ist that the default target platform in the
>>>>>>>> eclipse instance launched by maven is nearly empty causing my tests to
>>>>>>>> fail.
>>>>>>>>
>>>>>>>> I attached an example test project so you can see what I mean. Just
>>>>>>>> unpack it and run mvn clean install. It should launch eclipse and
>>>>>>>> SWTBot will automatically create a Plug-in Project with dependencies
>>>>>>>> to org.eclipse.ui and org.eclipse.core.runtime. The bot will fall to
>>>>>>>> sleep after that so you can click around in eclipse to see, that there
>>>>>>>> are errors in MANIFEST.MF telling you the dependencies are not
>>>>>>>> resolvable. If you check the target platform in
>>>>>>>> Window->Preferences->Plug-In Project Development->Target Platform you
>>>>>>>> can see that the default target platform is pointing to a nearly empty
>>>>>>>> location.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Johannes Lerch
>>>>>>>>
>>>>>>>>
>>>>>>>> 2011/2/17 Igor Fedorenko<[hidden email]>:
>>>>>>>>>
>>>>>>>>> Tycho is expected to resolve project dependencies from p2
>>>>>>>>> repositories
>>>>>>>>> specified in pom.xml. Demo project [1] shows how to do it.
>>>>>>>>>
>>>>>>>>> Although not related to the problem you see, you will also need to
>>>>>>>>> specify useUIHarness=true and useUIThread=false
>>>>>>>>> maven-osgi-test-plugin
>>>>>>>>> plugin parameters, in order to avoid some swtbot related test
>>>>>>>>> deadlocks.
>>>>>>>>>
>>>>>>>>> [1]
>>>>>>>>>
>>>>>>>>> https://github.com/sonatype/sonatype-tycho/tree/master/tycho-demo/itp01
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Regards,
>>>>>>>>> Igor
>>>>>>>>>
>>>>>>>>> On 11-02-17 11:03 AM, Johannes Lerch wrote:
>>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I'm using SWTBot for doing UI-Testing in Eclipse. The tests work
>>>>>>>>>> quite
>>>>>>>>>> well when started as "SWTBot-Tests" from Eclipse. When executed from
>>>>>>>>>> Maven, however, they fail because the Eclipse instance started by
>>>>>>>>>> Maven fails to resolve the dependencies of our test data fixture
>>>>>>>>>> project we use for testing.
>>>>>>>>>>
>>>>>>>>>> Our setup is as follows:
>>>>>>>>>>
>>>>>>>>>> We start Eclipse and import a test fixture project into the
>>>>>>>>>> workspace.
>>>>>>>>>> The project is a plug-in project. It declares a dependency to
>>>>>>>>>> "org.eclipse.ui" which Eclipse fails to resolve during Maven test
>>>>>>>>>> execution.
>>>>>>>>>>
>>>>>>>>>> I figured out why it is not working with maven: The per default
>>>>>>>>>> enabled target platform does not provide “org.eclipse.ui”. It merely
>>>>>>>>>> provides some “org.eclipse.equinox.launcher.*” and
>>>>>>>>>> “org.eclipse.osgi”
>>>>>>>>>> plug-ins.  Consequently, Eclipse cannot build the project.
>>>>>>>>>>
>>>>>>>>>> The default target platform path points to a "plugins" directory
>>>>>>>>>> located in %ECLIPSE_HOME% which in turn points to
>>>>>>>>>> "myTestProject/target/work/" during the maven test run. But
>>>>>>>>>> "myTestProject/target/work/plugins" only contains the launcher
>>>>>>>>>> bundles
>>>>>>>>>> - which makes perfectly sense given the configuration but isn’t
>>>>>>>>>> exactly what we need.
>>>>>>>>>>
>>>>>>>>>> I'm now searching for means to specify a target platform that
>>>>>>>>>> contains
>>>>>>>>>> org.eclipse.ui. My preferred solution would be to copy all bundles
>>>>>>>>>> used to start eclipse into  %ECLIPSE_HOME%/plugins. Is there an
>>>>>>>>>> option
>>>>>>>>>> in maven-osgi-test-plugin to enable this?
>>>>>>>>>>
>>>>>>>>>> Greets
>>>>>>>>>> Johannes Lerch
>>>>>>>>>
>>>>>>>
>>>>>
>>>
>>
Loading...