Skip to content

Implement base tests for frooky agents #58

Draft
bernhste wants to merge 5 commits intomainfrom
testing-agent
Draft

Implement base tests for frooky agents #58
bernhste wants to merge 5 commits intomainfrom
testing-agent

Conversation

@bernhste
Copy link
Collaborator

@bernhste bernhste commented Feb 3, 2026

Addresses #7

Testing was previously tracked in #52. This PR now only implements agent tests

The agent cannot be tested using common JavaScript/Node testing frameworks since the environment, for example, does not have a global variable, but one called global. And we must test it on devices, not mock mobile OS data types, etc.

So I made a (very tiny) testing framework located in agent/tests/test-framework.ts. The tests can be run using these node scripts:

  • test:android
  • test:ios

They basically run run-tests.js which implements the host logic:

  • Starting the app org.owap.mastestapp
  • Run all tests defined in agent/tests/android or agent/tests/ios respectively. They are fully asynchronous.
  • Return the results

The tests are written like Jests-Tests:

import { generateUUID } from "../../android/android-agent"

test('Test UUID generator', () => {
    const uuid = generateUUID();

    // UUID v4 regex pattern
    const uuidV4Regex = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;

    expect(uuidV4Regex.test(uuid)).toBeTruthy();
});

What is not yet implemented is the GitHub Action. But this can be done like that:

  • Make sure a virtual device is running
  • Make sure the unit test target app is running with Frida as an embedded gadget
  • Run npm run test:android or npm run test:ios

This is the output the android test:

(venv) ➜  agent git:(testing-agent) ✗ npm run test:android

> frooky-agent@0.0.1 test:android
> npm run build:test:android && node run-tests.js -p android


> frooky-agent@0.0.1 build:test:android
> frida-compile --type-check none tests/android/runner.ts -o dist/agent-test-android.js

  ✅ PASS: Test UUID generator

✅ PASS: All tests passed.

The process will return 0 if all goes well.

@bernhste bernhste self-assigned this Feb 3, 2026
@bernhste bernhste changed the title Testing for Agents Testing for frooky Agents Feb 3, 2026
@bernhste bernhste changed the title Testing for frooky Agents Implement base tests for frooky agents Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant