run-tests.cmd 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. @echo off
  2. setlocal
  3. :loop
  4. if "%1" == "" goto break
  5. if "%1" == "skip_selenium" (
  6. set SKIP_SELENIUM="True"
  7. )
  8. if "%1" == "skip_app" (
  9. set SKIP_APP="True"
  10. )
  11. if "%1" == "skip_tests" (
  12. set SKIP_TESTS="True"
  13. )
  14. shift
  15. goto loop
  16. :break
  17. rem SETUP ENVIRONMENT FOR RUNNING SELENIUM TESTS
  18. rem ============================================
  19. set VMW_HOME=C:\Program Files\Mainsoft for Java EE
  20. set SELENIUM_HOME=C:\Mainsoft\runtime\Tools\selenium
  21. set Browser=C:\Program Files\Internet Explorer\iexplore.exe
  22. set HTTPServer=http://localhost:8090
  23. set SeleniumURL=%HTTPServer%/Selenium
  24. rem =================================================
  25. set startDate=%date%
  26. set startTime=%time%
  27. set sdy=%startDate:~10%
  28. set /a sdm=1%startDate:~4,2% - 100
  29. set /a sdd=1%startDate:~7,2% - 100
  30. set /a sth=%startTime:~0,2%
  31. set /a stm=1%startTime:~3,2% - 100
  32. set /a sts=1%startTime:~6,2% - 100
  33. set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm%
  34. set ResultsURL=/PostResults
  35. set ResultsDir=FuncTests%TIMESTAMP%
  36. set OUTPUT_FILE_PREFIX=System_Web_Extensions
  37. set COMMON_PREFIX=%cd%\%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME%
  38. set SELENIUM_OUTPUT_XML=%COMMON_PREFIX%.xml
  39. set BUILD_LOG=%COMMON_PREFIX%.build.log
  40. set RUN_LOG=%COMMON_PREFIX%.run.log
  41. rem DEPLOY SELENIUM WITH TESTS TO SERVER
  42. rem ====================================
  43. if DEFINED SKIP_SELENIUM goto after_selenium
  44. echo Deploying Selenium
  45. call %SELENIUM_HOME%\DeploySelenium.cmd "Tomcat" "%SELENIUM_HOME%\TomcatDeploy.cmd" "http://admin:admin@localhost:8090" "Test\standalone\Sys.WebForms" "Test\standalone\System.Web.UI" >>%BUILD_LOG% 2<&1
  46. :after_selenium
  47. rem BUILD APPLICATION UNDER TEST
  48. rem ============================================
  49. if DEFINED SKIP_APP goto after_app
  50. echo Building %cd%\System.Web.Extensions.JavaEE.csproj
  51. msbuild System.Web.Extensions.JavaEE.csproj /p:Configuration=Debug_Java >>%BUILD_LOG% 2<&1
  52. pushd Test\standalone\AUT
  53. echo Building %cd%\SystemWebExtensionsAUT.JavaEE.csproj
  54. del /F /Q bin_Java\deployedFiles bin_Java\outputFiles.list
  55. msbuild SystemWebExtensionsAUT.JavaEE.csproj /t:Deploy /p:Configuration=Debug_Java >>%BUILD_LOG% 2<&1
  56. popd
  57. :after_app
  58. if DEFINED SKIP_TESTS goto after_tests
  59. echo Running Functional Test Suites
  60. mkdir %ResultsDir%
  61. type %SELENIUM_HOME%\SeleniumTestResultsHead.txt >%SELENIUM_OUTPUT_XML%
  62. wget -O .\nul "%HTTPServer%%ResultsURL%/Default.ashx" >>%RUN_LOG% 2<&1
  63. wget -O "%ResultsDir%\selenium-test.css" "%HTTPServer%%ResultsURL%/selenium-test.css" >>%RUN_LOG% 2<&1
  64. rem RUN THE TEST SUITES ONE AFTER THE OTHER
  65. rem ============================================
  66. call :executeTestSuite ../MainsoftTests/System.Web.UI/UpdatePanel/UpdatePanelTestSuite.html
  67. call :executeTestSuite ../MainsoftTests/Sys.WebForms/PageRequestManager/PageRequestManagerTestSuite.html
  68. rem ADD MORE TEST SUITES ABOVE THIS LINE
  69. rem ====================================
  70. type %SELENIUM_HOME%\SeleniumTestResultsTail.txt >>%SELENIUM_OUTPUT_XML%
  71. :after_tests
  72. goto afterExecuteTestSuite
  73. rem INTERNAL SCRIPT FUNCTION TO RUN SPECIFIC TEST SUITE
  74. rem ===================================================
  75. :executeTestSuite
  76. set TestSuiteRelativePath=%1
  77. set SuiteName=%~n1
  78. set ResultsAsXML=%ResultsDir%\%SuiteName%Results.xml
  79. set ResultsAsHtml=%ResultsDir%\%SuiteName%Results.html
  80. echo Test suite: %SuiteName%
  81. echo Test suite: %SuiteName% >>%RUN_LOG% 2<&1
  82. "%Browser%" "%SeleniumURL%/core/TestRunner.html?test=%TestSuiteRelativePath%&auto=true&close=off&multiWindow=off&resultsUrl=%ResultsURL%/Default.ashx"
  83. if NOT %ResultsAsXML%=="" (
  84. wget -O "%ResultsAsXML%" "%HTTPServer%%ResultsURL%/GetLastResults.ashx" >>%RUN_LOG% 2<&1
  85. type "%ResultsAsXML%" >>%SELENIUM_OUTPUT_XML%
  86. )
  87. if NOT %ResultsAsHtml%=="" (
  88. wget -O "%ResultsAsHtml%" "%HTTPServer%%ResultsURL%/GetLastResults.ashx?Html" >>%RUN_LOG% 2<&1
  89. )
  90. exit /B
  91. :afterExecuteTestSuite
  92. endlocal