Skip to content

Commit a91f1be

Browse files
Refactor unit tests for AppUploaderTest, LambdaTestTaskTest, and TestSuiteUploaderTest to remove unnecessary tests, ensuring better focus on essential functionality.
1 parent fe0cb92 commit a91f1be

File tree

3 files changed

+0
-102
lines changed

3 files changed

+0
-102
lines changed

src/test/java/io/github/lambdatest/gradle/AppUploaderTest.java

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -54,31 +54,4 @@ void constructor_ShouldValidateRequiredParameters() {
5454
.isInstanceOf(IllegalArgumentException.class)
5555
.hasMessage("App file must have a .apk extension");
5656
}
57-
58-
@Test
59-
void uploadAppAsync_ShouldReturnCompletableFuture() {
60-
// Given
61-
AppUploader appUploader = new AppUploader(TEST_USERNAME, TEST_ACCESS_KEY, validApkPath);
62-
63-
// When/Then - Verify the uploader is created correctly
64-
// We don't call uploadAppAsync() to avoid background thread execution
65-
assertThat(appUploader).isNotNull();
66-
67-
// In a real unit test, we would mock the UploaderUtil to test the async
68-
// behavior
69-
// without making actual network calls
70-
}
71-
72-
@Test
73-
void uploadAppAsync_ShouldHandleInvalidCredentials() {
74-
// Given - Test that invalid credentials are handled during construction
75-
AppUploader appUploader = new AppUploader("invalid_user", "invalid_key", validApkPath);
76-
77-
// When/Then - The uploader should be created successfully
78-
assertThat(appUploader).isNotNull();
79-
80-
// The actual upload failure would occur when uploadAppAsync() is called and
81-
// executed
82-
// but we avoid calling it in unit tests to prevent network calls
83-
}
8457
}

src/test/java/io/github/lambdatest/gradle/LambdaTestTaskTest.java

Lines changed: 0 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ class LambdaTestTaskTest {
2020

2121
private static final String TEST_USERNAME = "testuser";
2222
private static final String TEST_ACCESS_KEY = "test_access_key";
23-
private static final String TEST_APP_ID = "lt://APP1234567890";
24-
private static final String TEST_SUITE_ID = "lt://APP1234567891";
2523
private static final List<String> TEST_DEVICES = Arrays.asList("Pixel 6-12", "Galaxy S21-11");
2624

2725
@TempDir File tempDir;
@@ -65,48 +63,4 @@ void task_ShouldBeConfigurable_WithAllProperties() {
6563
assertThat(task).isNotNull();
6664
assertThat(task).isInstanceOf(LambdaTestTask.class);
6765
}
68-
69-
@Test
70-
void runLambdaTest_ShouldCoordinateUploadsAndExecution_WhenFilesProvided() {
71-
// Given
72-
task.setUsername(TEST_USERNAME);
73-
task.setAccessKey(TEST_ACCESS_KEY);
74-
task.setAppFilePath(validAppPath);
75-
task.setTestSuiteFilePath(validTestPath);
76-
task.setDevice(TEST_DEVICES);
77-
78-
// When/Then - Should coordinate uploads (we don't execute to avoid network
79-
// calls)
80-
assertThat(task).isNotNull();
81-
// In a real unit test, we'd mock the UploaderUtil and TestExecutor to avoid
82-
// HTTP calls
83-
}
84-
85-
@Test
86-
void runLambdaTest_ShouldSkipUploadsAndExecuteTests_WhenIdsAreSet() {
87-
// Given - Use pre-uploaded IDs instead of file paths
88-
task.setUsername(TEST_USERNAME);
89-
task.setAccessKey(TEST_ACCESS_KEY);
90-
task.setAppId(TEST_APP_ID);
91-
task.setTestSuiteId(TEST_SUITE_ID);
92-
task.setDevice(TEST_DEVICES);
93-
94-
// When/Then - Should skip uploads and proceed to execution
95-
assertThat(task).isNotNull();
96-
// In a real unit test, we'd mock the TestExecutor to avoid HTTP calls
97-
}
98-
99-
@Test
100-
void runLambdaTest_ShouldHandleConfiguration() {
101-
// Given
102-
task.setUsername(TEST_USERNAME);
103-
task.setAccessKey(TEST_ACCESS_KEY);
104-
task.setAppFilePath(validAppPath);
105-
task.setTestSuiteFilePath(validTestPath);
106-
task.setDevice(TEST_DEVICES);
107-
108-
// When/Then - Should handle configuration properly
109-
assertThat(task).isNotNull();
110-
// Configuration validation test - no execution to avoid network calls
111-
}
11266
}

src/test/java/io/github/lambdatest/gradle/TestSuiteUploaderTest.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,33 +56,4 @@ void constructor_ShouldValidateRequiredParameters() {
5656
.isInstanceOf(IllegalArgumentException.class)
5757
.hasMessage("Test suite file must have a .apk extension");
5858
}
59-
60-
@Test
61-
void uploadTestSuiteAsync_ShouldReturnCompletableFuture() {
62-
// Given
63-
TestSuiteUploader uploader =
64-
new TestSuiteUploader(TEST_USERNAME, TEST_ACCESS_KEY, validApkPath);
65-
66-
// When/Then - Verify the uploader is created correctly
67-
// We don't call uploadTestSuiteAsync() to avoid background thread execution
68-
assertThat(uploader).isNotNull();
69-
70-
// In a real unit test, we would mock the UploaderUtil to test the async
71-
// behavior
72-
// without making actual network calls
73-
}
74-
75-
@Test
76-
void uploadTestSuiteAsync_ShouldHandleInvalidCredentials() {
77-
// Given - Test that invalid credentials are handled during construction
78-
TestSuiteUploader uploader =
79-
new TestSuiteUploader("invalid_user", "invalid_key", validApkPath);
80-
81-
// When/Then - The uploader should be created successfully
82-
assertThat(uploader).isNotNull();
83-
84-
// The actual upload failure would occur when uploadTestSuiteAsync() is called
85-
// and executed
86-
// but we avoid calling it in unit tests to prevent network calls
87-
}
8859
}

0 commit comments

Comments
 (0)