Appium Studio 初体验(windows做ios自动化,录制appium脚本)

简介: Appium Studio 初体验(windows做ios自动化,录制appium脚本)
+关注继续查看

  偶然的机会遇到了这个工具——Appium Studio, 在官网是这么解释的

  

Get your Appium testing projects going within minutes

Install Appium Studio with a single click along with all the required development tools. Use the intuitive GUI to easily develop new tests or execute existing Appium testing projects on any local or remote devices.


让Appium测试项目在几分钟内完成


只需单击一下即可安装Appium Studio以及所有必需的开发工具。 使用直观的GUI轻松开发新测试或在任何本地或远程设备上执行现有的Appium测试项目。

是一个可以录制脚本,可以运行测试用例,它可以在windows电脑上,链接ios设备做ios的测试,这里为这个工具点个赞,我们测试ios应用不在用ios设备也能进行测试了。

 

下载地址https://experitest.com/mobile-test-automation/appium-studio/


其他需要配置的appium测试环境。


安装后,


image.png


大体界面就是这样的,


我们链接设备,点击按钮


image.png


,增加你的设备,我链接了一台安卓模拟器,一台iphone6,(注意,adb环境可能识别不了设备,去appium studo 安装目录下复制adb.exe 去替换模拟器下面的adb,修改为对应的包就可以)


image.png


我们选择安装我们的应用,到指定设备上,也可以关闭启动应用, 可以选择配置,

当我们选择后,


image.png


会给我们生成对应的脚本,我们可以切换不同的脚本​


image.png


都是可以很好的切换。那么怎么录制我们的脚本呢,启动app,


选择


image.png


录制,

 

然后我们去模拟器去操作就可以


这样就给我们操作完,点击关闭,自动吧录制的步骤给我们添加上去,


下面生成对应的脚本,


我们点击保存按钮进行保存


录制脚本如下python版本


import unittest
import time
from appium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions


class sssss(unittest.TestCase):
    reportDirectory = 'reports'
    reportFormat = 'xml'
    dc = {}
    testName = 'sssss'
    driver = None
    
    def setUp(self):
        self.dc['reportDirectory'] = self.reportDirectory
        self.dc['reportFormat'] = self.reportFormat
        self.dc['testName'] = self.testName
        self.dc['udid'] = '127.0.0.1:62001'
        self.dc['app'] = 'C:\\Users\\Administrator\\AppData\\Roaming\\appiumstudio\\apk\\com.aixuetan.onlinecom.aixuetang.mobile.activities.LaunchActivity.2.apk'
        self.dc['appPackage'] = 'com.aixuetan.online'
        self.dc['appActivity'] = 'com.aixuetang.mobile.activities.LaunchActivity'
        self.dc['instrumentApp'] = 'true'
        self.dc['platformName'] = 'android'
        self.driver = webdriver.Remote('http://localhost:4723/wd/hub',self.dc)

    def testsssss(self):
       
        self.driver.find_element_by_xpath("xpath=//*[@id='course_image' and (./preceding-sibling::* | ./following-sibling::*)[@text='高一语文通用版(全年班)']]").click()
        self.driver.find_element_by_xpath("xpath=//*[@text='已报名76423人']").click()
        self.driver.find_element_by_xpath("xpath=//*[@id='ll_enroll']").click()
        self.driver.find_element_by_xpath("xpath=//*[@text='03-进行更深层次的阅读(一)——赏析评价能力的提升(上)']").click()
        self.driver.find_element_by_xpath("xpath=//*[@text='高一语文通用版(全年班)']").click()
        self.driver.find_element_by_xpath("xpath=//*[@id='course_image']").click()
        self.driver.find_element_by_xpath("xpath=//*[@id='course_image']").click()
        self.driver.find_element_by_xpath("xpath=//*[@id='course_image']").click()
        self.driver.find_element_by_xpath("xpath=//*[@text='已报名76423人']").click()
        self.driver.find_element_by_xpath("xpath=//*[@text='加入课程']").click()
        self.driver.find_element_by_xpath("xpath=//*[@id='et_password']").click()
        self.driver.find_element_by_xpath("xpath=//*[@id='et_username']").send_keys('1111111')
        self.driver.find_element_by_xpath("xpath=//*[@id='et_password']").send_keys('11111')
        self.driver.find_element_by_xpath("xpath=//*[@id='tv_login']").click()

    def tearDown(self):
        self.driver.quit()
        
    if __name__ == '__main__':
        unittest.main()


java版本如下​


//package <set your test package>;
import io.appium.java_client.remote.AndroidMobileCapabilityType;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;
import io.appium.java_client.TouchAction;
import java.time.Duration;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.android.AndroidKeyCode;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.By;
import org.testng.annotations.*;
import java.net.URL;
import java.net.MalformedURLException;
import java.util.logging.Level;

public class sssss {
    private String reportDirectory = "reports";
    private String reportFormat = "xml";
    private String testName = "sssss";
    protected AndroidDriver<AndroidElement> driver = null;

    DesiredCapabilities dc = new DesiredCapabilities();
    
    @BeforeMethod
    public void setUp() throws MalformedURLException {
        dc.setCapability("reportDirectory", reportDirectory);
        dc.setCapability("reportFormat", reportFormat);
        dc.setCapability("testName", testName);
        dc.setCapability(MobileCapabilityType.UDID, "127.0.0.1:62001");
        dc.setCapability(MobileCapabilityType.APP, "C:\\Users\\Administrator\\AppData\\Roaming\\appiumstudio\\apk\\com.aixuetan.onlinecom.aixuetang.mobile.activities.LaunchActivity.2.apk");
        dc.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.aixuetan.online");
        dc.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.aixuetang.mobile.activities.LaunchActivity");
        dc.setCapability("instrumentApp", true);
        driver = new AndroidDriver<>(new URL("http://localhost:4723/wd/hub"), dc);
        driver.setLogLevel(Level.INFO);
    }

    @Test
    public void testsssss() {
        driver.findElement(By.xpath("//*[@id='course_image' and (./preceding-sibling::* | ./following-sibling::*)[@text='高一语文通用版(全年班)']]")).click();
        driver.findElement(By.xpath("//*[@text='已报名76423人']")).click();
        driver.findElement(By.xpath("//*[@id='ll_enroll']")).click();
        driver.findElement(By.xpath("//*[@text='03-进行更深层次的阅读(一)——赏析评价能力的提升(上)']")).click();
        driver.findElement(By.xpath("//*[@text='高一语文通用版(全年班)']")).click();
        driver.findElement(By.xpath("//*[@id='course_image']")).click();
        driver.findElement(By.xpath("//*[@id='course_image']")).click();
        driver.findElement(By.xpath("//*[@id='course_image']")).click();
        driver.findElement(By.xpath("//*[@text='已报名76423人']")).click();
        driver.findElement(By.xpath("//*[@text='加入课程']")).click();
        driver.findElement(By.xpath("//*[@id='et_password']")).click();
        driver.findElement(By.xpath("//*[@id='et_username']")).sendKeys("1111111");
        driver.findElement(By.xpath("//*[@id='et_password']")).sendKeys("11111");
        driver.findElement(By.xpath("//*[@id='tv_login']")).click();
    }

    @AfterMethod
    public void tearDown() {
        driver.quit();
    }
}


然后当你没有选中测试用例步骤,他会给你注释掉,点击run按钮,启动测试,


我们可以看到log上面有日志输出,


运行到步骤会选中步骤,运行完,自动生成测试报告


image.png


一些重要的信息也会展示出来


image.png


还可以看到步骤的dubeg信息,每个步骤都会有截图


image.png


image.png

可以选择最近的查看测试报告,

选择all summaries  reposrt  统计了所有运行的,直观,


image.png


下面详细的记录日志

image.png


可以录制,可以运行现有脚本,每个步骤 都有截图,还可以生成批量的测试报告,有没有很简单,关键它可以在windows执行ios测试,推荐大家去尝鲜。



相关文章
|
3月前
|
缓存 Windows
清理windows缓存bat脚本
清理windows缓存bat脚本
81 0
|
3月前
|
Windows
整人脚本-连点50下弹窗的windows脚本
整人脚本-连点50下弹窗的windows脚本
63 0
|
3月前
|
Windows
整人脚本-我是猪windows脚本
整人脚本-我是猪windows脚本
44 0
|
3月前
|
Windows
整人脚本-会说话的windows脚本
整人脚本-会说话的windows脚本
27 0
|
3月前
|
存储 监控 JavaScript
windows批处理小脚本总结
windows批处理小脚本总结
|
5月前
|
网络协议 测试技术 Windows
Loadrunner 脚本开发-利用loadrunner开发Windows Sockets协议脚本
Loadrunner 脚本开发-利用loadrunner开发Windows Sockets协议脚本
76 0
|
7月前
|
Windows
按键精灵脚本-windows桌面自动化操作
按键精灵脚本-windows桌面自动化操作
276 0
|
8月前
|
Python Windows
Windows定时任务 每隔一段时间(最小到秒级)执行一次指定的Python脚本
Windows定时任务 每隔一段时间(最小到秒级)执行一次指定的Python脚本
Windows定时任务 每隔一段时间(最小到秒级)执行一次指定的Python脚本
|
8月前
|
Java C语言 C++
0基础都能看懂的 Visual Studio Code(VScode)使用脚本一键配置安装C/C++环境、编译运行Windows版本教程(内附脚本、安装包下载链接)
网上很多配置VScode的C、C++环境的教程,但是很多时候跟着从头到尾做了之后反而还是运行不了,于是笔者在网上翻阅资料后,发现了一个自动配置环境的脚本,亲测有效,大概5分钟就可以配置好环境了。直接进入教程。
0基础都能看懂的 Visual Studio Code(VScode)使用脚本一键配置安装C/C++环境、编译运行Windows版本教程(内附脚本、安装包下载链接)
|
10月前
|
安全 数据可视化 Windows
[笔记]Windows安全之《三》Shellcode 补充之 Get-InjectedThread脚本搭建环境及其使用
Windows安全之《三》Shellcode 补充之 Get-InjectedThread脚本搭建环境及其使用
113 0
[笔记]Windows安全之《三》Shellcode 补充之 Get-InjectedThread脚本搭建环境及其使用
相关产品
云迁移中心
推荐文章
更多