全新的自动化脚本编写工具Aqua
废话模式
最近我们熟悉的JetBrains家族继Fleet后又迎来一位新成员Aqua
看了一下官方简介 定义为测试自动化工具
目前版本为预览版 在官方网站下载或者在Toolbox直接安装 预览版无需激活
下面开始本期体验
主界面及创建项目界面
首先界面依旧是JetB家族风格 我是通过Toolbox安装的 它为啥会显示部分中文目前未知
因为我看见Aqua的第一眼亮点是快速进行元素定位,所以这里看看selenium
从上图可以看出目前直接创建selenium项目,语言只支持java、kotlin和Groovy这三个jvm系语言
后期可能会加上其他语言,毕竟目前只是预览版
如果想要创建其他语言版本,可以选择新建项目 如图
创建selenium项目
这里选择创建selenium项目,使用Java+Maven+TestNG 如图 选择添加示例代码
下一步为选择selenium版本,报告及断言库 下图为默认选项 我不用selenide 所以干掉它 点创建
这里先说下界面吧
下图为默认界面,看着和Fleet一样 这个可以在设置里面修改
目录结构
pom.xml 和之前自己写的是一样的
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"><modelVersion>4.0.0</modelVersion><groupId>com.example</groupId><artifactId>AquaExperience</artifactId><version>1.0-SNAPSHOT</version><name>AquaExperience</name><properties><project.build.sourceEncoding>UTF-8</project.build.sourceEncoding><maven.compiler.target>18</maven.compiler.target><maven.compiler.source>18</maven.compiler.source><aspectj.version>1.9.9.1</aspectj.version><allure.version>2.19.0</allure.version></properties><dependencies><dependency><groupId>org.seleniumhq.selenium</groupId><artifactId>selenium-java</artifactId><version>4.4.0</version><scope>test</scope></dependency><dependency><groupId>io.qameta.allure</groupId><artifactId>allure-testng</artifactId><version>${allure.version}</version><scope>test</scope></dependency><dependency><groupId>org.testng</groupId><artifactId>testng</artifactId><version>7.6.1</version><scope>test</scope></dependency><dependency><groupId>org.slf4j</groupId><artifactId>slf4j-simple</artifactId><version>1.7.30</version><scope>test</scope></dependency></dependencies><build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-surefire-plugin</artifactId><version>2.22.2</version><configuration><testFailureIgnore>true</testFailureIgnore><argLine>-javaagent:"${settings.localRepository}/org/aspectj/aspectjweaver/${aspectj.version}/aspectjweaver-${aspectj.version}.jar"</argLine><systemProperties><property><name>allure.results.directory</name><value>${project.build.directory}/allure-results</value></property></systemProperties></configuration><dependencies><dependency><groupId>org.aspectj</groupId><artifactId>aspectjweaver</artifactId><version>${aspectj.version}</version></dependency></dependencies></plugin><plugin><groupId>io.qameta.allure</groupId><artifactId>allure-maven</artifactId><version>2.11.2</version></plugin></plugins></build>
</project>
page代码
package com.example.aquaexperience;import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;// page_url = https://www.jetbrains.com/
public class MainPage {@FindBy(xpath = "//*[@data-test-marker='Developer Tools']")public WebElement seeDeveloperToolsButton;@FindBy(xpath = "//*[@data-test='suggestion-action']")public WebElement findYourToolsButton;@FindBy(xpath = "//div[@data-test='main-menu-item' and @data-test-marker = 'Developer Tools']")public WebElement toolsMenu;@FindBy(css = "[data-test='site-header-search-action']")public WebElement searchButton;public MainPage(WebDriver driver) {PageFactory.initElements(driver, this);}
}
testcase
package com.example.aquaexperience;import org.testng.annotations.*;import static org.testng.Assert.*;import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;import java.time.Duration;public class MainPageTest {private WebDriver driver;private MainPage mainPage;@BeforeMethodpublic void setUp() {driver = new ChromeDriver();driver.manage().window().maximize();driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));driver.get("https://www.jetbrains.com/");mainPage = new MainPage(driver);}@AfterMethodpublic void tearDown() {driver.quit();}@Testpublic void search() {mainPage.searchButton.click();WebElement searchField = driver.findElement(By.cssSelector("[data-test='search-input']"));searchField.sendKeys("Selenium");WebElement submitButton = driver.findElement(By.cssSelector("button[data-test='full-search-button']"));submitButton.click();WebElement searchPageField = driver.findElement(By.cssSelector("input[data-test='search-input']"));assertEquals(searchPageField.getAttribute("value"), "Selenium");}@Testpublic void toolsMenu() {mainPage.toolsMenu.click();WebElement menuPopup = driver.findElement(By.cssSelector("div[data-test='main-submenu']"));assertTrue(menuPopup.isDisplayed());}@Testpublic void navigationToAllTools() {mainPage.seeDeveloperToolsButton.click();mainPage.findYourToolsButton.click();WebElement productsList = driver.findElement(By.id("products-page"));assertTrue(productsList.isDisplayed());assertEquals(driver.getTitle(), "All Developer Tools and Products by JetBrains");}
}
Web Inspector体验
Web Inspector用于快速定位页面元素
这里重点说一下,第三步红框里面的加号可以快速生成代码,只需修改变量名即可
验证
MainPage.java
package com.example.aquaexperience;import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;// page_url = https://www.jetbrains.com/
public class MainPage {@FindBy(css = "a[data-report-query='spm=3001.4482']")public WebElement study;public MainPage(WebDriver driver) {PageFactory.initElements(driver, this);}
}
MainPageTest.java
package com.example.aquaexperience;import org.testng.annotations.*;import static org.testng.Assert.*;import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;import java.time.Duration;public class MainPageTest {private WebDriver driver;private MainPage mainPage;@BeforeMethodpublic void setUp() {driver = new ChromeDriver();driver.manage().window().maximize();driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));driver.get("https://www.csdn.net");mainPage = new MainPage(driver);}@AfterMethodpublic void tearDown() {driver.quit();}@Testpublic void studyCode(){mainPage.study.click();System.out.println(driver.getTitle());assertEquals(driver.getTitle(), "让学习更有价值_CSDN学习");}
}
结果
allure-results目录是测试报告 执行需要allure环境
命令 allure serve allure-results
接口测试
既然测试报告有了,那接口也就有了,顺便试试接口请求功能
POST http://192.168.56.1:63987/widgets/summary.json
总体上感觉还不错,对于使用selenium的同学来说,元素过多的时候优势还是很明显的
目前因为还在开发,所以官方文档内容不多,感兴趣的可以去看看
官方文档
点击跳转
全新的自动化脚本编写工具Aqua相关推荐
- QPython+uiautomator2安卓手机自动化脚本编写
QPython+uiautomator2安卓手机自动化脚本编写 开始 手机端运行 不需要尝试的 换个思路 使用图像匹配 常见问题 uiautomator2使用说明:https://github.com ...
- 自动化脚本Cron工具(MAC和Linux系统)
自动化脚本Cron工具(MAC和Linux系统) Windows 系统中提供了任务计划程序,用来使脚本和其他可执行文件按计划自动定期运行. 在 macOS 系统和 Linux系统中,与之相似的程序称为 ...
- 自动化脚本编写-python
自动化脚本编写实例 打开浏览器访问pto 登陆 修改管理员密码 单元测试数据 检查输入的数据合法性 获取输入错误数据之后的页面提示语 编写测试用例 编写单元测试类 1 单元测试中的通用操作 2 测试类 ...
- 自动化脚本编写实例-python
自动化脚本编写实例 打开浏览器访问pto 登陆 修改管理员密码 单元测试数据 检查输入的数据合法性 获取输入错误数据之后的页面提示语 编写测试用例 编写单元测试类 1 单元测试中的通用操作 2 测试类 ...
- python自动化脚本编写教程_开发工具pycharm写第一个Python自动化程序案例|python基础教程|python入门|python教程...
https://www.xin3721.com/eschool/pythonxin3721/ 版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明. ...
- GDB自动化脚本编写笔记一
Author:ZERO-A-ONE Date:2019-12-24 作为UNIX/Linux下使用广泛的调试器,gdb不仅提供了丰富的命令,还引入了对脚本的支持:一种是对已存在的脚本语言支持,比如py ...
- 自动化脚本录制工具katalon recorder
一,开篇 自动化测试对测试人员来说,是一个觉得有技术含量的活,可当写不到20个场景,超不过1000行的代码时就觉得枯燥乏味没有什么技术含量了,每天都是F12,右键复制full xpath定位来定位去, ...
- Windows端安装lua脚本编写工具
官网下载地址: https://code.google.com/archive/p/luaforwindows/downloads 先下载如下vcredist_x86.4053.exe工具,并且先安装 ...
- sql盲注自动化脚本编写
GET型bool注入 import requests baseurl='http://127.0.0.1/sqli-labs/Less-5/' db_name = '' db_lenth='' tab ...
最新文章
- python画图程序有图-python画图程序
- WebRTC第六步:下载webrtc
- [css] 你知道的等高布局有多少种?写出来
- NSZombieEnabled使用
- dubbo控制台安装
- linux周期执行某任务方法
- 【个人笔记】OpenCV4 C++ 快速入门 04课
- socketpair机制
- 奈奎斯特稳定性判据的步骤(含详细推导)
- 德州大学奥斯汀分校计算机科学排名,德州大学奥斯汀分校专业排名一览及最强专业推荐(QS世界大学排名)...
- 常微分方程I ODE的例子3 生态学模型:Malthus增长模型、Lotka-Volterra模型
- kibana 写两个查询条件_Kibana使用之Lucene的语法查询
- 水星路由器wan口ip显示0_路由器wan口状态全是0 路由器wan口状态ip为0-192路由网
- [C语言]扫雷游戏(Mine Sweeper)
- [从零开始学算法]求平方根
- 大数据独角兽Palantir之核心技术探秘
- 第19步:重用对话框
- 单位网站老是被劫持跳转到菠菜网站怎么办
- Docker特权模式:--privileged、--cap-add、--cap-drop
- 技术人攻略访谈三十八-许式伟:十一年逆流顺流,首席架构师到CEO