3

I'm writing automation test script for checking a target application run by Java Swing framework.
It using Java Access bridge library to detect element inside target application. However, this library can only get name / role / position / states of target element, it does not support getting other property.

Here is example of using Access bridge Explorer tool (using Java Access bridge library) for detecting element: enter image description here

However, when I trial using Ranorex automation test tool, it is able to get many property like background color, foreground color... enter image description here When checking the official website of Ranorex, it only describe that it use some instrument technology for doing that: https://www.ranorex.com/java-test-automation/

Does anyone know how to obtain these property like Ranorex does?
What is technology / library behind that it can use for getting element property?
I suppose it use Win32 Hook API, but not sure if correct or not.

phibao37
  • 2,230
  • 4
  • 26
  • 35
  • 1
    It just reads the Java bytecode step by step. Probably especially the well known GUI parts. Java bytecode is "transparent" and may be easily reverse engineered. – paladin Oct 17 '20 at 01:23
  • 1
    Possibly this can help https://stackoverflow.com/questions/33162977/how-to-debug-a-swing-ui/33163127 – fabiojb Oct 20 '20 at 14:03
  • In which language or technology are you writing the test automation script? What is the rationale behind testing what you call an "external app"? Can you not test it by calling its Java methods from JUnit and then inspect the Swing objects directly? On a side note: I am not surprised that you do not get colour information via Java Access Bridge. Imagine you are blind and want an accessible GUI. Are you interested in button or background colours or rather in what those buttons do? – kriegaex Oct 22 '20 at 03:39
  • @kriegaex: we want to check the software with system test/user acceptance test level, not Unit test level. So we should test it in the already packed software, run it manually or by test script, then check it. I'm now writing test script using UWSC test tool, it will call some C++ wrapper of Java Access Bridge library for automating another "external" Java Swing application. – phibao37 Oct 22 '20 at 04:49
  • 1
    JUnit is just a name. You can do any kind of tests with it, not just unit test, despite the name. The application is packaged, so what? It still is a Java application, so probably you can use its API directly instead of using inadequate bridge technologies which make it difficult to differentiate between problems in the tool vs. such in the application, keeping yourself busy to solve them. Sorry for bringing this up, but it is just an idea. You could also use a Java agent or JVM debug interface - or a dedicated tool like Ranorex. – kriegaex Oct 22 '20 at 07:58
  • 1
    If testers don't use the best tools available for money (free if you are lucky), usually the company is not saving any money but burning it. I am going to be silent now, though, so as to let you return to fighting with tools instead of automating tests. Good luck! Really, I mean it. No offence meant at all, I do hope you can solve the problem. – kriegaex Oct 22 '20 at 08:00

0 Answers0