zoukankan      html  css  js  c++  java
  • 开发人员用的提交测试环境的AutoIT脚本

    主要功能就是依次检查各个步骤,确定该做的工作都已经完成,如果没有完成,就自动打开相关的工具,并等待完成。

    代码如下:

    ;各个文件的位置
    $vss = "C:\Program Files\Microsoft Visual Studio\COMMON\VSS\win32\SSEXP.EXE"
    $ie = "C:\Program Files\Internet Explorer\iexplore.EXE"
    $plsql = "C:\Program Files\PLSQL Developer\plsqldev.exe"
    
    ;是否已经将所有文件提交VSS?
    $haveCheckedIn = MsgBox(4, "VSS 检查","是否已经将所有文件提交VSS?")
    ;->否;打开VSS,自动输入用户名密码,进入
    If $haveCheckedIn = 7 Then
    	Run($vss)
    
    	WinWaitActive("Visual SourceSafe Login")
    	Send("hq100545")
    	Send("{Enter}")
    
    	WinWaitActive("Visual SourceSafe Explorer -- vss60cn");
    
    	;等待完成…………
    	MsgBox(0,"VSS 检查","完成之后请继续!")
    
    	If WinExists("Visual SourceSafe Explorer -- vss60cn") Then
    		WinClose("Visual SourceSafe Explorer -- vss60cn")
    		WinWaitClose("Visual SourceSafe Explorer -- vss60cn")
    	EndIf
    
    EndIf
    
    ;是否存在SQL文件(.sql)?
    $haveSQLFiles = MsgBox(4, "SQL 检查","是否有需要提交的SQL文件?");
    
    ;如果有SQL的话,则需要验证SQL的有效性
    if $haveSQLFiles = 6 Then
    	;是否已验证SQL的有效性
    	$CheckedSQL = MsgBox(4,"SQL 检查","是否已经验证过SQL的有效性?")
    	;->否:打开pl/sql developer,并以sys身份登录
    	if $CheckedSQL = 7 Then
    		Run($plsql)
    
    		WinWaitActive("Oracle Logon")
    		Send("+{Tab}")
    		Send("sys")
    		Send("{Tab}")
    		Send("lis")
    		Send("{Tab}")
    		Send("ORCL_139")
    		Send("{Tab}")
    		Send("SYSDBA")
    		Send("{ENTER}")
    
    		WinWaitActive("PL/SQL Developer - sys@ORCL_139")
    
    		;等待完成…………
    		MsgBox(0,"SQL 检查","完成之后请继续!")
    
    		If	WinExists("PL/SQL Developer - sys@ORCL_139") Then
    			WinClose("PL/SQL Developer - sys@ORCL_139")
    			WinWaitClose("PL/SQL Developer - sys@ORCL_139")
    		EndIf
    	EndIf
    EndIf
    
    ;是否已经修改QC状态
    $ModifiedQC = MsgBox(4,"QC 检查","是否已经修改QC状态?")
    ;->否:打开浏览器,进入到QC
    If $ModifiedQC = 7 Then
    
    	Send("#r")
    	WinWaitActive("运行")
    	Send("http://10.18.4.149:8080/qcbin/start_a.htm",1);
    	Send("{Enter}")
    
    	WinWaitActive("Mercury Quality Center 9.0 - Windows Internet Explorer")
    
    	;等待完成…………
    	MsgBox(0,"QC 检查","完成之后请继续!")
    
    	If WinExists("Mercury Quality Center 9.0 - Windows Internet Explorer") Then
    		WinClose("Mercury Quality Center 9.0 - Windows Internet Explorer")
    		WinWaitClose("Mercury Quality Center 9.0 - Windows Internet Explorer")
    	EndIf
    EndIf
    
    ;是否已经填写变更登记?
    $haveFilledChangeReport = MsgBox(4, "变更登记检查","是否已填写变更登记并签入?")
    ;->否;打开VSS,自动输入用户名密码,进入
    If $haveFilledChangeReport = 7 Then
    	Run($vss)
    
    	WinWaitActive("Visual SourceSafe Login")
    	Send("hq100545")
    	Send("{Enter}")
    
    	WinWaitActive("Visual SourceSafe Explorer -- vss60cn");
    
    	;等待完成…………
    	MsgBox(0,"变更登记检查","完成之后请继续!")
    
    	If WinExists("Visual SourceSafe Explorer -- vss60cn") Then
    		WinClose("Visual SourceSafe Explorer -- vss60cn")
    		WinWaitClose("Visual SourceSafe Explorer -- vss60cn")
    	EndIf
    
    EndIf
    
    ;是否已经打印测试报告?
    $havePrintedTestReport = MsgBox(4, "测试报告检查","是否已填写IT测试报告?")
    ;->否:打开Word
    If $havePrintedTestReport = 7 Then
    
    	Send("#r")
    	WinWaitActive("运行")
    
    	;选择当前要提交的是需求还是缺陷
    	$ProgramType = MsgBox(4, "测试报告检查","请选择提交程序的类型:需求选是,Bug选否!")
    
    	;->需求:打开RQ的测试报告
    	If $ProgramType = 6 Then
    		Send("WINWORD.EXE C:\IT测试报告_rq.doc", 1)
    		Send("{ENTER}")
    	EndIf
    	;->缺陷:打开ing的测试报告
    	If $ProgramType = 7 Then
    		Send("WINWORD.EXE C:\IT测试报告_rq.doc", 1)
    		Send("{ENTER}")
    	EndIf
    
    	;等待完成…………
    	MsgBox(0,"变更登记检查","完成之后请继续!")
    
    	If WinExists("IT测试报告_rq.doc - Microsoft Word") Then
    		WinClose("IT测试报告_rq.doc - Microsoft Word")
    		WinWaitClose("IT测试报告_rq.doc - Microsoft Word")
    	EndIf
    
    	If WinExists("IT测试报告_ing.doc - Microsoft Word") Then
    		WinClose("IT测试报告_ing.doc - Microsoft Word")
    		WinWaitClose("IT测试报告_ing.doc - Microsoft Word")
    	EndIf
    
    
    EndIf
    ;OK,可以打印测试报告并提交签字了。
    MsgBox(0,"恭喜","一切OK,测试报告签字后就可以提交了!")
    

    这样,就可以避免在发布测试环境的时候忘东忘西了,呵呵。

    其实,还可以进行其他改进,比方说:

    构建几个函数,让程序模块化。

    使用鼠标控制事件,让自动化的程度更高。

    希望大家也能够使用AotuIT这个工具,让我们日常的重复性工作的自动化程度更高。

    作者:侯伯薇@大连
    出处:http://www.cnblogs.com/houbowei/
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    零基础学习Java,视频、网上直播和线下培训,哪个更好?
    艾编程:海量消息数据的处理kafka以及海量数控读取储存处理Mycat
    艾编程coding老师:深入JVM底层原理与性能调优
    Are Noisy Sentences Useless for Distant Supervised Relation Extraction?
    A Probabilistic Formulation of Unsupervised Text Style Transfer
    Orderless Recurrent Models for Multi-label Classification
    Learning from Easy to Complex: Adaptive Multi-curricula Learning for Neural Dialogue Generation
    Hyper-Parameter Optimization: A Review of Algorithms and Applications
    Capturing document context inside sentence-level neural machine translation models with self-training
    ReZero is All You Need: Fast Convergence at Large Depth
  • 原文地址:https://www.cnblogs.com/houbowei/p/1776208.html
Copyright © 2011-2022 走看看