Skip to content

CATROID-1675 Add Robolectric unit tests for AI Tutor diff and validation#5224

Open
harissabil wants to merge 1 commit into
explore-ai-tutor-integrationfrom
ai-tutor-aiassist-tests
Open

CATROID-1675 Add Robolectric unit tests for AI Tutor diff and validation#5224
harissabil wants to merge 1 commit into
explore-ai-tutor-integrationfrom
ai-tutor-aiassist-tests

Conversation

@harissabil

@harissabil harissabil commented Jun 29, 2026

Copy link
Copy Markdown
Member

Summary

Adds Robolectric unit tests for the AI Tutor's diff and validation logic, which previously had no coverage. All three suites live under catroid/src/test/java/org/catrobat/catroid/test/robolectric/aiassist/.

  • AiTutorSpriteValidatorTest — covers AiTutorSpriteValidator.validate: complete/empty/multi-script sprites are Valid, and a brick missing a required formula is Invalid with a reason naming the brick and field.
  • BrickTextFormatterTest — covers dataNames, brickEditorLabel, brickPhraseTokens, and scriptHeaderTitle, including spinner selections, inline field values, runtime unit labels, and changed-value flagging.
  • SpriteDifferTest — covers buildDiffRows: identical sprites, appended/deleted bricks, value changes (MODIFIED), and that different brick classes are not merged into a modification.
  • Stacked on explore-ai-tutor-integration (the AI Tutor first integration PR) and targets it, since the aiassist package isn't in dev-ai-tutor yet.

Note for reviewers (building locally)

This branch depends on the AI Tutor library (org.catrobat:aitutor), which is resolved from your Maven Local repository. To build, you first need to publish it locally:

  1. Clone the AI Tutor repo and check out the integration/pocket-code branch: https://github.com/Catrobat/catrobat-ai-tutor/tree/integration/pocket-code
  2. Publish it to Maven Local: ./gradlew publishToMavenLocal
  3. Build

@harissabil - ping me on Slack if the local install gives you any trouble and I'll walk you through it.

Your checklist for this pull request

Please review the contributing guidelines and wiki pages of this repository.

  • Include the name of the Jira ticket in the PR’s title
  • Include a summary of the changes plus the relevant context
  • Choose the proper base branch (develop)
  • Confirm that the changes follow the project’s coding guidelines
  • Verify that the changes generate no compiler or linter warnings
  • Perform a self-review of the changes
  • Verify to commit no other files than the intentionally changed ones
  • Include reasonable and readable tests verifying the added or changed behavior
  • Confirm that new and existing unit tests pass locally
  • Check that the commits’ message style matches the project’s guideline
  • Stick to the project’s gitflow workflow
  • Verify that your changes do not have any conflicts with the base branch
  • After the PR, verify that all CI checks have passed
  • Post a message in the catroid-stage or catroid-ide Slack channel and ask for a code reviewer

- Add `AiTutorSpriteValidatorTest` to ensure sprites are correctly validated and handle missing formula errors
- Add `BrickTextFormatterTest` to verify brick labels, data names, and dynamic tokenization for diff views
- Add `SpriteDifferTest` to cover diff scenarios including identical sprites, brick additions, removals, and modifications
@sonarqubecloud

Copy link
Copy Markdown

@harissabil harissabil changed the title [WIP] Add Robolectric unit tests for AI Tutor diff and validation [WIP] CATROID-1675 Add Robolectric unit tests for AI Tutor diff and validation Jun 29, 2026
@harissabil harissabil changed the title [WIP] CATROID-1675 Add Robolectric unit tests for AI Tutor diff and validation CATROID-1675 Add Robolectric unit tests for AI Tutor diff and validation Jun 30, 2026
@harissabil harissabil self-assigned this Jun 30, 2026
@harissabil harissabil marked this pull request as ready for review June 30, 2026 08:40
@harissabil harissabil requested a review from reichli June 30, 2026 08:40
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