dottest培训手册dottest 9 training presenta.ppt_第1页
dottest培训手册dottest 9 training presenta.ppt_第2页
dottest培训手册dottest 9 training presenta.ppt_第3页
dottest培训手册dottest 9 training presenta.ppt_第4页
dottest培训手册dottest 9 training presenta.ppt_第5页
已阅读5页,还剩53页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、a,1,Parasoft .Test Training,Authors: ,a,2,Agenda,Introduction Static Analysis Workflow Unit testing Command Line mode,a,3,Training Setup,Install .Test Launch .Test Prepare Examples for Training Connect to License ServerGoto .TEST Preferences LicenseCheck “Use license server” checkboxInput hostname,

2、port 2002Click Test Connection Connect to Team ServerGoto .TEST Preferences Teamhostname, port 18888Test Connection,a,4,Components of .Test,Code Analysis Static Data Flow Analysis Metrics Unit Test Generation and Management Automated Test Generation Test Enchancement Tracer Code Review,a,5,User Inte

3、rface,a,6,Static analysis,Coding standards rules Bug detective rules Metrics and limits Suppressions Reassignments,a,7,Coding Standards,Common mistakes API design API usage Serialization Internationalization Security Web Application Best Practices C# Best Practices Resource Leaks and Memory Usage,a,

4、8,Exercise 1,Running coding standards analysis on the BankExample,a,9,Exercise 2,Viewing the .TEST results on the BankExample,a,10,Coding Standards,IL rules C# rules Text rules Understanding violations Fixing violations,a,11,Exercises 3 and 4,Exercise 3: Viewing rule descriptions Exercise 4: Running

5、 coding standards on a smaller set of files,a,12,Test Configurations,Built-in User Team Managing configurations Choosing rules Adjusting rules parameters,a,13,Exercise 5,Customizing Test Configurations,a,14,Suppressions,Team suppressions Suppressions View View In source code suppressions,a,15,Exerci

6、se 6, 7, 8,Exercise 6: Suppressing a violation Exercise 7: Un-suppressing a violation Exercise 8: Suppressing a violation in source code,a,16,Bug Detective Rules,Static flow analysis Avoid exceptions Prevent resource leaks Security,a,17,Exercise 9,Understanding BugDetective violations,a,18,Metrics,S

7、tatistics Metrics View Violations Rules Number of . Nested depth blocks Complexity and maintainability Many more! Adjusting Limits,a,19,Exercise 10,Running Metrics Configuration,a,20,Workflow,Reports Authoring Suppressions Reassignments,a,21,Scheduled Test Server,Developer Machines,Architect / Techn

8、ical lead,Team-wide Workflow,a,22,Exercise 11, 12,Exercise 11: Generating a report Exercise 12: Importing results from a Team Server,a,23,Unit Testing in .TEST,NUnit Tests Tasks Test Case Explorer Debugging Timeout Source Coverage Stubs Data Source,a,24,Running Unit Tests,VS .TEST,Test Executor,User

9、s tests,Users app,a,25,Exercise 11 - 12,Using Test Cases Explorer Running tests from the Explorer Refreshing Navigation Viewing Results Running chosen tests,a,26,Exercise 13,Running Tests from Solution Explorer Select proper resource(s) Start testing,a,27,Exercise 14,Interactive Object Factory Metho

10、d Generation Build the solution Open Unit Tests Genie View Load Assemblies Factory indicators: green, yellow, red, black. Select Constructors Set input values Limit Generation Generate Factory Methods,a,28,Exercise 15,Recording Assertions Open the solution Run Tests and Update Assertions Examine the

11、 test case for the assertions,a,29,Exercise 16,Interactive Test Generation Open the Unit Test Genie Reload all assemblies Expand the CreditCard class Expand the type, select GetCreditCardInfo() method Right click, select Generate tests for method Open inputs tab, control the inputs Select appropriat

12、e assertions Generate the tests Examine the generated tests,a,30,Exercise 17,Viewing Generated Unit Tests Expand the DotTest project branch Open CustomerCreditCard.cs Expand the CreditCard class Note each test case has a set of inputs and then a call to the method under test. Each test case has a re

