diff --git a/README.md b/README.md
index a0c537ceb..163668543 100644
--- a/README.md
+++ b/README.md
@@ -66,13 +66,15 @@ docker pull ghcr.io/microsoft/hydra-lab-uber:latest
**Step 2. run on your machine with BLOB_CONNECTION_STR**
-You may write the content "BLOB_CONNECTION_STR=${YOUR_BLOB_CONNECTION_STR}" in an env file, and pass the path of the file to docker container:
-```
-docker run [-p 9886:9886] [--name=hydra-lab] --env-file ${YOUR_ENV_FILE_PATH} ghcr.io/microsoft/hydra-lab-uber:latest
+You may write the content `BLOB_CONNECTION_STR=${YOUR_BLOB_CONNECTION_STR}` in an env file (e.g. env.txt), and pass the path of the file to docker container:
+
+```bash
+docker run --env-file env.txt -p 9886:9886 --name=hydra-lab ghcr.io/microsoft/hydra-lab-uber:latest
```
Or simply run with the env parameter -e:
-```
-docker run [-p 9886:9886] [--name=hydra-lab] -e BLOB_CONNECTION_STR=${YOUR_BLOB_CONNECTION_STR} ghcr.io/microsoft/hydra-lab-uber:latest
+
+```bash
+docker run -e BLOB_CONNECTION_STR=${YOUR_BLOB_CONNECTION_STR} -p 9886:9886 --name=hydra-lab ghcr.io/microsoft/hydra-lab-uber:latest
```
**Step 3. visit front-end page and view your connected devices**
diff --git a/README.zh-CN.md b/README.zh-CN.md
index 0d7ad776c..515d1459a 100644
--- a/README.zh-CN.md
+++ b/README.zh-CN.md
@@ -30,7 +30,7 @@ Hydra Lab 的特性包括:
- 支持在不同平台上进行 Appium(Java) 测试:Windows/iOS/Android/浏览器/跨平台。
- 无用例的自动化测试:Monkey test,智能探索测试
-更多细节,请参见 [介绍:什么是 Hydra Lab?](https://github.com/microsoft/HydraLab/wiki)
+更多细节,请参见 [什么是 Hydra Lab?](https://github.com/microsoft/HydraLab/wiki)
## 入门
@@ -121,12 +121,12 @@ java -jar agent/build/libs/agent.jar
> Note: If you are a Microsoft FTE and want to onboard to the internal Hydra Lab testing service, please visit [our SharePoint site](https://microsoftapc.sharepoint.com/teams/MMXDocument/SitePages/Hydra-Lab-test-automation-service-onboarding-guideline.aspx) to learn more about the internal service instance.
-### For Contributor:
+### 参与贡献Hydra Lab:
- [Contribute to the Hydra Lab GitHub Project](https://github.com/microsoft/HydraLab/wiki/Contribute-to-the-Hydra-Lab-GitHub-Project)
-## Who are using Hydra Lab?
+## 谁在使用Hydra Lab?
It's already powering the UI test automation of the following Microsoft products:
- Microsoft Phone Link (Windows UWP app) and Link to Windows (Android app)
diff --git a/agent/agent_installer/Windows/AgentService.exe b/agent/agent_installer/Windows/AgentService.exe
new file mode 100644
index 000000000..ff0969302
Binary files /dev/null and b/agent/agent_installer/Windows/AgentService.exe differ
diff --git a/agent/agent_installer/Windows/AgentService.xml b/agent/agent_installer/Windows/AgentService.xml
new file mode 100644
index 000000000..e0353223b
--- /dev/null
+++ b/agent/agent_installer/Windows/AgentService.xml
@@ -0,0 +1,13 @@
+
+Hydra Lab Agent Service
+Hydra Lab Agent Service
+Hydra Lab Test Agent Service serves as the test runner and test device manager of the connected Hydra Lab center.
+
+java
+-Xms1024m -Xmx2048m -jar agent.jar
+Automatic
+ {LOG_FILE_LOCATION}
+
+yyyyMMdd
+
+
\ No newline at end of file
diff --git a/agent/agent_installer/Windows/restartAgent.bat b/agent/agent_installer/Windows/restartAgent.bat
index 3f16799ea..f2face9b2 100644
--- a/agent/agent_installer/Windows/restartAgent.bat
+++ b/agent/agent_installer/Windows/restartAgent.bat
@@ -13,8 +13,11 @@ exit /B
if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
echo newfile = %1
-set newfile=%1
+set newfile = %1
+::stop hydra lab agent service
net stop "Hydra Lab Agent Service"
+::kill hydra lab agent java process
+::Powershell -Command "& {Get-WmiObject Win32_Process -Filter \"name like '%%java%%' and CommandLine like '%%agent%%'\" | Select-Object ProcessId -OutVariable pids;if(-not $pids -eq '' ) {stop-process -id $pids.ProcessId}}"
if "%newfile%"=="" ( echo "No need to update" ) else (
if not exist "%newfile%" ( echo "%newfile% not exist" ) else (
echo "Updating"
@@ -22,4 +25,7 @@ if "%newfile%"=="" ( echo "No need to update" ) else (
ren "%newfile%" agent.jar
)
)
+::start hydra lab agent in command mode
+::java -Xms1024m -Xmx4096m -jar .\agent.jar
+::start hydra lab agent in windows service mode
net start "Hydra Lab Agent Service"
\ No newline at end of file
diff --git a/agent/src/main/java/com/microsoft/hydralab/agent/runner/ActionExecutor.java b/agent/src/main/java/com/microsoft/hydralab/agent/runner/ActionExecutor.java
index f329ce711..f6a4fec8d 100644
--- a/agent/src/main/java/com/microsoft/hydralab/agent/runner/ActionExecutor.java
+++ b/agent/src/main/java/com/microsoft/hydralab/agent/runner/ActionExecutor.java
@@ -10,6 +10,7 @@
import com.microsoft.hydralab.common.util.ThreadUtils;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
+import org.springframework.http.HttpStatus;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -94,7 +95,7 @@ private Object[] convertArgs(@NotNull DeviceInfo deviceInfo, @NotNull Logger log
try {
methodArgs[i + 1] = JSONObject.parseObject(actionArgs.get(i), DeviceAction.class);
} catch (Exception e1) {
- throw new HydraLabRuntimeException(500, "Convert arg failed!", e1);
+ throw new HydraLabRuntimeException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "Convert arg failed!", e1);
}
}
}
diff --git a/agent/src/main/java/com/microsoft/hydralab/agent/runner/TestRunner.java b/agent/src/main/java/com/microsoft/hydralab/agent/runner/TestRunner.java
index c965ffa68..10246bce5 100644
--- a/agent/src/main/java/com/microsoft/hydralab/agent/runner/TestRunner.java
+++ b/agent/src/main/java/com/microsoft/hydralab/agent/runner/TestRunner.java
@@ -57,6 +57,7 @@ public void runTestOnDevice(TestTask testTask, DeviceInfo deviceInfo, Logger log
private void runByFutureTask(DeviceInfo deviceInfo, TestTask testTask, TestRun testRun) throws Exception {
FutureTask futureTask = new FutureTask<>(() -> {
+ initTestRunThreadContext(testRun);
run(deviceInfo, testTask, testRun);
return null;
});
@@ -74,6 +75,14 @@ private void runByFutureTask(DeviceInfo deviceInfo, TestTask testTask, TestRun t
}
}
+ /**
+ * TODO Call {@link TestRunThreadContext#init(ITestRun)}
+ * This method must be called in the test run execution thread.
+ */
+ private void initTestRunThreadContext(TestRun testRun) {
+
+ }
+
private static void saveErrorSummary(TestRun testRun, Exception e) {
String errorStr = e.getClass().getName() + ": " + e.getMessage();
if (errorStr.length() > 255) {
@@ -201,7 +210,7 @@ protected void reInstallApp(DeviceInfo deviceInfo, TestTask testTask, Logger rep
}
protected void reInstallTestApp(DeviceInfo deviceInfo, TestTask testTask, Logger reportLogger) throws Exception {
- if(!shouldInstallTestPackageAsApp()){
+ if (!shouldInstallTestPackageAsApp()) {
return;
}
if (testTask.getTestAppFile() == null) {
diff --git a/azure-pipelines-ci.yml b/azure-pipelines-ci.yml
index 48a02831e..7c466847c 100644
--- a/azure-pipelines-ci.yml
+++ b/azure-pipelines-ci.yml
@@ -112,6 +112,28 @@ stages:
Contents: '*.jar'
TargetFolder: '$(Build.ArtifactStagingDirectory)/center_deploy'
condition: and(succeeded(), eq(variables.fullBuild, 'true'))
+ - task: Gradle@2
+ displayName: Package Mac installer
+ inputs:
+ gradleWrapperFile: 'gradlew'
+ tasks: 'packageMacInstaller'
+ publishJUnitResults: false
+ javaHomeOption: 'JDKVersion'
+ jdkVersionOption: '1.11'
+ sonarQubeRunAnalysis: false
+ spotBugsAnalysis: false
+ condition: and(succeeded(), eq(variables.fullBuild, 'true'))
+ - task: Gradle@2
+ displayName: Package Windows installer
+ inputs:
+ gradleWrapperFile: 'gradlew'
+ tasks: 'packageWindowsInstaller'
+ publishJUnitResults: false
+ javaHomeOption: 'JDKVersion'
+ jdkVersionOption: '1.11'
+ sonarQubeRunAnalysis: false
+ spotBugsAnalysis: false
+ condition: and(succeeded(), eq(variables.fullBuild, 'true'))
- task: CopyFiles@2
displayName: Copy agent jar
inputs:
@@ -119,6 +141,13 @@ stages:
Contents: '*.jar'
TargetFolder: '$(Build.ArtifactStagingDirectory)/agent_deploy'
condition: and(succeeded(), eq(variables.fullBuild, 'true'))
+ - task: CopyFiles@2
+ displayName: Copy agent installer
+ inputs:
+ SourceFolder: 'build/installer/'
+ Contents: '*.zip'
+ TargetFolder: '$(Build.ArtifactStagingDirectory)/agent_deploy'
+ condition: and(succeeded(), eq(variables.fullBuild, 'true'))
- task: CopyFiles@2
displayName: Copy deploy uber files
inputs:
diff --git a/build.gradle b/build.gradle
index d806199f1..ce9fe21b2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -77,3 +77,15 @@ task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
xml.enabled true
}
}
+
+task packageMacInstaller(type: Zip) {
+ from 'agent/agent_installer/MacOS/iOS'
+ archiveName 'Hydra_Agent_Installer_Mac.zip'
+ destinationDir file('build/installer')
+}
+
+task packageWindowsInstaller(type: Zip) {
+ from 'agent/agent_installer/Windows'
+ archiveName 'Hydra_Agent_Installer_Windows.zip'
+ destinationDir file('build/installer')
+}
\ No newline at end of file
diff --git a/center/build.gradle b/center/build.gradle
index 078ac7966..eb8530180 100644
--- a/center/build.gradle
+++ b/center/build.gradle
@@ -8,6 +8,10 @@ version = hydraLabVersion
sourceCompatibility = 11
targetCompatibility = 11
+repositories {
+ mavenCentral()
+}
+
bootJar {
// Specify the out jar file name so that the dockerfile could copy it
// without concerning the name change caused by version change.
@@ -60,6 +64,18 @@ dependencies {
annotationProcessor 'org.projectlombok:lombok:1.18.20'
}
-repositories {
- mavenCentral()
-}
\ No newline at end of file
+import org.apache.tools.ant.taskdefs.condition.Os
+String npmCommand = 'npm'
+if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+ npmCommand = 'npm.cmd'
+}
+String reactDir = "${projectDir.parentFile.absolutePath}${File.separator}react"
+task installWebFront(type: Exec, group: 'build') {
+ workingDir reactDir
+ commandLine npmCommand, 'ci'
+}
+
+task buildWebFront(type: Exec, group: 'build', dependsOn: installWebFront) {
+ workingDir reactDir
+ commandLine npmCommand, 'run', 'pub'
+}
diff --git a/center/deploy_startup/alert_notification.html b/center/deploy_startup/alert_notification.html
index 474339b4b..225127bcd 100644
--- a/center/deploy_startup/alert_notification.html
+++ b/center/deploy_startup/alert_notification.html
@@ -183,7 +183,7 @@
-
+
|
|
diff --git a/center/src/main/java/com/microsoft/hydralab/center/controller/TestTaskController.java b/center/src/main/java/com/microsoft/hydralab/center/controller/TestTaskController.java
index 4c6c6c5a4..b8615bdc9 100644
--- a/center/src/main/java/com/microsoft/hydralab/center/controller/TestTaskController.java
+++ b/center/src/main/java/com/microsoft/hydralab/center/controller/TestTaskController.java
@@ -72,9 +72,7 @@ public Result