Advertisement
talkingtree

Application.cfc - CFSelenium Mxunit

Mar 19th, 2011
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <cfcomponent
  2.     displayname="UITests_Migration_FirstQuote"
  3.     output="false"
  4.     hint="Automated UI testing for FirstQuote webtop using CFSelenium">
  5.  
  6.     <!--- Set up the application using convention: name = UITests_{branch}_{webtop} --->
  7.     <cfset THIS.Name = "UITests_Migration_Webtop" />
  8.     <cfset THIS.ApplicationTimeout = CreateTimeSpan( 0, 0, 3, 0 ) />
  9.     <cfset THIS.SessionManagement = false />
  10.     <cfset THIS.ClientManagement = false />
  11.     <cfset THIS.SetClientCookies = false />
  12.  
  13.     <!--- Define the page request properties. --->
  14.     <cfsetting
  15.         requesttimeout="180"
  16.         showdebugoutput="false"
  17.         enablecfoutputonly="false"
  18.         />
  19.  
  20.     <cffunction
  21.         name="OnApplicationStart"
  22.         access="public"
  23.         returntype="boolean"
  24.         output="false"
  25.         hint="Fires when the application is first created.">
  26.        
  27.         <cfscript>
  28.             // Initialize Selenium client for this webtop
  29.             application.browserUrl = "https://mywebtop.mycompany.com";  // CHANGE THIS PER WEBTOP
  30.             application.browserStartCommand = "*firefox3 C:/Program Files (x86)/Mozilla Firefox/firefox.exe"; // UNIQUE TO YOUR SYSTEM
  31.             application.TestCaseManager = new UITests.comps.TSuiteManager();
  32.             if (CGI.SCRIPT_NAME CONTAINS "/Tests" OR CGI.SCRIPT_NAME CONTAINS "/Automation"){
  33.                 application.TestCaseManager.startClient(browserUrl=application.browserURL,browserStartCommand=application.browserStartCommand);
  34.             }
  35.            
  36.             // Set location for UITests root, which is higher than the application level
  37.             application.UITestsRoot = trim(listfirst(replace(getDirectoryFromPath(expandPath('*.*')) & "..\..","UITests\","UITests\ ","one")," "));
  38.            
  39.             // Create all the dataproviders for the test suite
  40.             application.dp = createObject("component","UITests.dataproviders.DataProvider").init();
  41.             application.dp.setUITestsRoot(application.UITestsRoot);
  42.             application.dpIndex = application.dp.getDataProvidersIndex();
  43.             application.dataproviders = application.dp.createDataProviders();
  44.            
  45.             // Create helper CFC
  46.             application.utils = new UITests.comps.Utils();
  47.         </cfscript>
  48.        
  49.         <cflog application="true" text="-------> Application '#this.name#' started">
  50.        
  51.         <!--- Return out. --->
  52.         <cfreturn true />
  53.     </cffunction>
  54.      
  55.     <cffunction
  56.         name="OnRequestStart"
  57.         access="public"
  58.         returntype="boolean"
  59.         output="false"
  60.         hint="Fires at first part of page processing.">
  61.  
  62.         <!--- Define arguments. --->
  63.         <cfargument
  64.             name="TargetPage"
  65.             type="string"
  66.             required="true"
  67.             />
  68.          
  69.         <!--- Return out. --->
  70.         <cfreturn true />
  71.     </cffunction>
  72.    
  73.     <cffunction
  74.         name="OnApplicationEnd"
  75.         access="public"
  76.         returntype="void"
  77.         output="false"
  78.         hint="Fires when the application is terminated.">
  79.  
  80.         <!--- Define arguments. --->
  81.         <cfargument
  82.             name="ApplicationScope"
  83.             type="struct"
  84.             required="false"
  85.             default="#StructNew()#"
  86.             />
  87.        
  88.             <cfset application.TestCaseManager.stopClient()>
  89.             <cflog application="true" text="-------> #this.name# stopped">
  90.  
  91.         <!--- Return out. --->
  92.         <cfreturn />
  93.     </cffunction>
  94.  
  95. </cfcomponent>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement