List Icon
Mailing list Archive

2019 up to July 2022 | 20182017  |  2016  2015 2014 | 2013

The mailing list has been closed since July 2022, but continues to serve as an archive of information about QF-Test.
But if you want to stay informed about news about QF-Test, you can simply
Subscribe to Newsletter  

To get up-to-date information about each release - including minor releases - you can
subscribe to the RSS feed or follow us on social media.
Alternatively, QF-Test also provides release information itself.

Another source of information is our blog, where there are current articles on general topics, on the company QFS and also various "how-tos"
subscribe to blog


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[QF-Test] Extracting/checking text from JEditorPane


  • Subject: [QF-Test] Extracting/checking text from JEditorPane
  • From: Michael Theurich <Michael.Theurich@?.int>
  • Date: Thu, 26 Jun 2014 13:44:18 +0200

I have a problem checking the displayed text in a swing JEditorPane component. The HTML text is generated by my SUT code in one go, then submitted to the component, and looks like this:
 
<html>
  <head>
 
  </head>
  <body>
    <h2>
      Minimum Report Detail <a href="" size="small">show
      help info...</font></a>
    </h2>
    <table id="detail" rules="cols">
      <tr id="normalrow" currentrow="0">
        <td id="label" border="1" cellspacing="0" align="left">
 
        </td>
        <td id="value" border="1" cellspacing="0" align="right">
          Raw
        </td>
        <td id="value" border="1" cellspacing="0" align="right">
          Calibrated
        </td>
        <td id="value" border="1" cellspacing="0" align="right">
          Unit
        </td>
      </tr>
and so on...
 
This (expected) text has been put into the “expected text” field of a Check-txt node in my test, by way of the check recording feature of qft (this is exactly how the text looks in a debugger prior to throwing it at JEditorPane). But when the test runs and the check is executed, it fails, and the following actual text is displayed:
<html>
  <head>
 
  </head>
  <body>
    <h2>
      Minimum Report Detail <font size="small"><a href=""
      help info...</a></font>
    </h2>
    <table id="detail" rules="cols">
      <tr currentrow="0" id="normalrow">
        <td border="1" cellspacing="0" align="left" id="label">
 
        </td>
        <td border="1" cellspacing="0" align="right" id="value">
          Raw
        </td>
        <td border="1" cellspacing="0" align="right" id="value">
          Calibrated
        </td>
        <td border="1" cellspacing="0" align="right" id="value">
          Unit
        </td>
      </tr>
 
As you can see, the position of the id attribute has changed, although not in all cases. Also the relative order of the a and the font element have changed. Of course with this text, the test fails.
But it also sometimes occurs that the text is extracted unaltered. Component identification is never an issue.
 
Strange, isn’t it? I also noticed that qftest becomes VERY slow when a check_txt contains a large text field with many line breaks.
 
Maybe qftest has to employ special logic to retrieve the HTML from the component. The normal copy-to-clipboard handler e.g. only retrieves the plain text and strips any tags. Have I spotted a bug? Is this non-deterministic behaviour of JEditorPane (or it’s instrumentation by qftest) or of qftest?
 
Another solution for me would be to retrieve the plain text from the contents of JEditorPane and base the comparison on that. Is that supported by qftest in any way?
 
I am currently using qftest-3.5.6 for evaluation.
 
Thanks for any help,
Michael
 
 
---------------------------------------------------------------------------------
Michael Theurich
Monitoring Application Tools SW Engineer
 
Telespazio VEGA Deutschland GmbH
Provision of Engineering Support Services
 
EUMETSAT
Eumetsat-Allee 1
64295 Darmstadt
Tel +49 6151 807-7530