Skip to content

Add test automation for miscellaneous sample and sample type issues.#2491

Merged
labkey-danield merged 21 commits intodevelopfrom
fb_miscSampleTypeNeedsAutomation
Jul 8, 2025
Merged

Add test automation for miscellaneous sample and sample type issues.#2491
labkey-danield merged 21 commits intodevelopfrom
fb_miscSampleTypeNeedsAutomation

Conversation

@labkey-danield
Copy link
Contributor

@labkey-danield labkey-danield commented Jun 13, 2025

Rationale

Updating shared test components to aid with the test automation identified in the related PR.

Related Pull Requests

Changes

  • Update EntityTypeDesigner.setParentAlias to take an optional parameter that will set a parent as required.
  • Update SampleTypeNameExpressionTest. testWithTrickyFieldNames to use all the tricky characters for a name expression.
  • Updated TestDataGenerator to have REALISTIC_DOMAIN_NAMES
  • Update TestDataGenerator.getRealisticDomainName to take an optional exclusion list (just to avoid duplicate name collisions).
  • Removed deprecated method SampleTypeAPIHelper.getSampleIdFromName (and the 2 or 3 calls to it).

StringBuilder sbNameExpression = new StringBuilder();

// Covers Issue 52180
String parentsampleTypeEncoded = PARENT_SAMPLE_TYPE.replace("/", "\\/");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this what PARENT_SAMPLE_TYPE_INPUT is for?

Comment on lines 76 to 77
private static final String DEFAULT_SAMPLE_PARENT_VALUE = "SS" +
EscapeUtil.escapeForNameExpression(TestDataGenerator.randomString(3).replaceAll("[_)]", ".")); // '_' is used as delimiter to get batchRandomId and ) is used to close the defaultValue()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I was messing with this test, escaping didn't seem to work for default values. The backslashes just ended up being part of the default value. If escaping worked, you should be able to not exclude _ and ) from the value.


checker().verifyTrue("Name of derived sample doesn't look correct. Should contain 'Parent Sample'.",
derivedSampleName.contains("Parent Sample"));
checker().verifyTrue("Name of derived sample doesn't look correct. Should contain 'tricky06'.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of 'tricky06' is a little magical here. Perhaps capture this in a constant somewhere like PARENT_FIELD_VALUE_PREFIX = "tricky06"?

@labkey-danield labkey-danield merged commit fd235e3 into develop Jul 8, 2025
6 checks passed
@labkey-danield labkey-danield deleted the fb_miscSampleTypeNeedsAutomation branch July 8, 2025 22:38
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.

3 participants