Fix compilation errors in unit tests from recent commit#2227
Fix compilation errors in unit tests from recent commit#2227MohabMohie merged 4 commits intomainfrom
Conversation
Co-authored-by: MohabMohie <[email protected]>
…eans Co-authored-by: MohabMohie <[email protected]>
Signed-off-by: Mohab Mohie <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2227 +/- ##
===========================================
+ Coverage 0 53.95% +53.95%
- Complexity 0 1563 +1563
===========================================
Files 0 120 +120
Lines 0 11480 +11480
Branches 0 1152 +1152
===========================================
+ Hits 0 6194 +6194
- Misses 0 4596 +4596
- Partials 0 690 +690 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes compilation errors introduced in commit 7c06a6d by updating unit tests to use the correct SHAFT API patterns and adding Java version specification files.
Key Changes:
- Updated
PropertiesUnitTest.javato useSHAFT.PropertiesAPI instead of non-existent internal classes - Fixed
LocatorBuilderUnitTest.javato usecontainsText()instead of non-existenthasPartialText()method - Updated AspectJ weaver version in pom.xml from 1.9.25 to 1.9.25.1
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/testPackage/unitTests/PropertiesUnitTest.java | Removed imports of non-existent internal classes; updated all tests to use correct SHAFT.Properties API with proper namespaces (timeouts, flags, platform, reporting) |
| src/test/java/testPackage/unitTests/LocatorBuilderUnitTest.java | Changed hasPartialText() to containsText() to match actual Locator API |
| pom.xml | Updated AspectJ weaver version from 1.9.25 to 1.9.25.1 in surefire plugin configuration |
| .sdkmanrc | Added SDK manager configuration specifying Java 21.0.9-tem |
| .java-version | Added Java version specification file indicating Java 21 |
| @Test(description = "Test Reporting properties - debug mode") | ||
| public void testReportingDebugMode() { | ||
| // Just verify the property can be retrieved without exception | ||
| boolean debugMode = SHAFT.Properties.reporting.debugMode(); | ||
| // Primitive boolean is always non-null, so just verify it's retrieved successfully | ||
| } | ||
|
|
||
| @Test(description = "Test Execution properties - retries") | ||
| public void testExecutionRetries() { | ||
| String retries = Execution.retries(); | ||
| Assert.assertNotNull(retries, "Retries should not be null"); | ||
| @Test(description = "Test Reporting properties - always log discreetly") | ||
| public void testReportingAlwaysLogDiscreetly() { | ||
| // Just verify the property can be retrieved without exception | ||
| boolean alwaysLogDiscreetly = SHAFT.Properties.reporting.alwaysLogDiscreetly(); | ||
| // Primitive boolean is always non-null, so just verify it's retrieved successfully | ||
| } | ||
|
|
||
| @Test(description = "Test Platform properties - target platform") | ||
| public void testPlatformTargetPlatform() { | ||
| String targetPlatform = Platform.targetPlatform(); | ||
| Assert.assertNotNull(targetPlatform, "Target platform should not be null"); | ||
| @Test(description = "Test Reporting properties - capture element name") | ||
| public void testReportingCaptureElementName() { | ||
| // Just verify the property can be retrieved without exception | ||
| boolean captureElementName = SHAFT.Properties.reporting.captureElementName(); | ||
| // Primitive boolean is always non-null, so just verify it's retrieved successfully | ||
| } |
There was a problem hiding this comment.
The test methods for boolean properties (testReportingDebugMode, testReportingAlwaysLogDiscreetly, testReportingCaptureElementName) retrieve property values but don't perform any assertions. These tests will always pass even if the property retrieval fails or returns incorrect values. Consider adding assertions to verify the expected behavior, such as checking that the values are within expected ranges or match configuration.
Recent commit 7c06a6d introduced unit tests with compilation errors referencing non-existent classes and methods.
Changes
PropertiesUnitTest.java: Removed import of non-existent
Executionclass; updated to use correctSHAFT.PropertiesAPI patternLocatorBuilderUnitTest.java: Replaced non-existent
hasPartialText()withcontainsText()Added
.java-versionand.sdkmanrcto specify Java 21 requirementOriginal prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.