Skip to content

Test to fill a testing gap in NameExpression.#3002

Open
labkey-danield wants to merge 2 commits into
developfrom
fb_claudeFillingTestGaps
Open

Test to fill a testing gap in NameExpression.#3002
labkey-danield wants to merge 2 commits into
developfrom
fb_claudeFillingTestGaps

Conversation

@labkey-danield
Copy link
Copy Markdown
Contributor

@labkey-danield labkey-danield commented May 15, 2026

Rationale

Using Claude to identify an automation gap in name expression.
I tried to use Claude to generate new test automation that would cover the scenario but the existing helper code was old and had too many assumptions to use as is. I would not have felt comfortable having Claude rewrite that helper.

Claude identified this testing gap:

Category Behavior Status Selenium test(s) covering it Declaration (i.e. citation) anchor Implementation sites
Parent lookup ${Inputs/Type/Field} generic parent (sample OR data) gap — (none) NameGenerator.java:172 NameGenerator.java:172 — SubstitutionValue.Inputs enum
NameGenerator.java:851-854 — isParentInputToken matches INPUT_PARENT
NameGeneratorState.java:386-389 — addParentLookupValues adds to Inputs FK

To cover this code a name expression must have a generic "Inputs" and a field name. Example:
Gen-${Inputs/FieldB:defaultValue('none')}-${genId}

The gap in NameGeneratorState.addParentLookupValues before the new test:
Screenshot 2026-05-14 at 9 40 08 AM

Coverage with the new test:
Screenshot 2026-05-14 at 9 40 19 AM

Related Pull Requests

  • None

Changes

  • Add test cover to SampleTypeNameExpressionTest.testInputsExpression.
    • Use a sample as parent.
    • Use a source (DataClass) as a parent.
  • Refactor helper method SampleTypeNameExpressionTest.verifyNames to be more module like and not do everything.
  • Change validation to use regular expression (previous implementation always only checked the first part of the first name).
  • Added helper methods createSampleTypeForNameValidation and validateNamesGenerated so more dynamic name expressions can be tested.

Rewrote helper methods to be more flexible and not make as many assumptions of test data.
Use regular expression for the validation of sample names generated from the NameExpression.
@labkey-danield labkey-danield requested a review from XingY May 15, 2026 23:44
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.

1 participant