13、gion named “Record State” If you expand this region, you will see calls to the dotTest API, which are used later to create assertions. Tests have custom attributes Test cases are in Nunit format for easy modification,a,31,Exercise 18,Recording Assertions Select the tests to run Use “Run Tests and Up

14、date Assertions” to create the assertions. Open the test cases and examine the recorded assertions Use “Run Tests and Check Assertions” to verify no failures Open “CreditCard.cs”. There is a bug in the implementation. return creditCardInfo.ToString(); Use “Run Tests and Check Assertions” to see how

15、the tests detect the change. Use “Run Tests and Update Assertions” to reflect the change.,a,32,Symbol Dependencies,Understanding symbol dependencies Parameters cause type dependencies Non-static methods cause object dependency,a,33,Exercise 19,Watching type dependencies Build the solution Open the U

16、nit Tests Genie view Reload all assemblies Observe the indicators, green, yellow, red, black Select TransactionBase and choose “Show Dependencies” Will need to create BankAccount factory first, then can create other object factories Its an iterative process. Some things will require manual intervent

17、ion, (OutcommingTransfer),a,34,Exercise 20,Non-interactive Object Factory Method Generation Build the solution Select Dottest.Example.BankExample Use “Generate Object Factory Methods” config Observe the test progress Build the solution again. Open the Unit Tests Genie Verify the new factories,a,35,E

18、xercise 21,Non-interactive Test Case Generation Build the solution Select Dottest.Example.BankExample Use “Generate Tests with Recording Calls” config Observe the test progress Use “Run Tests and Update Assertions” config,a,36,Exercises 23-25,Test Driven Development Write tests before writing code i

19、mplementations Test Templates Using PLACEHOLDERs Recording assertions in manually written tests Parasoft dotTest Add Recording Region,a,37,Exercise 22,Running tests as a regression suite Build the solution Select Dottest.Example.BankExample Use “Run Tests and Check Assertions” config Ideally, there

20、should be no violations. Open “BankAccount.cs” Modify GetDepositTotal() change the return “return sum + 2;” Re-run “Run Tests and Check Assertions” Verify Assertion failures,a,38,Exercise 26,Observing Coverage Information Selection Statistics Coverage View Coverage Markers,a,39,Exercise 26,Observing

21、 Coverage Information Selection Statistics Coverage View Coverage Markers,a,40,Application Hosted Tests,Application initialized before tests No extra modules initialization in tests Realistic tests Fast approach for high coverage,a,41,Application Hosted Tests,VS .TEST,Test Executor,Application,Tests

22、,Application Managed code,Stubs,a,42,Exercise 27,Running Application Hosted Tests,a,43,Exercise 28,Reviewing Options in the Execution Tab Timeout Calculate source coverage Debug tests Report exceptions Record state,a,44,Exercise 29,Debugging Tests Configuration Unit Tests Debug Generated Tests Break

23、points Call stacks Locals,a,45,Exercise 30,Running an Application with Coverage Measurement Creating a command file Running the application Preparing import configuration Importing coverage Reviewing coverage,a,46,Stubs,Determinism Tests isolation Preventing tests from locking Autogenerated tests sa

24、fety,a,47,Stubs,Caller,Foo,bar(),Caller,Foo,Foo stubs,bar(),a,48,Exercises 31, 32,Exercise 31: Reviewing Stubs that Ship with .TEST Exercise 32: Specifying the Stubs to Be Used During Tests Execution,a,49,Exercise 33,Using Stubs Wizard Methods Test Specific stubs vs Method Specific stubs Original ca

25、lls Simple Values,a,50,Exercise 34,Using Stubs Modifyingbehaviour of a method,a,51,Data Sources,One test, many inputs In-code data sources Simple integration with Data basesExceletc.,a,52,Exercise 35,Running a Test with Many Inputs,a,53,Exercise 36,Recording assertions via data sources,a,54,Command Lin

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论