Skip to main content

auto-wing is a tool that uses LLM to assist automated testing.

Project description

auto-wing

auto-wing is a tool that uses LLM to assist automated testing, give your automated testing wings.

auto-wing是一个利用LLM辅助自动化测试的工具, 为你的自动化测试插上翅膀。

Features

⭐ 支持多种操作:ai_actionai_queryai_assert等。

⭐ 支持多模型:openaiqwendeepseek

⭐ 支持 playwrightselenium等。

⭐ 方便的和现有自动化项目集成。

Install

pip install autowing

setting env

方法一

申请LLM需要的key,在项目的根目录下创建.env文件。推荐qwendeepseek,一是便宜,二是方便。

#.env
AUTOWING_MODEL_PROVIDER=openai
OPENAI_API_KEY==sk-proj-abdefghijklmnopqrstwvwxyz0123456789
#.env
AUTOWING_MODEL_PROVIDER=deepseek
DEEPSEEK_API_KEY=sk-abdefghijklmnopqrstwvwxyz0123456789
#.env
AUTOWING_MODEL_PROVIDER=qwen
DASHSCOPE_API_KEY=sk-abdefghijklmnopqrstwvwxyz0123456789

方法二

如果不想使用python-dotenv配置环境变量,可以直接配置环境变量。

export AUTOWING_MODEL_PROVIDER=deepseek
export DEEPSEEK_API_KEY=sk-abdefghijklmnopqrstwvwxyz0123456789

使用

👉 查看 examples

import pytest
from playwright.sync_api import Page, sync_playwright
from autowing.playwright.fixture import create_fixture
from dotenv import load_dotenv


@pytest.fixture(scope="session")
def page():
    """playwright page fixture"""
    # load .env file config
    load_dotenv()
    with sync_playwright() as p:
        browser = p.chromium.launch(headless=False)
        context = browser.new_context()
        page = context.new_page()
        yield page
        context.close()
        browser.close()


@pytest.fixture
def ai(page):
    """ai fixture"""
    ai_fixture = create_fixture()
    return ai_fixture(page)


def test_bing_search(page: Page, ai):
    # 访问必应
    page.goto("https://cn.bing.com")

    # 使用AI执行搜索
    ai.ai_action('搜索输入框输入"playwright"关键字,并回车')
    page.wait_for_timeout(3000)

    # 使用AI查询搜索结果
    items = ai.ai_query('string[], 搜索结果列表中包含"playwright"相关的标题')
    print("query", items)

    # 验证结果
    assert len(items) > 1

    # 使用AI断言
    assert ai.ai_assert('检查搜索结果列表第一条标题是否包含"playwright"字符串')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autowing-0.2.2.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autowing-0.2.2-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file autowing-0.2.2.tar.gz.

File metadata

  • Download URL: autowing-0.2.2.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for autowing-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b116329f9f2f5a04de3b3f8bd2a36f86ac18e5b5b589442de1e1aea3a18c8778
MD5 a3615339517afeb0807438ddd20e79e3
BLAKE2b-256 980fe1d91a32b3cc24e0fcbe2ad6e45d17bcb0e865826c216fe196dec0d3458c

See more details on using hashes here.

File details

Details for the file autowing-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: autowing-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 21.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for autowing-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3b58b37d6ed038922dc45f65d0f4cc0140e83d9168584838b28f2d681ca26ad2
MD5 f377889c56ac187b6a78662037bececd
BLAKE2b-256 c6048034fa7b1856e5fc2a40c8b9fecbb03dcb6bf9db30d7d5dc60f9c0738403

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page