简体   繁体   English

如何编写iOS的第一个Appium测试

[英]How Do I Write My First Appium Test For iOS

I have set up all of the prerequisites to run an Appium test on my mac computer, but I cannot figure out how to run my first Appium test. 我已经设置了在Mac计算机上运行Appium测试的所有先决条件,但是我不知道如何运行我的第一个Appium测试。 I am having trouble writing my test in Java. 我在用Java编写测试时遇到麻烦。 The perfect thing would be a file that I could just put on my computer, that, when run, would open the iOS simulator and press some buttons. 完美的事情是我可以将其放在计算机上的文件,该文件在运行时将打开iOS模拟器并按一些按钮。 I know Selenium well so I could figure out the rest myself. 我非常了解Selenium,所以我自己可以找出其余的东西。 I also have several test apps on my computer 我的电脑上也有几个测试应用

But any help with writing the actual test file itself (Java preferred) would be much appreciated! 但是对编写实际测试文件本身(Java首选)的任何帮助将不胜感激!

To run iOS tests, you can follow these steps : 要运行iOS测试,您可以按照以下步骤操作:

( Note : I am using Java language here in Eclipse IDE and using Appium app): 注意 :我在Eclipse IDE中使用Java语言并使用Appium应用):

  1. Create a new java project in Eclipse. 在Eclipse中创建一个新的Java项目。
  2. Import jar files : Selenium Server (formerly the Selenium RC Server) version and required client driver (according to your language choice) which can be downloaded here . 导入jar文件:Selenium Server(以前称为Selenium RC Server)版本和所需的客户端驱动程序(根据您的语言选择),可以在此处下载。 (To import : Right click on your project -> Properties -> Libraries -> Add External JARs. Add all three selenium jar files here.) (要导入:右键单击您的项目->属性->库->添加外部JAR。在此添加所有三个Selenium Jar文件。)
  3. Download Appium app and launch. 下载 Appium应用并启动。
  4. You can run your test scripts either in simulator or on real device. 您可以在模拟器或真实设备上运行测试脚本。 To run scripts on real iOS device, you will need 'deviceName', 'platformVersion', 'UDID' (Device ID) and 'Bundle ID' (Application Bundle ID) and absolute path to the .ipa. 要在真实的iOS设备上运行脚本,您将需要“ deviceName”,“ platformVersion”,“ UDID”(设备ID)和“捆绑包ID”(应用程序捆绑包ID)以及.ipa的绝对路径。
  5. To run scripts on iOS simulator , you will need 'deviceName', 'platformVersion', path to .app and 'Bundle ID' of your app. 要在iOS模拟器上运行脚本,您将需要“ deviceName”,“ platformVersion”,。app的路径和应用程序的“捆绑ID”。
  6. Choose capabilties in Appium app and mention the same in your script based on whether you are testing on simulator or on device. 在Appium应用程序中选择功能,然后根据要在模拟器上还是在设备上进行测试,在脚本中提及这些功能。
  7. Launch Appium server and then run your script. 启动Appium服务器,然后运行您的脚本。

All Appium server capabilities which can be used can be found here . 可在此处找到所有可以使用的Appium服务器功能。

You can refer to my blog post here as well for more details to execute a sample basic script. 您也可以在这里参考我的博客文章以获取更多有关执行示例基本脚本的详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM