[英]IOS UI Automation - working with external Data
Is there any way to work with external Data, for example Textfiles ? 有什么方法可以处理外部数据,例如文本文件? With JS there isn´t any option to do I/O, for a good reason. 有了JS,有充分的理由,没有任何选择可以进行I / O。 The purpose is, that i want to validate data from a file or a database with the data represented in the APP (comparison tests)… Is there any trick for the UI Automation tool ? 目的是,我要使用APP中表示的数据(比较测试)来验证文件或数据库中的数据……UI自动化工具有什么窍门吗?
This is something I came up with based on performTaskWithPathArgumentsTimeout
method: 这是我根据performTaskWithPathArgumentsTimeout
方法performTaskWithPathArgumentsTimeout
:
var target = UIATarget.localTarget();
var host = target.host();
var result = host.performTaskWithPathArgumentsTimeout(
"/bin/cat", ["/Users/username/Documents/test.txt"], 5)
var content = result.stdout;
UIALogger.logMessage(content);
Content of the test.txt
: test.txt
内容:
Hello World! 你好,世界!
This is a test. 这是一个测验。
And this is how it looks in the Editor Log : 这就是它在编辑器日志中的外观:
The downside is that you'll have to manually parse file's content. 缺点是您必须手动解析文件的内容。
The only feasible option I can see, is to use this same method in conjunction with Command Line Shell For SQLite . 我看到的唯一可行的选择是将这种方法与Command Shell Shell for SQLite结合使用。 But, alas, I haven't tried this approach, so I can't guarantee it'll work. 但是,a,我还没有尝试过这种方法,所以我不能保证它会起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.