testcomplete文件处理aqFile、aqFileSystem

#语言:JavaScript(注意与 JScript区别)

function test(){
  var folderHave2file="C:\\Users\\test\\Desktop\\aqfile\\2files";
  var folderHave0file="C:\\Users\\test\\Desktop\\aqfile\\null";
  var file1="C:\\Users\\test\\Desktop\\aqfile\\2files\\1ac.txt";
  var file2="C:\\Users\\test\\Desktop\\aqfile\\2files\\培训大纲.txt";
  var fileDelReg="C:\\Users\\test\\Desktop\\aqfile\\del\\新建文本文档.txt";
  var folderAdd="C:\\Users\\test\\Desktop\\aqfile\\del";
  var fileForTest="C:\\Users\\test\\Desktop\\aqfile\\2files\\*_Report.csv";
  
  //获取文件/目录是否存在
  let a1=aqFile.Exists(folderHave2file);
  Log.Message("1.目录是否存在:"+a1);
  let a2=aqFile.Exists(file1);
  Log.Message("2.文件是否存在:"+a2);
  
  //获取文件更新、创建时间
  let a3=aqFile.GetSize(file2);  //不支持目录
  Log.Message("3.获取文件大小(字节):"+a3);
  let a4=aqFile.GetCreationTime(file1)//不支持目录
  Log.Message("4.获取文件创建时间:"+a4);
  let a5=aqFile.GetLastAccessTime(file2)//不支持目录
  Log.Message("5.获取文件创建时间:"+a5);
  
  //删除文件
  //只会删除文件,不删除目录,(传Folder时,不报错,也不删除)
  let ax=aqFile.Delete(fileDelReg);  //支持正则 *.txt  *.* *
  Log.Message("--**Del count:"+ax);
    
  //读写文件
  let a6=aqFile.WriteToTextFile(file1,"11", aqFile.ctANSI,false);//true:重写,false:追加
  Log.Message("6.读取文件内容:"+a6);
  let a7=aqFile.ReadWholeTextFile(file1,aqFile.ctUTF8); //不支持目录、全文读
  Log.Message("7.读取文件内容:"+a7);
  
   //文件名正则:
  //aqFile支持不佳,aqFileSystem支持良好
  let a8=aqFileSystem.FindFiles(folderHave2file, "*.txt").Count;
  Log.Message("8.查找匹配的文件个数:"+a8);
  let a9=aqFileSystem.FindFiles(folderHave2file, "*.txt").Item(2).Name;
  Log.Message("9.打印文件名:"+a9);
  
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
TestComplete is an automated testing tool, designed for advanced and novice testers alike, to create, manage and run tests for any desktop, Web or rich client software. It does not depend on any development tool, or application type. Your tests will work fine with any application regardless of whether it was created in C#, C++, Delphi, Java, or any other development language. TestComplete is the most efficient tool of its kind, in regards to the price and quality of the product. This guide takes a refined approach towards quickly learning the capabilities of TestComplete, using relevant illustrations and practical examples. Each example is consonant with true-to-life situations, which testers would come across sooner or later, while automating tests. With the help of these examples, we will look into complex themes and learn how to test web applications in the most effective manner. Throughout the first chapters, we will be dealing with some fairly simple tasks that are of interest to people new to TestComplete, gradually moving towards advanced-level automation approaches, which are riveting both for novices and experienced TestComplete users. We will explore various methods of tests creation for study (e.g. recording, modification and manual coding with use of different approaches), learn test creation using different methods(each of them being suitable for a specific use-case), learn how to distinguish between different methods for accessing controls elements, selecting a most appropriate approach for each of the cases in view. We will also undertake distributive testing for the sake of shortening the overall time for test launches. This practical guide will help you to answer frequently asked questions relating to automation testing and set the tone for the correct direction of your advancements, which are instrumental to organizing automation in your project. What you will learn from this book Learn to install and provide appropriate settings for TestComplete Record, modify, and manual code scripts Learn to create keyword tests by the automation specialists Customize effective launches of the tests (including distributed launching on several computers) Learn to debug scripts, and search and correct errors Discover how to work with desktop applications and web-applications Understand how to use log formatting and log generation in a proper format Get to grips with how to work with non-standard controls elements

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值