Part I Introducing Visual Studio 2015 Part II An In-De pth Look at the IDE Part III Working with the Visual Studio Tools 10 Debugging Code 11 Deploying Code 12 Developing Applications
Trang 2About This eBook
ePUB is an open, industry-standard format for eBooks However, support of ePUB and its many features varies across reading devices and applications Use your device or app settings to customize the presentation to your liking Settings that you can customize often include font, font size, single or double column, landscape or portrait mode, and figures that you can click or tap to enlarge For additional information about the settings and features on your reading device or app, visit the device manufacturer ’s Web site
Many titles include programming code or configuration examples To
optimize the presentation of these elements, view the eBook in single-column, landscape mode and adjust the font size to the smallest setting In addition to presenting code and configurations in the reflowable text format, we have
included images of the code that mimic the presentation found in the print book; therefore, where the reflowable format may compromise the presentation of the code listing, you will see a “Click here to view code image” link Click the link to view the print-fidelity code image To return to the previous page
viewed, click the Back button on your device or app
Trang 3
Unleashed
Lars Powers Mike Snell
800 East 96th Street, Indianapolis, Indiana 46240 USA
Trang 4
Microsoft® Visual Studio® 2015 Unleashed
Copyright © 2016 by Pearson Education, Inc
All rights reserved No part of this book shall be reproduced, stored in a
retrieval system, or transmitted by any means, electronic, mechanical,
photocopying, recording, or otherwise, without written permission from the publisher No patent liability is assumed with respect to the use of the
information contained herein Although every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions Nor is any liability assumed for damages resulting from the use of the information contained herein
ISBN-13: 978-0-672-33736-9
ISBN-10: 0-672-33736-3
Library of Congress Control Number: 2015907636
Printed in the United States of America
First Printing August 2015
Trang 5
All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized Sams Publishing cannot attest to the accuracy of this information Use of a term in this book should not be
regarded as affecting the validity of any trademark or service mark
Warning and Disclaime r
Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied The information provided is on
an “as is” basis The authors and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages
arising from the information contained in this book or from the use of the CD or programs accompanying it
Spe cial Sale s
For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at
corpsales@pearsoned.com or (800) 382-3419
For government sales inquiries, please contact
governmentsales@pearsoned.com
For questions about sales outside the U.S., please contact
international@pearsoned.com
Trang 6Part I Introducing Visual Studio 2015
Part II An In-De pth Look at the IDE
Part III Working with the Visual Studio Tools
10 Debugging Code
11 Deploying Code
12 Developing Applications in the Cloud with Windows Azure
13 Working with Databases
Part IV Exte nding Visual Studio
Part V Building We b Applications
17 Building Modern Websites with ASP.NET 5
18 Using JavaScript and Client-Side Frameworks
19 Building and Consuming Services with Web API and WCF
Part VI Building Windows Clie nt Apps
Trang 7Part VII Cre ating Mobile Apps
23 Developing Windows Store Applications
24 Creating Windows Phone Applications
25 Writing Cross-Platform Mobile Applications with Apache Cordova Index
Trang 8
Table of Contents
Introduction
Part I Introducing Visual Studio 2015
1 A Quick Tour of Visual Studio 2015
The Many Faces of a NET Application Windows
Developing with MVC/Razor
Creating a Single Page Application (SPA) Coding Web Services with Web API
2 The Visual Studio IDE
Installing Visual Studio
Trang 9
Managing Your IDE Settings
Specify Stored and Synchronized Settings
Change Color Theme
Manually Import/Export and Change Default IDE Settings Switch IDE User
3 The NET Language s
ReadOnly
NameOf
Trang 10
Index Initializers (C# Only)
Creating and Raising Events
Language Features
Infer a Variable’s Data Type Based on Assignment
Create an Object and Initialize Its Values (Object Initializers) Define a Collection and Initialize Its Values
Creating an Instance of a Nonexistent Class
Add Methods to Existing Classes (Extension Methods)
Add Business Logic to Generated Code (Partial Methods) Access and Query Data Using the NET Languages
Removing Unused Arguments from Event Handlers (VB Only) Creating an Automatically Implemented Property
Dropping the Underscore in VB for Line Continuation
Summary
Part II An In-De pth Look at the IDE
4 Solutions and Proje cts
Creating a Project
Trang 11
5 Browse rs and Explore rs
6 Introducing the Editors and De signe rs
Creating and Editing XML Documents and Schema Inferring Schema
Trang 12
Developing Windows Client Applications
Creating a Windows Forms Project
Creating a Windows Presentation Foundation Project
Authoring WinForms Components and Controls
Creating a New Component or Control
Further Notes on Writing Component Code
Creating Classes with the Class Designer
Creating a Class Diagram
Adding Items to the Diagram
Defining Relationships Between Classes
Defining Methods, Properties, Fields, and Events Summary
Part III Working with the Visual Studio Tools
7 Working with Visual Studio’s Productivity Aids
Trang 13
Testing Web Applications
Unit Testing MVC and Web API Projects Unit Testing ASP.NET Pages
9 Re factoring Code
Visual Studio Refactoring Basics
Invoking the Refactoring Tools
Making (and Previewing) Changes
Using the Class Designer to Refactor Renaming Code
Accessing the Rename Operation
Working with the Rename Dialog Box
Trang 14The Many Phases of Debugging
Debugging the Application (Self-Checking) Debugging Basics Summary
The Visual Studio Debugger
The Debug Menu and Toolbar
Debug Options
Stepping In, Out, and Over Code
Indicating When to Break into Code
Working with Tracepoints (When Hit Option) Viewing Data in the Debugger
Using the Edit and Continue Feature
Advanced Debugging Scenarios
Remote Debugging
Debugging WCF Services
Debugging Multithreaded Applications
Debugging Parallel Applications
Debugging a Client-Side Script
Debugging Crash Information (Dump Files) Debugging Windows Store Apps
Summary
11 De ploying Code
Trang 15
An Overview of Client Deployment Options
Introducing ClickOnce Deployments
Introducing Windows Installer and InstallShield Deployments
Summary
12 De ve loping Applications in the Cloud with Windows Az ure
Create and Deploy an Azure Web Apps in Visual Studio
The Azure Hosting Platform
Create the ASP.NET Application and Azure Hosting
Deploy/Publish an Application to Azure
Set Up an Existing Application to Publish to an Azure web app Website Management with Azure Server Explorer
Debug an Azure web app
Trang 1613 Working with Database s
Creating Database Objects in Managed Code Creating a Stored Procedure in C#
Binding Controls to Data
An Introduction to Data Binding
Autogenerating Bound Windows Forms Controls Editing Typed Data Sets
Manually Binding Windows Forms Controls Data Binding in WPF Applications
Data Binding with Web Controls
Object Relational Mapping
An Overview of LINQ
Mapping Using the O/R Designer
LINQ Code
Working with the Entity Framework
Querying Against the Entity Data Model
Summary
Part IV Exte nding Visual Studio
14 Introducing the Automation Obje ct Mode l
An Overview of the Automation Object Model Object Model Versions
Automation Categories
Trang 17
The DTE/DTE2 Root Object
Solution and Project Objects
Controlling Projects in a Solution Accessing Code Within a Project Working with Windows
Referencing Windows
Interacting with Windows
Text Windows and Window Panes The Tool Window Types
Linked Windows
15 Exte nding the IDE
The Structure of an Extension
Defining and Reacting to Commands
A Sample Extension: Color Selector Getting Started
Creating the User Control
Finishing the Package
Summary
16 Exte nding the Code Editor
The Visual Studio Editor and MEF Editor Extension Points
Using the Visual Studio SDK
Trang 18
Part V Building We b Applications
17 Building Mode rn We bsite s with ASP.NET 5
ASP.NET Website Fundamentals
Introducing ASP.NET 5
The NET Core Framework and Execution Environment
Choosing an ASP.NET Project Template
Understanding the ASP.NET 5 Project Template and Related Files ASP.NET 5 Dependencies and Package Managers
Summary
18 Using JavaScript and Clie nt-Side Frame works
Trang 19
Developing with jQuery
jQuery and AJAX
Building Single-Page Applications (SPAs) with Client-Side JavaScript Frameworks
Selecting a Client Framework
Summary
19 Building and Consuming Se rvice s with We b API and WCF
Service Fundamentals
Summary
Part VI Building Windows Clie nt Apps
20 Building Windows Forms Applications
Trang 20
Introducing the WPF Designer
XAML and Design Panes
Building a Simple Image Viewer Application Starting the Layout
Storing the Images
Binding to the Images
Button Event Handlers and Image Effects
Path Selection with a Common Dialog Box Summary
22 De ve loping Office Busine ss Applications
Trang 21
Visual Studio Office Project Types
Part VII Cre ating Mobile Apps
23 De ve loping Windows Store Applications
Trang 22Fundamentals of Cordova Development
How Cordova Works
Cordova Dependencies
The Cordova Project Template
Creating a Basic Cordova App
Running and Debugging Your App
Using Cordova Frameworks and Plug-Ins
Choosing Cordova Client Frameworks
Cordova Plug-Ins (for Accessing Native Device Capabilities) Developing a Cordova App with Ionic and Angular
Set Up Your Project
Anatomy of the Ionic-Angular-Cordova App
Rebuild the Sample App
Support Storage
Running on Windows Phone
Additional Items to Consider
Summary
Inde x
Trang 23About the Authors
Mike Sne ll spends his work life helping teams build great software that
exceeds the expectations of end users He runs the Solutions division at CEI (www.ceiamerica.com) Mike and his team deliver architecture, consulting, and mentoring to clients looking for help with enterprise projects, commercial software, mobile applications, or cloud-based solutions He is also a
Microsoft Regional director
Lars Powe rs is currently the director of application development at
Newgistics, Inc Prior to Newgistics, he held various technical management positions at 3M and spent many years with Microsoft as a platform evangelist focused on emerging technologies
Trang 25developer-architects at CEI for acting as a sounding board for so many topics
Of course, I’m also grateful to my co-author, Lars Powers, for the many years
of collaboration
Lars Powe rs:
Nothing of consequence is delivered without team work This book is no
exception I’d like to acknowledge the Pearson team who did all the hard work
to get this book into your hands Joan Murray alternately cajoled, supported, and pushed us along Mark Renfro and Elaine Wiley stitched all the pieces together for us And Christophe Nasarre-Soulier ensured we stayed on the mark for technical accuracy
And to my co-author, Mike: as always, projects are easier with you on board
Trang 26
We Want to Hear from You!
As the reader of this book, you are our most important critic and commentator
We value your opinion and want to know what we’re doing right, what we could do better, what areas you’d like to see us publish in, and any other words
of wisdom you’re willing to pass our way
We welcome your comments You can email or write to let us know what you did or didn’t like about this book—as well as what we can do to make our books better
Please note that we cannot help you with technical problems related to the topic of this book
When you write, please be sure to include this book’s title and author as well
as your name and email address We will carefully review your comments and share them with the author and editors who worked on the book
Email: consumer@samspublishing.com
Mail: Sams Publishing
ATTN: Reader Feedback
800 East 96th Street
Indianapolis, IN 46240 USA
Trang 28
Introduction
Visual Studio 2015 is Microsoft’s first, big release since moving to a more open-source approach for NET and related technologies This includes the new Roslyn compiler for C# and Visual Basic, the NET Core Framework, ASP.NET itself, and more The result is enabling a wider reach for NET
applications, including both building and deploying on Mac, Linux, and
Windows
Microsoft has also worked to integrate Visual Studio with community-driven, open source JavaScript frameworks, package managers, and UI kits The
ASP.NET 5 model simplifies modern web development using frameworks such
as Bootstrap, AngularJS, Knockout, Gulp, and many more
Visual Studio 2015 supports the new, Universal App model for building on Windows These applications can be written once and adapted to desktop, tablet, and phone This includes upcoming support for Windows 10
development
Cross-platform mobile development is also supported Microsoft has provided project templates for the open-source Apache Cordova This enables
developers to build a mobile application that runs on iOS, Android, and
Windows Phone using familiar web technologies of Hypertext Markup
Language (HTML), Cascading Style Sheets (CSS), and JavaScript
This latest version of Visual Studio unlocks productivity across platforms and application types And this book is meant to help you unlock the power behind Visual Studio so that you can realize productivity gains and greater reach for your applications
Who Should Read This Book?
Developers looking to use Visual Studio (Community, Professional, or
Enterprise) to build great apps for users will want to read this book Of
course, established NET developers who rely on Visual Studio to get work done will also want to read this book to ensure they are getting the most out of their chosen toolset This book covers both using the IDE and building most of the many types of applications Visual Studio supports It covers all of the
following key topics:
Writing code using Visual Basic and C#
Understanding the basics of solutions, projects, editors, and designers Writing IDE extensions and add-ins
Writing unit tests to verify your code works as designed
Debugging code with the IDE
Refactoring your code
Building websites using the new ASP.NET 5 (and MVC 6) model, which includes support for Bower client-side package management and the new NET Core 5 for running ASP.NET applications on Windows, Mac, and Linux
Using JavaScript and the many client-side frameworks such as Knockout, AngularJS, and Bootstrap to create great web experiences
Trang 29
Developing service-based solutions for web and mobile clients using ASP.NET Web API and Windows Communication Foundation (WCF) Creating Windows desktop and Store applications using Windows
Presentation Foundation (WPF)
Working with data and databases and leveraging LINQ and Entity
Framework to build data-centric applications
Using Microsoft Office and Visual Studio to create enterprise solutions based on common office tools (Word, Excel, and so on)
Creating Windows Azure applications that live in the cloud
Developing applications for Windows Phone
Building cross-platform mobile applications that run on iOS, Android, and Windows Phone using Apache Cordova and related tools
This book has one primary focus: detailing and explaining the intricacies of the Visual Studio 2015 IDE to enable developers to be work faster and, ultimately, work smarter Although we do provide a language primer, those just starting out with Visual Basic or C# may want a companion book that focuses solely on their language of choice If you can write C# or Visual Basic code, this book will radically help you optimize your productivity with Visual Studio
This book focuses primarily on Visual Studio 2015 Professional edition
(which also covers the Community edition) There are additional features in Visual Studio Enterprise However, those are mostly not covered by this book Instead, we dedicate space to the version of the product used by the majority of NET developers all over the world
How Is This Book Organized?
You can read this book cover to cover, or you can pick the chapters that apply most to your current need We sometimes reference content across chapters, but for the most part, each chapter can stand by itself This organization allows you
to jump around and read as time (and interest) permits There are seven parts
to the book; each part is described next
Part I: Introducing Visual Studio 2015
The chapters in this part provide an overview of what to expect from Visual Studio 2015 This includes a tour of using the IDE to build various types of applications In addition, we cover the new C# and Visual Basic language enhancement for the 2016 and the NET Framework 4.6 Finally, we conclude this part with a language primer for those just getting started with NET
development Readers who are familiar with prior versions of Visual Studio will want to review these chapters for the new additions in 2015
Part II: An In-Depth Look at the IDE
This part covers the core development experience relative to Visual Studio It provides developers with a base understanding of the rich features of their primary tool The chapters walk through the many menus and windows that define each tool We cover the base concepts of projects and solutions, and we explore in detail the explorers, editors, and designers
Trang 30Part III: Working with the Visual Studio Tools
Part III is the largest section of the book; it unlocks many of the powerful
productivity features of Visual Studio 2015 These chapters investigate the developer productivity aids that are present in the IDE and discuss how to best use Visual Studio for testing, refactoring, debugging, and deploying your code This part also covers building applications in Azure The section concludes with a chapter dedicated to using Visual Studio to work with databases
Part IV: Extending Visual Studio
For those developers interested in customizing, automating, or extending the Visual Studio IDE, these chapters are for you We explain the automation
model and then document how to use that application programming interface (API) to automate the IDE through macros We also cover how you can extend the IDE’s capabilities by writing your own add-ins
Part V: Building Web Applications
Part V is for web developers We cover building applications with the new ASP.NET 5 (and MVC 6) model This section also covers JavaScript and related client-side frameworks for building responsive, highly interactive client-side solutions The section concludes with coverage on writing and consuming services using Web API and Windows Communication Foundation (WCF)
Part VI: Building Windows Client Apps
This section is targeted at developers looking to build applications for
Windows This includes the class Windows Forms We also cover the
powerful WPF and building Universal Application Finally, this part includes
a chapter dedicated to building custom solutions on Microsoft Office
Part VII: Creating Mobile Apps
Here we cover creating mobile application for Windows Store, Windows Phone, and cross-platform (iOS, Android, and Windows Phone) This part is targeted at the mobile developer looking to either build on Windows or use the hybrid mobile technology, Apache Cordova
Conventions Used in This Book
The following typographic conventions are used in this book:
Code lines, commands, statements, variables, and text you see onscreen
appears in a monospace typeface
Placeholders in syntax descriptions appear in an italic monospace
typeface You replace the placeholder with the actual filename, parameter, or whatever element it represents
Italics highlight technical terms when they’re being defined
A code-continuation icon is used before a line of code that is really a
continuation of the preceding line Sometimes a line of code is too long to fit as
a single line on the page If you see before a line of code, remember that it’s part of the line immediately above it
Trang 31The book also contains Notes, Tips, and Cautions to help you spot important or useful information more quickly
Source Code
You can download all the source code associated with this book from the
book’s website: www.informit.com/title/9780672337369
Trang 32
Part I: Introducing Visual Studio
2015
Trang 33The Visual Studio Product Line
Languages and Frameworks
The Many Faces of a NET Application
Developing Windows 8/10 Clients
Creating Web Applications with ASP.NET 5
Coding for Azure
Working with Data
Writing Mobile Apps
Visual Studio 2015 and the latest version of the NET Framework introduce new features that address modern, mobile-first/cloud-first development
concerns such as cross-platform development, adoption of open standards, and transparency through open source This latest version also continues to
improve on existing developer experiences when writing code for the web, Windows, Office, database, and mobile applications The 2015 product allows developers to really increase their range when building modern applications that users demand Some highlights for the 2015 release include the following:
Developer productivity enhancements in the code editor, including touch support
Cross-platform mobile development for Windows, iOS, and Android Modern, unified web development with ASP.NET 5
Cloud-ready integration to ease development and deployment
Integration of the new, open source “Roslyn” compiler for VB, C#, and now TypeScript
Easier, faster data development across web, Windows, Windows Phone, and Windows Store using Entity Framework 7
Shared projects for C# and JavaScript to make sharing code between applications easier
Redesigned version of Blend for creating beautiful user interfaces (UIs) with XAML
Enhanced IDE support for building JavaScript solutions with oriented TypeScript language (a superset of JavaScript itself)
object-Open source of many NET elements including the compiler, the NET Core, TypeScript, ASP.NET, and more
This chapter covers the core makeup and capabilities of Visual Studio 2015
We first help you sort through the product choices available to NET
developers We then compare the NET programming languages The remaining sections of the chapter cover the many possibilities open to NET
programmers, including building web, Windows, cloud, data, and mobile
applications Our hope is to give you enough information in this chapter to get
Trang 34Part I, “Introducing Visual Studio 2015,” is broken into three
chapters This chapter provides a snapshot of all things Visual
Studio Chapter 2, “The Visual Studio IDE,” is an introduction to
getting the tool installed, running it, and creating a first project It
also familiarizes you with the basics of the IDE Chapter 3, “The
.NET Languages,” is a quick primer on coding constructs in
Visual Basic and C# It also covers general programming against
the NET Framework
The Visual Studio Product Line
There are three primary editions of the Visual Studio product: Community, Professional with MSDN, and Enterprise with MSDN Development teams need to understand which tool they need for their development projects and price point At a high level, the primary tool editions are differentiated as follows
Visual Studio Community—A free, full-featured version of the
development tool for building Web, Windows, Desktop, and mobile applications This new version of the tool is targeted at developers learning to code, doing open source projects, and taking academic
courses
Profe ssional with MSDN—Includes the core features of the IDE to
build applications of all types on all NET languages Targets
professional developers and team looking to build commercial or
enterprise software Includes support for writing, debugging, and testing code
Ente rprise with MSDN—Formerly the Ultimate edition, the Enterprise
edition includes the core IDE features along with many advanced tools for building applications It builds on the Professional edition to add additional load testing support, architecture tools, lab management, release management, and more
Note
You can see a detailed product comparison at
https://www.visualstudio.com/products/compare-visual-studio-2015-products-vs
There is a peripheral version of the Visual Studio product called Test
Professional It is a tool targeted directly at testers You will learn more about all this product in the coming sections
Trang 35
Visual Studio Code
Microsoft released another development tool alongside Visual
Studio 2015 This tool is called Visual Studio Code It is a free
tool that allows developers to write web applications on
Windows, Mac, and Linux The NET Framework went
cross-platform; this is the tool that allows developers to work on these
other platforms You can find more information at
https://code.visualstudio.com//
Community Edition
The new Visual Studio Community 2015 edition is a full-featured IDE similar
to Professional but targeted toward students, small groups of developers, and open source contributors (and not enterprise teams) This version is free and available for immediate download Note that Microsoft has also release a Visual Studio Community 2013 edition
The former Express editions have been retired These editions were also free, but they were feature limited Community, student, and entrepreneurial
developers should be pleased to know this new edition is nearly the same as Professional but just has licensing restrictions
Being based on Professional opens community developers to all types of
applications using the great productivity tools built in Visual Studio Just as significant, it ensures the Community Edition supports Visual Studio plug-ins (more than 5,000 in existence) for using community extensions targeted at increasing productivity It also allows developers to target multiple different platforms with this single tool
The primary difference between the editions Community and Professional (outside of licensing and costs) are a few project types Microsoft has decided not to include with the Community Edition These project types are targeted squarely at enterprise developers They include SharePoint, Office,
LightSwitch, and Cloud Business Apps These type of solutions are outside the bounds of the solutions Microsoft sees students, hobbyists, and small groups needing to create
Note
For more information about the Visual Studio Community Edition
(including licensing restrictions) or to download, you can visit the
Microsoft site:
https://www.visualstudio.com/products/visual-studio-community-vs
Trang 36
Unit testing and test-driven development
Code analysis and code metrics
Developing all application types, including Windows, web, mobile, Office, SharePoint, Cloud, SQL, and more
CodeLens to provide quick, detailed information including references, linked items such as bugs, and changes on your code right in the IDE Performance and diagnostics hub
Blend tool for building XAML UIs
Server Explorer
Refactoring in C# and Visual Basic
SQL Server Data Tools (SSDT) for database development
Code review tools (when working with Team Foundation Server, or TFS)
Much more
Note
This book targets Visual Studio Professional only A quick
perusal of the book will allow you to see the depth and breadth of
what you can do with this powerful edition of the tool
Enterprise
Visual Studio Enterprise 2015 is targeted toward professional developers who build both corporate and commercial applications It includes all the features inside Professional plus tools that help developers verify, test, and check their code against common issues It also includes debugging tools designed to
eliminate the “can’t reproduce” bugs It provides architecture tools for creating UML models and exploring code visually This version of the product is the everything-but-the-kitchen-sink option in a single package The following list highlights the features of Enterprise:
Advanced performance and code profiling
Code Clone tool for finding and eliminate duplicate code
Unit test code coverage analysis and fakes
Coded UI testing
Test case management and exploratory testing
Test lab management tools
Trang 37
Historical debugging with IntelliTrace (including in production)
Unified Modeling Language (UML) support for use case, class,
sequence, component, and activity diagrams (including generating
sequence diagrams from code)
Architecture Explorer, for coming up to speed on and examining the structure of a code base
Web, load, and performance testing
developer access to nearly all Microsoft software and operating systems
including SharePoint, Exchange, Office, Dynamics, BizTalk, and more
Professional with MSDN, however, only provides access to TFS, Windows Server, and SQL Server
MSDN subscribers also have training benefits, access to deployment planning services, and monthly credits to allow Azure application hosting ($50 / month Azure credit for Professional subscribers and $150 / month for Enterprise) In addition, there is a new e-learning benefit for MSDN subscribers that includes access to a number of great learning solutions and instructional videos
Note
The MSDN benefit is vast, check out the following link for full
details:
https://www.visualstudio.com/products/visual-studio-with-msdn-overview-vs
TFS and Related Tools
A key component of most professional development teams includes the
application lifecycle management environment, TFS This tool allows teams to manage and track work It provides the hub for collaboration between
developers, project managers, testers, and those providing feedback This section includes a brief overview of TFS and the related products: Team
Explorer and Visual Studio Test Professional (also known as Microsoft Test Manager)
TF S
Application Lifecycle Management (ALM) is a broad term applied to the
concept of continuous delivery of software through a set of integrated tools and processes Microsoft uses this term often to refer to its collective group of developer tools This collection includes Visual Studio editions, TFS, Test Professional, and related ancillary tools TFS is the central hub that provides the integrated ALM experience around the various tools and their associated disciplines
Trang 38Visual Studio Online (VSO)
TFS comes in two versions: on-premises-hosted TFS and the
online-only version called Visual Studio Online (VSO) MSDN
subscribers have access to both
The versions are similar, and Microsoft is working to make them
nearly the same However, at the time of writing this, VSO has
fewer features than TFS; these missing features include the
following: SharePoint integration, process template and work
item customization, data warehouse, and related reporting This
latter item is the most notable missing element
Of course, there are advantages to VSO First, it is online and
therefore more easily accessible and lower overall maintenance
Second, it automatically updates versions, patches, and service
packs It also supports cloud load testing and a few other
10 years Microsoft continues to build upon this with the release of TFS 2015 TFS is at the center of development and ALM coordination The following list highlights the many services provided by TFS:
Proce ss guidance /te mplate —TFS includes three process templates out
of the box: Microsoft Solutions Framework (MSF) for CMMI Process Improvements, MSF for Agile Software Development, and Microsoft Visual Studio Scrum All provide a set of work items, workflows, and reports that are uniquely crafted with regard to their specific
methodology They also offer guidance to the team for executing key activities on the project (such as requirements management or build
automation)
Proje ct manage me nt—TFS enables project managers to define their
projects in terms of iterations and functional areas It provides work items that are used to define, assign, and track work on the project A work item can be a task on the project, a requirement, a bug, a test
scenario, and so on In general, a work item represents a generic unit of work on the project Of course, work items are customizable and can have states, new fields, and business rules associated with them TFS also includes a task board for easily viewing, working with, and tracking items in a collaborative way Work items play a central part in ensuring project team communication and reporting Project managers can use the TFS website along with the Excel and Project add-ins to Office to
manage the work items on a project
Re quire me nts manage me nt—TFS provides specific work items for
Trang 39
Te st case manage me nt—TFS and Test Professional enable work items
specific to test planning and test case management You can define a set
of test cases for a given requirement Each test case can define the steps required to execute the test case along with the expected results
Ve rsion control—The source control features in TFS include
enterprise-class features such as change sets, shelving, automatic build rules, the capability to associate work items to changed source, parallel
development, a source control policy engine, branching, checkpoints, and more There are powerful tools included for visualizing branch and
changeset relationships
Build automation—The TFS build tools allow for automatic, scheduled,
and on-demand builds Builds are reported against, documented,
automatically tested, and analyzed for code coverage and churn (as an example) The build engine is written using Windows Workflow
Foundation (WWF) TFS provides a build template you can use as the basis for creating custom build processes
Re le ase manage me nt—TFS includes the Release Management tool for
managing software releases from your environments such as
development to test to staging to production This tool allow you to track
a release and assign approvers for various stages of that release
Re porting—TFS provides a rich set of reports for tracking statistics and
the overall health of your project Reports include those built on SQL Reporting Services (that are accessible from the IDE, the Web, and
SharePoint) as well as a new set of Excel reports for working directly with the data
Collaboration—TFS includes Web Portal for teams collaborating on
iterations, requirements, and the related project task This consists of a project home page for quick health check, a team room for discussions, and task boards for updating status Web Portal also provides web-based access to source code, builds, and tests
Inte gration with othe r IDEs—TFS is accessible from Visual Studio,
Office, SharePoint, and the Web In addition, there is Team Explorer Everywhere for accessing the TFS features using other IDEs running on operating systems outside Windows This includes the Eclipse IDE and the Mac Xcode IDE
Trang 40
Test P rofessional (or Test Manager)
Visual Studio Test Professional 2015 provides test planning, test case
management, and manual testing for those people dedicated to the testing role This is a separate tool that should seem comfortable and familiar to testers Test plans are created based on application requirements (to provide
traceability) Test cases are created and tracked as work items
When testers run a test plan, they work through each test case and each step in the test case They indicate the success or failure of the given test For failures, they can log bugs (also work items) The bugs can automatically include things such as diagnostic trace information, event log data, network information, and even video recording of the steps the tester was executing when the bug was found
Test Professional also enables testers to create action recordings of their steps These recordings can be played back to execute the same steps again This helps automate many portions of manual tests
In addition, Test Professional includes lab management, which is a suite of tools for provisioning test environments from a template These environments are virtual machines that are meant to be set up and torn down as needed for testing You also can create checkpoint environments for various builds
Test Professional enables automated web, load, and stress tests You can run these automated tests directly from Visual Studio on your local machine to simulate smaller user loads However, if you want to collect data on multiple machines and test against a higher user load, you can leverage a test controller along with test agents The test controller serves as the central data collector and manages the test agents Test agents are then installed on both the servers under test and multiple client computers This allows the servers under test to send back important data such as IntelliTrace information The multiple client agents are used to simulate increased load and collect data from the client perspective Finally, the centralized controller aggregates the resulting data for reporting
Languages and Frameworks
Programming in Visual Studio and with the NET Framework means you have a variety of languages from which to choose Coding against the framework means selecting from C#, Visual Basic NET (VB.NET), F#, or C++ The
Framework itself is common to all three Once compiled and deployed,
applications written against NET are similar in runtime execution In fact, the new, open source NET Compiler Platform (“Roslyn”) is now the shared
compiler for both VB and C#