您好,欢迎光临本网站![请登录][注册会员]  
文件名称: Rails Test Prescriptions.pdf
  所属分类: Web开发
  开发工具:
  文件大小: 5mb
  下载次数: 0
  上传时间: 2019-08-14
  提 供 者: drji*****
 详细说明: Contents I GettingStartedwithTestinginRails 12 1 TheGoalsofAutomatedDeveloperTesting 13 1.1 ATestingFable ..................... 13 1.2 WhoAreYou?...................... 15 1.3 ThePowerofTestingFirst............... 16 1.4 WhatIsTDDGoodFor? ................ 17 1.5 WhenTDDNeedsSomeHelp ............. 19 1.6 ComingUpNext.................. ..... 20 1.7 Acknowledgments.................... 22 2 TheBasicsofRailsTesting 24 2.1 What’saTest?...................... 24 2.2 WhatGoesinaTest?.................. 26 2.3 SetupandTeardown.................. 29 2.4 WhatCanYouTestinRails?.............. 32 2.5 WhatHappensWhenTestsRun?........... 34 2.6 RunningtheRailsTests................ 36 2.7 MoreInfo:GettingDataintotheTest......... 38 2.8 BeyondtheBasics.................... 41 3 WritingYourFirstTests 42 3.1 TheFirstTest-First................... 44 3.2 TheFirstRefactor.................... 47 3.3 MoreValidations..................... 49 3.4 SecurityNow! ...................... 53 3.5 ApplyingSecurity.................... 55 3.6 PunishingMiscreants.................. 56 3.7 RoadMap......................... 60 CONTENTS 8 4 TDD,RailsStyle 61 4.1 NowforaViewTest................... 61 4.2 TestingtheProjectView:ACascadeofTests .... 64 4.3 SoFar,SoGood..................... 70 II TestingApplicationData 71 5 TestingModelswithRailsUnitTests 72 5.1 What’sAvailableinaModelTest........... 72 5.2 WhattoTestinaModelTest ............. 74 5.3 OK,FunnyMan,WhatIsaGoodModelTestClass? 74 5.4 AssertingaDifference,orNot............. 76 5.5 TestingActiveRecordFinders............. 77 5.6 ComingUpNext..................... 80 6 CreatingModelTestDatawithFixturesandFactories 81 6.1 DefiningFixtureData.................. 81 6.2 LoadingFixtureData.................. 84 6.3 WhyFixturesAreaPain................ 85 6.4 UsingFactoriestoFixFixtures............ 86 6.5 DataFactories...................... 87 6.6 Installingfactory_girl.................. 87 6.7 CreatingandUsingSimpleFactories......... 88 6.8 SequencingforUniqueAttributes........... 90 6.9 FreedomofAssociation................. 91 6.10 FactoriesoftheWorldUnite.............. 93 6.11 ManagingDateandTimeData ............ 95 6.12 ModelDataSummary.................. 99 7 UsingMockObjects 101 7.1 What’saMockObject?................. 101 7.2 Stubs........................... 103 7.3 StubswithParameters................. 108 7.4 Mock,Mock,Mock ................... 112 7.5 MockObjectsandBehavior-DrivenDevelopment.. 114 7.6 MockDosandMockDon’ts.............. 117 7.7 ComparingMockObjectLibraries........... 118 7.8 MockObjectSummary................. 126 Reporterratum thiscopyis(P1.0printing,February2011) CONTENTS 9 III TestingUser-FacingLayers 127 8 TestingControllerswithFunctionalTests 128 8.1 What’sAvailableinaControllerTest?........ 128 8.2 WhattoTest....................... 129 8.3 SimulatingaControllerCall.............. 130 8.4 TestingControllerResponse.............. 133 8.5 TestingReturnedData................. 134 8.6 TestingRoutes...................... 137 8.7 ComingUp........................ 138 9 TestingViews 139 9.1 TheGoalsofViewTesting............... 139 9.2 KeystoSuccessfulViewTesting............ 140 9.3 Usingassert_select................... 141 9.4 TestingOutgoingEmail................. 146 9.5 TestingHelpers..................... 148 9.6 TestingBlockHelpers.................. 150 9.7 Usingassert_selectinHelperTests.......... 151 9.8 HowMuchTimeShouldYouSpendonHelpers?.. 153 9.9 WhentoViewTest.................... 153 10 TestingJavaScriptandAjax 155 10.1 FirstOff,RJS ...................... 156 10.2 TestingJavaScriptfromRailswithJasmine..... 158 10.3 GettingStartedwithJasmine............. 158 10.4 RunningJasmineTests ................ 159 10.5 WritingJasmineTests ................. 161 10.6 IntegratingJasminewithDynamicRails....... 165 IV TestingFrameworkExtensions 168 11 WriteCleanerTestswithShouldaandContexts 169 11.1 Contexts......................... 170 11.2 BasicsofShoulda.................... 173 11.3 SingleAssertionTesting................ 173 11.4 ShouldaAssertions................... 175 11.5 ShouldaOne-Liners................... 176 11.6 WritingYourOwnShouldaMatcher ......... 179 11.7 Single-LineTestTools ................. 183 11.8 WhentoUseShoulda.................. 185 Reporterratum thiscopyis(P1.0printing,February2011) CONTENTS 10 12 RSpec 186 12.1 GettingStartedwithRSpec .............. 187 12.2 RSpecinTenMinutes ................. 189 12.3 RSpecandRails..................... 199 12.4 RunningRSpec ..................... 209 12.5 RSpecinPractice.................... 209 12.6 CreatingYourOwnMatchers............. 211 12.7 SummarizingRSpec................... 213 V TestingEverythingAllTogether 214 13 TestingWorkflowwithIntegrationTests 215 13.1 WhattoTestinanIntegrationTest.......... 216 13.2 What’sAvailableinanIntegrationTest?....... 216 13.3 SimulatingMultipartInteraction........... 218 13.4 SimulatingaMultiuserInteraction.......... 220 13.5 WhentoUseIntegrationTests............. 223 14 WriteBetterIntegrationTestswithWebratand Capybara 224 14.1 InstallingWebratandCapybara............ 225 14.2 UsingtheAcceptanceTestingRodents........ 226 14.3 ABriefExample..................... 229 14.4 WebratandAjax..................... 232 14.5 CapybaraandAjax................... 232 14.6 WhyUsetheRodents?................. 234 15 AcceptanceTestingwithCucumber 235 15.1 GettingStartedwithCucumber............ 235 15.2 WritingCucumberFeatures.............. 237 15.3 WritingCucumberStepDefinitions.......... 240 15.4 MakingStepDefinitionsPass............. 244 15.5 TheEditScenario:SpecifyingPaths ......... 246 15.6 LoginandSessionIssueswithCucumber...... 251 15.7 AnnotatingCucumberFeatureswithTags...... 252 15.8 Implicitvs.ExplicitCucumberTests......... 253 15.9 IsCucumberGoodforYou?.............. 255 Reporterratum thiscopyis(P1.0printing,February2011) CONTENTS 11 VI TestingYourTests 257 16 UsingRcovtoMeasureTestCoverage 258 16.1 85PercentofWhat?................... 259 16.2 InstallingRcov...................... 260 16.3 RcovandRails...................... 261 16.4 RcovOutput....................... 262 16.5 Command-LineRcov.................. 264 16.6 RcovandRSpecandCucumber............ 267 16.7 RcovTricks........................ 267 16.8 HowMuchCoverageIsEnough?........... 269 17 BeyondCoverage:WhatMakesGoodTests? 270 17.1 TheFiveHabitsofHighlySuccessfulTests..... 271 17.2 Troubleshooting..................... 278 17.3 FromGreenfieldtoLegacy............... 281 18 TestingaLegacyApplication 282 18.1 AcceptThatYou’rePowerlessintheFaceofa HigherPower....................... 283 18.2 BasicSetup ....................... 283 18.3 Test-DrivenExploration................ 285 18.4 DependencyRemoval.................. 288 18.5 Don’tLookBack..................... 297 19 PerformanceTestingandPerformanceImprovement 298 19.1 PerformanceandBenchmarkTesting ........ 299 19.2 FocusingTestExecution................ 306 19.3 UsingAutotest...................... 309 19.4 MakingYourTestsFaster ............... 313 19.5 UsingaFasterTestRunner.............. 316 19.6 AndintheEnd... .................... 320 A SampleApplicationSetup 321 A.1 BasicRails........................ 321 A.2 Devise........................... 322 A.3 Huddle’sDataModels.................. 323 A.4 FirstTests........................ 324 B Bibliography 326 Index 327
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索:
 输入关键字,在本站1000多万海量源码库中尽情搜索: