Skip to content

#607: test that IDEA_PROPERTIES and STUDIO_PROPERTIES are set on the process context - #2490

Open
majesteSil wants to merge 2 commits into
devonfw:mainfrom
majesteSil:feature/607-test-process-context-env-vars
Open

majesteSil wants to merge 2 commits into
devonfw:mainfrom
majesteSil:feature/607-test-process-context-env-vars

Conversation

@majesteSil

@majesteSil majesteSil commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

This PR fixes #607

Implemented changes:

  • Added a test IntellijTest#testSetEnvironmentSetsIdeaProperties verifying that setEnvironment puts IDEA_PROPERTIES (pointing to idea.properties in the workspace) into the environment context.
  • Added a test AndroidStudioTest#testSetEnvironmentSetsStudioProperties verifying that setEnvironment puts STUDIO_PROPERTIES (pointing to studio.properties in the workspace) into the environment context.

Both use a RecordingEnvironmentContext to capture the variables set on the process context, as requested in the issue.


Testing instructions

Run the two new tests in the cli module:

  1. mvn -Dtest='IntellijTest#testSetEnvironmentSetsIdeaProperties' test
  2. mvn -Dtest='AndroidStudioTest#testSetEnvironmentSetsStudioProperties' test

Both pass (verified locally, BUILD SUCCESS).


Checklist for this PR

  • When running mvn clean test locally all tests pass and build is successful
  • PR title is of the form #«issue-id»: «brief summary»
  • PR top-level comment summaries what has been done and contains link to addressed issue(s)
  • PR and issue(s) have suitable labels
  • Issue is set to In Progress and assigned to you or there is no issue (might happen for very small PRs)
  • You followed all coding conventions
  • You have added the issue implemented by your PR in CHANGELOG.adoc unless issue is labelled with internal (issue Test for environment variables of process contexts  #607 is labelled internal, so no entry)
  • You have not changed any dependency in pom.xml files
  • You have formulated clear instructions on how to test your contribution under "Testing instructions"

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 35072660421

Coverage increased (+0.01%) to 74.172%

Details

  • Coverage increased (+0.01%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 1 coverage regression across 1 file.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
com/devonfw/tools/ide/version/VersionSegment.java 1 91.34%

Coverage Stats

Coverage Status
Relevant Lines: 19001
Covered Lines: 14726
Line Coverage: 77.5%
Relevant Branches: 8516
Covered Branches: 5684
Branch Coverage: 66.74%
Branches in Coverage %: Yes
Coverage Strength: 3.31 hits per line

💛 - Coveralls

@majesteSil majesteSil added enhancement New feature or request test related to testing and QA process executing external programs (ProcessContext) internal Nothing to be added to CHANGELOG, only internal story labels Sep 16, 2026
@majesteSil majesteSil moved this from 🆕 New to Team Review in IDEasy board Sep 16, 2026
@laert-ll laert-ll self-assigned this Sep 16, 2026
@laert-ll

Copy link
Copy Markdown
Contributor

Thanks for your work, the tests are clear and pass for me locally.

One suggestion I would add is to add a test that starts the tool. The tests as they are written now call setEnvironment directly. If I understand the issue correctly, we need to start the tool and then check the variable on the process.

My suggestion would be to change the mock scripts so they write the variable to a file, e.g. echo "$IDEA_PROPERTIES" > ideaproperties. Then the existing testIntellijRun and testAndroidStudioRun can check that file.

@majesteSil

Copy link
Copy Markdown
Contributor Author

Thanks for the review @laert-ll !
Your reading of the issue is fair, and I want to make the trade-off i made explicit:

  1. The variable is defined in one place, and that's what we test. IDEA_PROPERTIES is set only in Intellij.setEnvironment() and STUDIO_PROPERTIES only in AndroidStudio.setEnvironment(), the only place a realistic regression can occur (wrong key/path). The tests assert the exact value against the workspace path.

  2. The process bridge is generic and already covered. ProcessContext extends EnvironmentContext, and run() builds the process via setEnvironmentOfInstalledTools(pc) and hands that same context to the ProcessBuilder. The same plumbing that carries PATH, IDEA_HOME, etc. The existing ...Run tests already prove variables reach the spawned process (mock scripts write to a file, tests assert it). If the bridge broke, every variable on every tool would break and those tests would catch it.

So the unit tests pin the tool-specific definition (the real risk), and the generic plumbing is left to the existing run coverage, the same pattern ClaudeTest and SpyderTest use.

If you see the process-level assertion as part of #607's acceptance criteria, I'm glad to add it the way you suggested (mock script writes echo "$IDEA_PROPERTIES" > ideaproperties, testIntellijRun/testAndroidStudioRun assert the file).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request internal Nothing to be added to CHANGELOG, only internal story process executing external programs (ProcessContext) test related to testing and QA

Projects

Status: Team Review

Development

Successfully merging this pull request may close these issues.

Test for environment variables of process contexts

3 participants