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.0.tar.gz (12.7 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.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: autowing-0.2.0.tar.gz
  • Upload date:
  • Size: 12.7 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.0.tar.gz
Algorithm Hash digest
SHA256 ce79ed2b573cc52e34b0d82a002190ec3d1cf09e87631d2511e66dbd68374b5c
MD5 e63783de7f621f252fec8ed7f58860c6
BLAKE2b-256 fcdd0093fff37540ca5eee6fbbf62acbf2ee1b1d0dab388022cc28d2063a8b22

See more details on using hashes here.

File details

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

File metadata

  • Download URL: autowing-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.5 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23f5257a10666bf491f91e131b0dfc9c3e8d4cb259ab5ed4fc4dddca59538b30
MD5 046c9b82a0c59c39b945147d474773f0
BLAKE2b-256 18f4e5a25a0fb88d20133438a740bdc218e89197f6377cca9067493cc4e7e900

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