Tech fuse11 toolingtestingci-vs2010teamcity

36
March 17, 2011 – Developer Track 1 Baskin I. Tapkan Advanced Technology Software Group Imation Corp. @baskint http://tapkan.blogspot.com/ [email protected]

Transcript of Tech fuse11 toolingtestingci-vs2010teamcity

March 17, 2011 – Developer Track

1

Baskin I. Tapkan Advanced Technology Software Group Imation Corp.

@baskint

http://tapkan.blogspot.com/

[email protected]

March 17, 2011 – Developer Track

2

Developer - Consultant - Architect BS & MS degrees in Electrical Engineering, IEEE member, MS-Certified

March 17, 2011 – Developer Track

3

March 17, 2011 – Developer Track

4

Board Sports

March 17, 2011 – Developer Track

5

Should have bought a snow blower

March 17, 2011 – Developer Track

6

1. Reasons behind testing and why you should care

2. Development and testing with VS-2010

3. Something-Driven styles and contrasts

4. Types of testing

5. Coded UI testing – demo

6. Database Unit testing - demo

7. Continuous Integration Practices

8. Unit test & TeamCity - demo

9. Conclusion & References

March 17, 2011 – Developer Track

7

Bugs are expensive – over $59 billion/year

On average, 100 errors per 1,000 lines of code

Cancelled and over-ran projects combined cost around $88 billion in 2009

A few examples…

March 17, 2011 – Developer Track

8

Code Re-use Conversion from 64-bit to 16-bit signed int caused overflow, exception handling was disabled for some other reason – COST > $370 million (‘96 dollars)

March 17, 2011 – Developer Track

9

Crossed international dateline the first time on the way to Japan, computers crashed losing all navigation and communication systems. Luckily with clear weather, it followed tankers back to Hawaii

March 17, 2011 – Developer Track

10

Failed to wake up users during Daylight Savings Time change

March 17, 2011 – Developer Track

11

Testing is no longer just about keeping defects from the users; instead it is about helping the team understand the

features users need and deliver them reliably and predictably

Writing tests first help write better code

Process of writing a test first helps to see when a design is too rigid or unfocused

March 17, 2011 – Developer Track

12

Repeated cycles of activity Each cycle adds new features and team gets feedback

Each cycle deploys work to some kind of environment

Every deploy, team has an opportunity to check the assumptions against reality

Without deployment, the feedback is not complete

March 17, 2011 – Developer Track

13

RequirementsFeature codingPair programmingStand-upsUnit testingDeploymentIntegration testingReleases

March 17, 2011 – Developer Track

14

Incremental development builds a system feature,

instead of building layers and components and integrating

them at the end.

Each feature is implemented as an end-to-end “slice”.

System is always integrated and ready for deployment

Iterative development progressively refines the

implementation of features in response to feedback

until they are good enough.

In other words, reacting to the “anticipating to the

unanticipated”

March 17, 2011 – Developer Track

15

Development

Test

Release

March 17, 2011 – Developer Track

16

Development

Test

Release

Pushing quality upstream

March 17, 2011 – Developer Track

18

The catch is that few developers enjoy testing their code. Many see writing automated tests is seen as not “real” work

compared to adding features. They find it boring. It takes a different mind set and takes time to learn and master.

TDD makes coding a design activity. Use tests to clarify ideas about what the code should do.

Having tests during development process can build up a safety net of automated regression tests.

These tests give confidence to make changes. All of a sudden, you are doing “Red – Green – Refactor”

“… you have nothing to lose but your bugs”

March 17, 2011 – Developer Track

19

Evolution of TDD Test method names should be sentences

Writing tests that matter “Given, When, Then”

Concept of executable specifications

March 17, 2011 – Developer Track

20

MSDN Article: http://msdn.microsoft.com/en-us/magazine/gg490346.aspx

Start feature with an acceptance test

Develop from the inputs & outputs

March 17, 2011 – Developer Track

21

Unit / Integration / Acceptance Tests

Database Unit Test

Coded UI Tests

Web Performance and Load Tests

March 17, 2011 – Developer Track

22

TailSpin project lab

http://blogs.msdn.com/b/briankel/archive/2010/06/25/now-available-visual-studio-2010-rtm-virtual-machine-with-sample-data-and-hands-on-labs.aspx

March 17, 2011 – Developer Track

23

SP1 is available Help viewer updates

Silverlight 4 support

Unit testing for .NET 3.5

IIS Express support

SQL Server CE Support

Razor support

Feature Pack 2 Code visualization and modeling

Improved Coded UI Testing

“Pimp my IDE” check out http://studiostyl.es

March 17, 2011 – Developer Track

24

SQL Server 2008

http://blogs.msdn.com/b/atverma/archive/2010/07/28/how-to-unit-test-sql-server-2008-database-using-visual-studio-2010.aspx

March 17, 2011 – Developer Track

25

A unit test is a piece

of code that invokes another piece of code,

resides in another assembly

SUT : System Under Test (CUT : Code under Test)

: Class under Test)

Is Automated and repeatable

Is Easy to implement

Should remain for future use

Is run by anyone

Should run with a push of a button

Runs quickly

March 17, 2011 – Developer Track

26

Real Life Example

March 17, 2011 – Developer Track

27

Architecture

•Architecture Explorer

•Layer Diagram

•Use case designer

•Activity designer

•Component diagram

•Logical class designer

•Sequence diagram

•Modeling project system

•UML Model Explorer

•Architecture validation during build

Development & Database

•Historical debugging

•Test impact analysis

•Improved code analysis

•Improved profiling (incl. multi-tier)

•Database extensibility

Lab Management

•Multi-tier environment creation and management

•Automated deployment

•Easily manage machine pools

•Network fencing

•Checkpoints

Test

•Test planning

•Test case management

•Test prioritization

•Run management & reporting

•Project quality reports

•Manual test execution

•Diagnostic recording (environment, video, etc.)

•UI Automation recording

•Coded UI tests

TFS

•Work item hierarchy & link types

•Improved Agile template

•MOSS & WSS dashboards

•Simplified reporting

•Improved support for parallel development

•Rollback

•Build queuing and pooling

•Gated check-in

•Simplified setup

•Scale out of web and data tiers

•Admin console

•Project move/archive/restore

March 17, 2011 – Developer Track

28

Maintain a Single Source Repository

http://martinfowler.com/articles/continuousIntegration.html

Automate the Build

Make Your Build Self-Testing

Keep the Build Fast

Everyone can see what's happening

Automate Deployment

March 17, 2011 – Developer Track

29

March 17, 2011 – Developer Track

30

March 17, 2011 – Developer Track

31

March 17, 2011 – Developer Track

32

March 17, 2011 – Developer Track

33

March 17, 2011 – Developer Track

34

Goal is to ship to “less” buggy, rigid software. TDD and BDD will help.

Just keep an open mind!

Continuous Integration is more than “nice to have” any more. If you are serious about what

you are doing, you should have it.

VS-2010 has many other features on various testing mechanisms. Take the time to learn and master them.

Don’t hesitate looking at other platforms for ideas.

March 17, 2011 – Developer Track

35

March 17, 2011 – Developer Track

36

Speaker Rate: http://speakerrate.com/talks/5834-tooling-testing-and-continuous-integration-using-vs-2010-and-teamcity