List Icon
Archiv Mailingliste

2019 bis Juli 2022  2018  | 2017 2016 2015 | 2014 | 2013

Die Mailingliste ist seit Juli 2022 geschlossen, dient aber weiterhin als Informationsarchiv zu QF-Test.
Wenn Sie aber über Neuerungen zu QF-Test informiert bleiben wollen, können Sie einfach unseren
Newsletter abonnieren

Um aktuell die Informationen zu jeder Release - auch Minor Releases - zu bekommen, können Sie den
RSS-Feed abonnieren oder uns in sozialen Medien folgen.
Alternativ bietet QF-Test auch selbst eine Versionsinformation an.

Eine weitere Informationsquelle ist unser Blog, in dem es aktuelle Beiträge zu allgemeinen Themen, zur Firma QFS und auch diverse "How-Tos" gibt:
Blog abonnieren


[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