Skip to content

fix failed Beauti tests #143 - #144

Merged
walterxie merged 4 commits into
masterfrom
beautitests
Aug 14, 2026
Merged

fix failed Beauti tests #143#144
walterxie merged 4 commits into
masterfrom
beautitests

Conversation

@walterxie

@walterxie walterxie commented Aug 13, 2026

Copy link
Copy Markdown
Member

issue #143

  1. BeautiRateTutorialTest
  • Bug: setPartitionTableCell() in BeautiBase.java used robot.eraseText(10) (10 blind backspaces) before typing new text into a partition-table ComboBox cell. Due to TestFX focus-timing, the backspaces landed before the field was focused, so new text got appended instead of replacing the old value (e.g. "tree" typed into "RSV2_1" produced "RSV2_1tree"), so Tree.t:tree was never created.
  • Fix: Replaced keystroke simulation with direct manipulation — look up the ComboBox behind the cell, set its value/editor text on the FX thread, then fire the same ActionEvent the UI fires on commit, driving the existing rename logic in AlignmentListInputEditor reliably.
  1. BeautiDivergenceDatingTest
  • Bug: robot.doubleClickOn("#beta") — no such field. The beast3 migration replaced the old Gamma distribution's alpha/beta (Shape-Scale/Rate/Mean) parameterization with a new spec-typed Gamma using alpha + (theta scale XOR lambda rate). Since BEAUti's editor fx:ids come straight from the BEAST Input's registered name, #beta no longer exists.
  • Fix: Changed both occurrences of "#beta" to "#theta", preserving the same Gamma(shape=0.001, scale=1000) semantics.
  1. BeautiCLITest — two separate bugs:
  • Bug A: Beauti.main(args) calls JavaFX's Application.launch(), which can only run once per JVM — but BeautiCLITest extends BeautiBase, whose TestFX ApplicationExtension already boots the JavaFX toolkit. Fix: call BeautiTabPane.initialise(args) directly — the actual headless batch-mode entry point Beauti.main() uses internally (parseArgs → initialize(WRITE_XML,...) → save(fileName)), no GUI needed.
  • Bug B: The test's hardcoded custom-template XML referenced beast.base.evolution.tree.TreeHeightLogger, a class renamed to TreeStatLogger in beast3. Fix: updated the string literal.
  • Follow-up modernization : rewrote that same hardcoded template string end-to-end to use beast3's spec-typed classes (HKY, Frequencies, SiteModel, TreeLikelihood, RandomTree, ConstantPopulation, RealScalarParam with domain= instead of lower=, spec ScaleOperator for the scalar kappa parameter) matching the conventions in Standard.xml, while leaving unported tree-topology operators (Uniform, SubtreeSlide, Exchange, WilsonBalding, tree-scaling ScaleOperator) as their original non-spec classes, and dropping ESS logging (no longer type-compatible, same as Standard.xml itself).
  1. LinkUnlinkTest

All 6 partition-deletion tests in LinkUnlinkTest are now fixed and re-enabled (StarBeast test left disabled per your earlier instruction). Summary:

Root cause: There wasn't actually a partition-deletion cleanup bug in Beauti itself — deletion of ClockPrior/tree priors already worked correctly. The real bug was in the test helper assertParameterCountInPriorIs (BeautiBase.java): it only recognized the legacy beast.base.inference.distribution.Prior class, which no fxtemplate uses anymore. BEAST3's new spec priors (Gamma, LogNormal, Dirichlet, etc., all extending TensorDistribution) wrap both the target parameter and their own hyperparameters (e.g. alpha/theta) directly, so the helper always counted 0 for them.

Fixes:
i. BeautiBase.assertParameterCountInPriorIs now also handles TensorDistribution-based priors, counting each prior's active StateNode objects.
ii. LinkUnlinkTest.linkSiteModelsAndDeleteTest's hardcoded expected counts were updated (3→9, 5+3→14, 9+9→18, 6+6→13, 3+3→8) to reflect that BEAST3 priors carry extra hyperparameter objects the old counts didn't account for. I verified at each step that the assertPriorsEqual ID lists were clean (no stale entries from deleted partitions), confirming this is a counting-semantics fix, not a masked deletion bug.
iii. Removed the now-unused @disabled annotations and the unused Function import.

BeautiSimpleTest still used the clickOn/eraseText/write pattern that
setPartitionTableCell was introduced to replace, so it remained subject
to the focus race that appends instead of replaces the cell text.

AlignmentListInputEditor's cell factory sets the same id and combo box
graphic on every TableCell it creates, including the recycled cells
backing empty rows, and those keep a live action handler. An unfiltered
lookup could therefore return an empty cell, whose action handler calls
tableEntries.get(-1). Match the cell on visibility and row index, and
fail with a clear message when no such cell exists.
@walterxie
walterxie merged commit 8900dac into master Aug 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants