frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

DevEco Testing: Official Automation Testing Tool for HarmonyOS Applications

1•moyantianwang•8mo ago
# DevEco Testing: Official Automation Testing Tool for HarmonyOS Applications

 

> These notes provide a high-level overview and may contain inaccuracies. For detailed information, please refer to the official documentation.

## 1. Test Framework Architecture

DevEco Testing is built on the JUnit5 extension mechanism and adopts a layered testing strategy:

1. Unit Testing Layer: Covers business logic components (Service/Manager)

2. Component Testing Layer: Validates Ability/Extension functionalities

3. System Testing Layer: Verifies multi-device collaborative scenarios

Core capabilities include:

* ArkTS Test Engine: Supports asynchronous task validation

* Device Shadow Mode: Simulates multi-device collaborative environments

* Data Sandbox: Isolates test data from production environments

## 2. Unit Testing Implementation

### 1. Test Case Specifications

``` typescript ```

``` // Example: Asynchronous Task Validation @Test async function testAsyncTask() { const result = await DataService.fetchData(); assertEquals(result.code, 200); assertTrue(Array.isArray(result.data)); } ```

### 2. Mock Service Configuration

Dependency isolation using @Mock annotations:

``` typescript ```

``` // Mock network service @Mock class NetworkService { @InjectMock async fetchData(): Promise<Data> { return { code: 200, data: mockData }; } } ```

### 3. Test Coverage

Line-level coverage reporting:

``` markdown ```

``` ------------------------- Test Coverage Report ------------------------- Module | Line Coverage | Branch Coverage ----------------------------------------------- CoreService | 82% | 75% UIComponent | 91% | 88% NetworkModule | 67% | 63% ```

## 3. UI Automation Testing

### 1. Component Localization Strategies

| Strategy | Use Case | Example Code | | :---------- | :----------------------- | :-------------------------------------------- | | resource-id | Stable element ID | component.findComponentById('btn_submit') | | text | Dynamic content matching | component.findComponentsByText('Submit') | | xpath | Complex hierarchy | component.findByXPath('//[@text="Confirm"]') |

### 2. Gesture Simulation

``` typescript ```

``` // Swipe Operation Example test('Swipe Test', async () => { await gesture.swipe({ startX: 500, startY: 1500, endX: 500, endY: 500, duration: 800 }); await expect(component).toHaveText('New Content'); }); ```

### 3. Exception Scenarios

Network fluctuation simulation: device.simulateNetwork('3G')

* Memory pressure testing: device.fillMemory(80%)

* Low battery testing: device.setBatteryLevel(15%)

## 4. CI/CD Integration

### 1. Pipeline Configuration

``` yaml ```

``` # devops-ci.yaml stages: - name: unit-test script: - npm run build - npm run test:unit -- --coverage

  - name: ui-test
    device:
      type: emulator
      config: phone_2k
    script:
      - npm run test:ui -- --headless
```

### 2. Test Reporting

Output formats:

``` bash ```

``` test-results/ ├── junit.xml # CI system integration └── report.html # Visual analysis report ```

##

Show HN: Gettorr – Stream magnet links in the browser via WebRTC (no install)

https://gettorr.com/
1•BenaouidateMed•1m ago•0 comments

Statin drugs safer than previously thought

https://www.semafor.com/article/02/06/2026/statin-drugs-safer-than-previously-thought
1•stareatgoats•3m ago•0 comments

Handy when you just want to distract yourself for a moment

https://d6.h5go.life/
1•TrendSpotterPro•4m ago•0 comments

More States Are Taking Aim at a Controversial Early Reading Method

https://www.edweek.org/teaching-learning/more-states-are-taking-aim-at-a-controversial-early-read...
1•lelanthran•5m ago•0 comments

AI will not save developer productivity

https://www.infoworld.com/article/4125409/ai-will-not-save-developer-productivity.html
1•indentit•11m ago•0 comments

How I do and don't use agents

https://twitter.com/jessfraz/status/2019975917863661760
1•tosh•17m ago•0 comments

BTDUex Safe? The Back End Withdrawal Anomalies

1•aoijfoqfw•19m ago•0 comments

Show HN: Compile-Time Vibe Coding

https://github.com/Michael-JB/vibecode
3•michaelchicory•22m ago•1 comments

Show HN: Ensemble – macOS App to Manage Claude Code Skills, MCPs, and Claude.md

https://github.com/O0000-code/Ensemble
1•IO0oI•25m ago•1 comments

PR to support XMPP channels in OpenClaw

https://github.com/openclaw/openclaw/pull/9741
1•mickael•26m ago•0 comments

Twenty: A Modern Alternative to Salesforce

https://github.com/twentyhq/twenty
1•tosh•27m ago•0 comments

Raspberry Pi: More memory-driven price rises

https://www.raspberrypi.com/news/more-memory-driven-price-rises/
1•calcifer•33m ago•0 comments

Level Up Your Gaming

https://d4.h5go.life/
1•LinkLens•37m ago•1 comments

Di.day is a movement to encourage people to ditch Big Tech

https://itsfoss.com/news/di-day-celebration/
3•MilnerRoute•38m ago•0 comments

Show HN: AI generated personal affirmations playing when your phone is locked

https://MyAffirmations.Guru
4•alaserm•39m ago•3 comments

Show HN: GTM MCP Server- Let AI Manage Your Google Tag Manager Containers

https://github.com/paolobietolini/gtm-mcp-server
1•paolobietolini•40m ago•0 comments

Launch of X (Twitter) API Pay-per-Use Pricing

https://devcommunity.x.com/t/announcing-the-launch-of-x-api-pay-per-use-pricing/256476
1•thinkingemote•40m ago•0 comments

Facebook seemingly randomly bans tons of users

https://old.reddit.com/r/facebookdisabledme/
1•dirteater_•42m ago•1 comments

Global Bird Count Event

https://www.birdcount.org/
1•downboots•42m ago•0 comments

What Is Ruliology?

https://writings.stephenwolfram.com/2026/01/what-is-ruliology/
2•soheilpro•44m ago•0 comments

Jon Stewart – One of My Favorite People – What Now? with Trevor Noah Podcast [video]

https://www.youtube.com/watch?v=44uC12g9ZVk
2•consumer451•46m ago•0 comments

P2P crypto exchange development company

1•sonniya•1h ago•0 comments

Vocal Guide – belt sing without killing yourself

https://jesperordrup.github.io/vocal-guide/
2•jesperordrup•1h ago•0 comments

Write for Your Readers Even If They Are Agents

https://commonsware.com/blog/2026/02/06/write-for-your-readers-even-if-they-are-agents.html
1•ingve•1h ago•0 comments

Knowledge-Creating LLMs

https://tecunningham.github.io/posts/2026-01-29-knowledge-creating-llms.html
1•salkahfi•1h ago•0 comments

Maple Mono: Smooth your coding flow

https://font.subf.dev/en/
1•signa11•1h ago•0 comments

Sid Meier's System for Real-Time Music Composition and Synthesis

https://patents.google.com/patent/US5496962A/en
1•GaryBluto•1h ago•1 comments

Show HN: Slop News – HN front page now, but it's all slop

https://dosaygo-studio.github.io/hn-front-page-2035/slop-news
7•keepamovin•1h ago•1 comments

Show HN: Empusa – Visual debugger to catch and resume AI agent retry loops

https://github.com/justin55afdfdsf5ds45f4ds5f45ds4/EmpusaAI
1•justinlord•1h ago•0 comments

Show HN: Bitcoin wallet on NXP SE050 secure element, Tor-only open source

https://github.com/0xdeadbeefnetwork/sigil-web
2•sickthecat•1h ago•1 comments