Skip to content

Commit b09890f

Browse files
authored
Merge branch 'llm' into zhoule/analysisSmartTestResult
2 parents af3ce99 + 5727caf commit b09890f

File tree

157 files changed

+40125
-609
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

157 files changed

+40125
-609
lines changed

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"[python]": {
3+
"editor.defaultFormatter": "ms-python.black-formatter"
4+
},
5+
"python.formatting.provider": "none"
6+
}

README.md

Lines changed: 30 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,22 @@
88
![Spring Boot](https://img.shields.io/badge/Spring%20Boot-v2.2.5-blue)
99
![Appium](https://img.shields.io/badge/Appium-v8.0.0-yellow)
1010
![License](https://img.shields.io/badge/license-MIT-green)
11-
![visitors](https://visitor-badge.glitch.me/badge?page_id=microsoft.hydralab&left_color=gray&right_color=red)
1211

1312
---
1413

1514
https://github.com/microsoft/HydraLab/assets/8344245/cefefe24-4e11-4cc7-a3af-70cb44974735
1615

17-
[What is Hydra Lab?](#what-is) | [Get Started](#get-started) | [Who are using Hydra Lab?](#who-use-it) | [Contribute](#contribute) | [Contact Us](#contact) | [Links](#links) | [Wiki](https://github.com/microsoft/HydraLab/wiki)
16+
[What is Hydra Lab?](#what-is) | [Get Started](#get-started) | [Contribute](#contribute) | [Contact Us](#contact) | [Wiki](https://github.com/microsoft/HydraLab/wiki)
1817
</div>
1918

20-
21-
2219
<span id="what-is"></span>
2320
## What is Hydra Lab?
2421

25-
Hydra Lab is a framework that can help you easily build a cloud testing platform utilizing the test devices/machines in hand.
26-
It enables dev team to quickly build a self-manageable and intelligent cloud testing infrastructure. With the help of Hydra Lab, you can:
27-
28-
- Either: Create a new cloud testing network.
29-
- Or: Onboard your test device to an existing network with a minimized effort.
22+
As mentioned in the above video, Hydra Lab is a framework that can help you easily build a cloud-testing platform utilizing the test devices/machines in hand.
3023

3124
Capabilities of Hydra Lab include:
3225
- Scalable test device management under the center-agent distributed design; Test task management and test result visualization.
33-
- Powering [Android Espresso Test](https://developer.android.com/training/testing/espresso).
34-
- Appium(Java) test on different platforms: Windows/iOS/Android/Browser/Cross-platform.
26+
- Powering [Android Espresso Test](https://developer.android.com/training/testing/espresso), and Appium(Java) test on different platforms: Windows/iOS/Android/Browser/Cross-platform.
3527
- Case-free test automation: Monkey test, Smart exploratory test.
3628

3729
For more details, see [Introduction: What is Hydra Lab?](https://github.com/microsoft/HydraLab/wiki)
@@ -45,104 +37,59 @@ Please visit our **[GitHub Project Wiki](https://github.com/microsoft/HydraLab/w
4537

4638
**Supported platforms and frameworks matrix**:
4739

48-
| | Appium(Java) | Espresso |
49-
| ---- |--------------|---- |
50-
|Android| &#10004; | &#10004; |
51-
|iOS| &#10004; | x | x |
52-
|Windows| &#10004; | x |
53-
|Web (Browser)| &#10004; | x |
40+
| | Appium(Java) | Espresso | XCTest | Maestro |
41+
| ---- |--------------|---- | ---- | ---- |
42+
|Android| &#10004; | &#10004; | x | &#10004; |
43+
|iOS| &#10004; | x | &#10004; | &#10004; |
44+
|Windows| &#10004; | x | x | x |
45+
|Web (Browser)| &#10004; | x | x | x |
5446

5547
<span id="quick-start"></span>
5648
### Quick guide on out-of-box Uber docker image
5749

58-
Hydra Lab offers an out-of-box experience of docker image called Uber. You can follow the below steps and start your docker container with a center instance and an agent instance built in:
59-
60-
**Step 1. download and install Docker from https://www.docker.com**
50+
Hydra Lab offers an out-of-box experience of the Docker image, and we call it `Uber`. You can follow the below steps and start your docker container with both a center instance and an agent instance:
6151

62-
**Step 2. run on your machine**
52+
**Step 1. Download and install [Docker](https://www.docker.com)**
6353

64-
Simply choose one of the following commands to start your experience on Hydra Lab:
54+
**Step 2. Run on your machine**
6555

66-
**1. use local storage service**
67-
68-
Hydra Lab Uber image uses local file system as default storage, no extra environment variable is needed:
56+
By Default, Hydra Lab will use the local file system as a storage solution, and you may type the following in your terminal to run it:
6957

7058
```bash
7159
docker run -p 9886:9886 --name=hydra-lab ghcr.io/microsoft/hydra-lab-uber:latest
7260
```
7361

74-
**2. use third-party storage service**
75-
76-
Hydra Lab currently supports [Azure Blob Storage](https://azure.microsoft.com/en-us/products/storage/blobs/) as cloud file storage solution to persist various file types such as log files, video, app package, etc.
77-
Any contribution to integrating other third-party storage services is welcome. (Here's the UML class diagram for this module as a reference: [storage service structure](https://github.com/microsoft/HydraLab/blob/main/docs/images/UML/storage_system_design.png).)
78-
79-
Some extra environment variables need to be specified in the command according to the storage service type.
80-
81-
If you want to use Azure Blob storage, please go to your Azure portal, open an Azure Blob storage account, and get the [connection string](https://learn.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string).
82-
Brief steps: [Login Azure](https://azure.microsoft.com/) -> [Portal](https://portal.azure.com/#home) -> [Storage Accounts](https://portal.azure.com/#view/HubsExtension/BrowseResource/resourceType/Microsoft.Storage%2FStorageAccounts) -> Create new storage account (you may disable the public access for the container) -> In the created storage account, find `Access Keys` tab -> copy `Connection string`.
83-
![image](https://user-images.githubusercontent.com/8344245/216729523-387dc162-54d8-41dd-b136-f2e3c780b10a.png)
84-
85-
You may write the following content in an env file (e.g. env.properties):
86-
```
87-
STORAGE_TYPE=AZURE
88-
BLOB_CONNECTION_STR=${YOUR_BLOB_CONNECTION_STR}
89-
```
90-
91-
Then pass the path of the file to docker container
92-
93-
```bash
94-
docker run --env-file env.properties -p 9886:9886 --name=hydra-lab ghcr.io/microsoft/hydra-lab-uber:latest
95-
```
62+
> We strongly recommend using [Azure Blob Storage](https://azure.microsoft.com/en-us/products/storage/blobs/) service as the file storage solution, and Hydra Lab has native, consistent, and validated support for it.
9663
97-
Or simply run with the env parameter -e:
98-
99-
```bash
100-
docker run -e STORAGE_TYPE=AZURE -e BLOB_CONNECTION_STR=${YOUR_BLOB_CONNECTION_STR} -p 9886:9886 --name=hydra-lab ghcr.io/microsoft/hydra-lab-uber:latest
101-
```
102-
103-
**Step 3. visit front-end page and view your connected devices**
64+
**Step 3. Visit the web page and view your connected devices**
10465

10566
> Url: http://localhost:9886/portal/index.html#/ (or your custom port).
10667
10768
Enjoy starting your journey of exploration!
10869

10970
**Step 4. Perform the test procedure with a minimal setup**
11071

111-
Note: For Android, Uber image only supports **Espresso/Instrumentation** test. See "User manual" section on this page for more features: [Hydra Lab Wikis](https://github.com/microsoft/HydraLab/wiki).
72+
Note: For Android, Uber image only supports **Espresso/Instrumentation** test. See the "User Manual" section on this page for more features: [Hydra Lab Wikis](https://github.com/microsoft/HydraLab/wiki).
11273

113-
**1. To run a test with Uber image and local storage:**
114-
- On the front-end page, go to `Runner` tab and select `HydraLab Client`.
74+
**To run a test with Uber image and local storage:**
75+
- On the front-end page, go to the `Runner` tab and select `HydraLab Client`.
11576
- Click `Run` and change "Espresso test scope" to `Test app`, click `Next`.
11677
- Pick an available device, click `Next` again, and click `Run` to start the test.
11778
- When the test is finished, you can view the test result in the `Task` tab on the left navigator of the front-end page.
11879

11980
![Test trigger steps](docs/images/test-trigger-steps.png)
12081

121-
**2. To run a test with Uber image and any third-party storage service, additional steps are required before the same steps in `1.`:**
122-
- Download [record_release.apk](https://github.com/microsoft/HydraLab/tree/main/common/src/main/resources/record_release.apk) and [record_androidTest.apk](https://github.com/microsoft/HydraLab/tree/main/common/src/main/resources/record_androidTest.apk) from GitHub.
123-
- On the front-end page, go to `Runner` tab and click `Upload`.
124-
- Select the downloaded app `record_release.apk` for `APK/IPA FILE` and test app `record_androidTest.apk` for `TEST APK/JAR/JSON FILE`.
125-
- Click `Upload` and wait for it to finish.
126-
- Follow the steps of 1. to run the test.
127-
128-
Notice:
129-
- The package record shown on the page is preloaded for LOCAL storage only. If you try to run it with a different storage type, you will get an error.
130-
- You need to upload the package again if you want to use your own storage service instead of LOCAL storage.
131-
- You can never use more than one storage type in the official service. The above specific situation only occurs in Uber image where the context and database are set up with LOCAL storage as the default option for new users.
132-
133-
![Package upload steps](docs/images/package-upload-steps.png)
134-
13582

136-
### Quick guide on build and run
83+
### Build and run Hydra Lab from the source
13784

13885
You can also run the center java Spring Boot service (a runnable Jar) separately with the following commands:
13986

14087
> The build and run process will require JDK11 | NPM | Android SDK platform-tools in position.
14188
142-
**Step 1. build and run Hydra Lab center service.**
89+
**Step 1. Run Hydra Lab center service**
14390

14491
```bash
145-
# In project root, switch to react folder to build the Web front.
92+
# In the project root, switch to react folder to build the Web front.
14693
cd react
14794
npm ci
14895
npm run pub
@@ -157,52 +104,37 @@ java -jar center/build/libs/center.jar
157104

158105
> If you encounter the error: `Error: error:0308010C:digital envelope routines::unsupported`, set the System Variable `NODE_OPTIONS` as `--openssl-legacy-provider` and then restart the terminal.
159106
160-
**Step 2. build and run Hydra Lab agent service.**
107+
**Step 2. Run Hydra Lab agent service**
161108

162109
```bash
163-
# In project root
110+
# In the project root
164111
cd android_client
165112
# Build the Android client apk
166113
./gradlew assembleDebug
167114
cp app/build/outputs/apk/debug/app-debug.apk ../common/src/main/resources/record_release.apk
168115
# If you don't have the SDK for Android ,you can download the prebuilt APK in https://github.com/microsoft/HydraLab/releases
169-
# Back to project root
116+
# Back to the project root
170117
cd ..
171-
# In project root, copy the sample config file and update the:
118+
# In the project root, copy the sample config file and update the:
172119
# YOUR_AGENT_NAME, YOUR_REGISTERED_AGENT_ID and YOUR_REGISTERED_AGENT_SECRET.
173120
cp agent/application-sample.yml application.yml
174-
# Then build agent jar and run it
121+
# Then build an agent jar and run it
175122
gradlew :agent:bootJar
176123
java -jar agent/build/libs/agent.jar
177124
```
178125

179126
**Step 3. visit http://localhost:9886/portal/index.html#/ and view your connected devices**
180127

181-
**Technical design overview:**
182-
183-
![Tech Architecture](docs/images/technical_architecture.png)
184-
185128
### More integration guidelines:
186129

130+
- [Test agent setup](https://github.com/microsoft/HydraLab/wiki/Test-agent-setup)
187131
- [Trigger a test task run in the Hydra Lab test service](https://github.com/microsoft/HydraLab/wiki/Trigger-a-test-task-run-in-the-Hydra-Lab-test-service)
188-
- [Deploy a test agent service](https://github.com/microsoft/HydraLab/wiki/Deploy-a-test-agent-service)
189-
- [Create an Appium UI Test Automation Project](https://github.com/microsoft/HydraLab/wiki/Create-an-Appium-UI-Test-Automation-Project)
190-
191-
> 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.
192-
193-
<span id="who-use-it"></span>
194-
## Who are using Hydra Lab?
195-
196-
It's already powering the UI test automation of the following Microsoft products:
197-
- Microsoft Phone Link (Windows UWP app) and Link to Windows (Android app)
198-
- Microsoft Launcher (Android)
199-
- Microsoft Outlook/Edge (Android/iOS)
200-
- Microsoft Fluent UI Android/Yammer Android
132+
- [Deploy Center Docker Container](https://github.com/microsoft/HydraLab/wiki/Deploy-Center-Docker-Container)
201133

202134
<span id="contribute"></span>
203135
## Contribute
204136

205-
Your contribution to Hydra Lab will make a difference for the entire test automation ecosystem. Please refer to **[CONTRIBUTING.md](CONTRIBUTING.md)** for contribution instructions.
137+
Your contribution to Hydra Lab will make a difference for the entire test automation ecosystem. Please refer to **[CONTRIBUTING.md](CONTRIBUTING.md)** for instructions.
206138

207139
### Contributor Hero Wall:
208140

@@ -213,17 +145,8 @@ Your contribution to Hydra Lab will make a difference for the entire test automa
213145
<span id="contact"></span>
214146
## Contact Us
215147

216-
Feel free to dive in! If you have questions about Hydra Lab, or you would like to reach out to us about an issue you're having, you can reach us as follows:
217-
- [Open an issue](https://github.com/microsoft/HydraLab/issues/new) or submit PRs.
218-
- Email us: [[email protected]](mailto:[email protected]).
219-
220-
<span id="links"></span>
221-
## Links
148+
You can reach us by [opening an issue](https://github.com/microsoft/HydraLab/issues/new) or [sending us mails](mailto:[email protected]).
222149

223-
- [Hydra Lab: the next generation cross-platform software testing infrastructure open-sourced by Microsoft](https://medium.com/@nathanbu/we-open-sourced-a-new-test-framework-on-github-in-microsoft-fd31f8861d1e)
224-
- [Release Notes](https://github.com/microsoft/HydraLab/releases), [Hydra Lab on Up For Grabs](https://up-for-grabs.net/#/filters?names=438)
225-
- [Appium: Cross-platform automation framework for all kinds of your apps built on top of W3C WebDriver protocol.](https://github.com/appium/appium)
226-
- [Google Android Tools Ddmlib: A ddmlib jar that provides APIs for talking with Dalvik VM.](https://android.googlesource.com/platform/tools/base/+/master/ddmlib/)
227150

228151
<span id="ms-give"></span>
229152
## Microsoft Give Sponsors
@@ -232,8 +155,6 @@ Thank you for your contribution to [Microsoft employee giving program](https://a
232155

233156
[@Germey(崔庆才)](https://github.com/Germey), [@SpongeOnline(王创)](https://github.com/SpongeOnline), [@ellie-mac(陈佳佩)](https://github.com/ellie-mac), [@Yawn(刘俊钦)](https://github.com/Aqinqin48), [@White(刘子凡)](https://github.com/jkfhklh), [@597(姜志鹏)](https://github.com/JZP1996), [@HCG(尹照宇)](https://github.com/mahoshojoHCG)
234157

235-
![Microsoft Give](docs/images/Give_WebBanner.png)
236-
237158
<span id="license-trademarks"></span>
238159
## License & Trademarks
239160

agent/agent_installer/Windows/restartAgent.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set newfile=%1
1717
::stop hydra lab agent service
1818
net stop "Hydra Lab Agent Service"
1919
::kill hydra lab agent java process
20-
::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}}"
20+
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}}"
2121
if "%newfile%"=="" ( echo "No need to update" ) else (
2222
if not exist "%newfile%" ( echo "%newfile% not exist" ) else (
2323
echo "Updating"

agent/agent_installer/Windows/restartAgent_WindowsService.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ set newfile=%1
1717
::stop hydra lab agent service
1818
net stop "Hydra Lab Agent Service"
1919
::kill hydra lab agent java process
20-
::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}}"
20+
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}}"
2121
if "%newfile%"=="" ( echo "No need to update" ) else (
2222
if not exist "%newfile%" ( echo "%newfile% not exist" ) else (
2323
echo "Updating"

agent/agent_installer/Windows/restartAgent_WindowsTaskScheduler.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ echo newfile = %1
1616
set newfile=%1
1717
::stop hydra lab agent service
1818
::net stop "Hydra Lab Agent Service"
19-
kill hydra lab agent java process
20-
::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}}"
19+
::kill hydra lab agent java process
20+
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}}"
2121
if "%newfile%"=="" ( echo "No need to update" ) else (
2222
if not exist "%newfile%" ( echo "%newfile% not exist" ) else (
2323
echo "Updating"
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
@startuml exception_monitor
2+
interface ExceptionReporter {
3+
+ void reportException(Exception e, boolean fatal)
4+
+ void reportException(Exception e, Thread thread, boolean fatal)
5+
}
6+
7+
class ExceptionReporterManager {
8+
List<ExceptionReporter> reporters
9+
+ void registerExceptionReporter(ExceptionReporter reporter)
10+
+ void reportException(Exception e, boolean fatal)
11+
+ void reportException(Exception e, Thread thread, boolean fatal)
12+
}
13+
14+
class AppCenterReporter implements ExceptionReporter {
15+
AppCenterClient appCenterClient;
16+
17+
+ void reportException(Exception e, boolean fatal)
18+
+ void reportException(Exception e, Thread thread, boolean fatal)
19+
}
20+
21+
22+
class FileReporter implements ExceptionReporter {
23+
+ void reportException(Exception e, boolean fatal)
24+
+ void reportException(Exception e, Thread thread, boolean fatal)
25+
+ void writeToFile(String message, StackTraceElement[] stackTrace)
26+
}
27+
28+
class AppCenterClient{
29+
public HandledErrorLog createErrorLog(Thread thread, Exception testException, boolean fatal)
30+
}
31+
32+
AppCenterClient <-- AppCenterReporter : call
33+
34+
abstract class ch.qos.logback.core.AppenderBase<E> {
35+
+ abstract void append(E var1);
36+
}
37+
38+
class LogbackExceptionHandler extends ch.qos.logback.core.AppenderBase {
39+
ExceptionReporterManager exceptionReporterManager;
40+
+ void append(ILoggingEvent event)
41+
}
42+
43+
class ThreadExceptionHandler implements Thread.UncaughtExceptionHandler {
44+
ExceptionReporterManager exceptionReporterManager;
45+
+ void uncaughtException(Thread t, Throwable e)
46+
}
47+
48+
class ServiceExceptionHandler {
49+
ExceptionReporterManager exceptionReporterManager;
50+
+ void handleException(Thread t, Throwable e)
51+
}
52+
53+
LogbackExceptionHandler --> ExceptionReporterManager : call
54+
ThreadExceptionHandler --> ExceptionReporterManager : call
55+
ServiceExceptionHandler --> ExceptionReporterManager : call
56+
57+
ExceptionReporterManager --> ExceptionReporter : notifyEach
58+
@enduml

0 commit comments

Comments
 (0)