Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Unique identifiers in RCP application for test automation?
Unique identifiers in RCP application for test automation? [message #1852077] Thu, 28 April 2022 11:49 Go to next message
Sebastian Schulz is currently offline Sebastian SchulzFriend
Messages: 3
Registered: April 2022
Junior Member
Hey :)

I am investigating in GUI test automation for RCP applications. While automating a few projects I faced issues getting the correct SWT objects if they appear multiple times. Best practice is to use unique identifiers which can be stored in the SWT attribute "data". So far so good - I was asked how such unique identifiers may look like? I do not have any clue. Text? Random numbers? Important requirement: they need to be unique accross the application.

Is there anyone having the same question or maybe even better: is there someone who may share his/her thoughts about it?

Best regards
Sebastian
Re: Unique identifiers in RCP application for test automation? [message #1852088 is a reply to message #1852077] Thu, 28 April 2022 16:09 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 32506
Registered: July 2009
Senior Member
Look at the Javadoc for java.util.UUID.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Unique identifiers in RCP application for test automation? [message #1852225 is a reply to message #1852088] Thu, 05 May 2022 11:48 Go to previous messageGo to next message
Sebastian Schulz is currently offline Sebastian SchulzFriend
Messages: 3
Registered: April 2022
Junior Member
Thank you for your response :) I am not sure though how I am able to use UUIDs in this case. The format of UUID is totally OK, this might be the way to go with. But how can I generate UUIDs which are


  • unique
  • will not change in general (if the class is changed, the UUID should stay the same)
  • stored into the application (accessable via SWT data attribute)


Do you have any opinion on that one? :)
Re: Unique identifiers in RCP application for test automation? [message #1852232 is a reply to message #1852225] Thu, 05 May 2022 13:50 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 32506
Registered: July 2009
Senior Member
Call java.util.UUID.randomUUID() each time. A UUID cannot change; you can use UUID.toString if you want a string representation. Use org.eclipse.swt.widgets.Widget.setData(String, Object) to set the ID and org.eclipse.swt.widgets.Widget.getData(String) to get it.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Unique identifiers in RCP application for test automation? [message #1852270 is a reply to message #1852232] Fri, 06 May 2022 14:07 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 4267
Registered: July 2009
Senior Member

In this case, I think you want to avoid using random values generated at runtime. It's a fine way to construct them at development time, but you might want to
base the IDs you assign off of the classes and fields where you created those widgets. It's one thing to make the IDs unique, it's another to have them make
any sort of sense to your testers.


Nitin Dahyabhai
Eclipse Web Tools Platform
Re: Unique identifiers in RCP application for test automation? [message #1852297 is a reply to message #1852270] Mon, 09 May 2022 10:52 Go to previous message
Sebastian Schulz is currently offline Sebastian SchulzFriend
Messages: 3
Registered: April 2022
Junior Member
Thank you Nitin for your answer :) I was also sturggling to understand how random UUIDs will not change.

Do you have any example of how identifiers are looking like in one of your applications? It seems you have some experiences which you might share with me/us.
Previous Topic:Checksum for OpenJDK11U-jdk_x64_windows_hotspot_11.0.15_10.msi
Next Topic:Pre-assign Eclipse Fields
Goto Forum:
  


Current Time: Thu Oct 06 04:27:23 GMT 2022

Powered by FUDForum. Page generated in 0.07166 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top