Location>code7788 >text

Auto-Wing applies AI to automation projects

Popularity:119 ℃/2025-01-28 10:41:59

GitHub: /SeldomQA/auto-wing

Background: We have introduced AI automation testing auxiliary tools before. I personally recognize it. However, because it is implemented based on TS language, more software test engineers use Python language! Let me use Python to implement a need to meet more test engineers.

Auto-Wing's positioning

Since the thinking of drawing on, why not be called Midsencepy? Because I want to create the AI ​​automation auxiliary tools and some differences.

  1. He should be able to easily apply to existing automation projects. After all, we have written a lot of automation projects, which is the best access to AI.
  2. He should support more domestic LLM. The domestic LLM is not weak, okay! These two days are not being quiltdeepseek-v3Swipe the screen. Convenient and cheap, right? Intersection
  3. He should supportplaywrightandselenium; Most tools are based onplaywright, HoweverseleniumSeems to be abandoned, I'll give itseleniumLast ventilator.

I'm glad, I came out at home while I was in my New Year. I did thatTest engineerThe group thinks, github adds a puppet!

Why is it called Auto-Wing? Of course, it is to insert your AI wings and take off in place directly, haha!

characteristic

⭐ Support multiple operations:ai_actionai_queryai_assert

⭐ Support multi -model:openaiqwenanddeepseek

Supportplaywrightselenium

automatic Convenient and existing automation projects (pytestunittest)integrated.

Install

pip install autowing

Set environment variable

Method one

Apply for the key needed by LLM, and create in the root directory of the project.envdocument. recommenddeepseekThe first is cheap and powerful (yes, I am dying deepseek).

  • DeepSeek: /
#.env
AUTOWING_MODEL_PROVIDER=deepseek
DEEPSEEK_API_KEY=sk-abdefghijklmnopqrstwvwxyz0123456789

Method two

If you don't want to use Python-Dotenv to configure environment variables, you can directly configure environment variables.

export AUTOWING_MODEL_PROVIDER=deepseek
export DEEPSEEK_API_KEY=sk-abdefghijklmnopqrstwvwxyz0123456789

Example

Note:pytestunittestandplaywrightseleniumYou can combine two or two.

  • Pytest + Playwright Example
"" "
 Pytest Example for Playwright with AI Automation.
 "" "
 Import pytest
 From Playwright.sync_api Import Page, Sync_playwright
 From Import Create_fixTure

 From Dotenv Import Load_dotenv


 @(scope = "session")
 DEF PAGE ():
     "" "
     Playwright FIXTUR
     "" "
     # loading .env file
     load_dotenv ()
     With sync_playwright () as P:
         browser = (headless = false)
         context = browser.new_context ()
         pay = context.new_page ()
         YIELD PAGE
         ()
         ()


 @ @
 DEF AI (Page):
     "" "
     ai FIXTURE
     "" "
     ai_fixTure = Create_fixTure ()
     Return aI_FIXTURE (PAGE)


 def test_bing_search (page: page, ai):
     "" "
     Test Bing Search Functionality USING AI-Driven Automation.
     This test demodrates:
     1. Navigating to Bing
     2. Performing a search
     3. Verifying Search Results
     "" "
     ("")

     ai.ai_ACTION ('Search input box input "Playwright" keywords, and Enter the car)
     Page.wait_For_Timeout (3000)

     items = ai.ai_query ('String [], the search results list contains "Playwright" related titles')
     Print ("query", items)

     Assert len ​​(items)> 1

     Print ("Assert")
     Assert ai.ai_assert ('Check the search results list Article 1 title contains "Playwright" string')
  • Unittest + Selenium Example
"" "
 Unittest Example for Selenium with AI AUTOMATION.
 "" "
 Import Unittest
 Import time
 From SELENIUM Import Webdriver
 From Import Create_fixTure
 From Dotenv Import Load_dotenv


 class testbingsearch ():

     @classmedhod
     DEF SETUPCLASS (CLS):
         # load .env file
         load_dotenv ()
         # Initialize edge webdriver
          = ()
         # Create ai fixture
         ai_fixTure = Create_fixTure ()
          = AI_FIXTURE ()

     @classmedhod
     DEF TeardownClass (CLS):
         ()

     def test_01_bing_search (seld):
         "" "
         Test Bing Search Functionality USING AI-Driven Automation.

         This test demodrates:
         1. Navigating to Bing
         2. Performing a search
         3. Verifying Search Results
         "" "
         ("")

         .Ai_ACTION ('Search input box input "Playwright" keywords and return to the car)
         (3)

         items = .ai_query ('String [], the search results list contains "Playwright" related titles')
         Print ("query", items)

         (Len (Items), 1)

         ((
             .Ai_ASSERT ('Check the search results list Article 1 title contains "Playwright" string')
         Cure


 if __Name__ == '__main__':
     ()

Q/A

  1. Does the app support? Planning support.
  2. auto-wingJust released, there must be a lot of pit. The project has been promoted to the project update, and you can only send a comment silently.
  3. auto-wingAfter stability,seldomandloungerThe project will also be integrated simultaneously.
  4. Finally, bless everyone: Happy New Year ~! Essence