48
Agile Tools Allan Spartacus Mangune

Agile Tools

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Agile Tools

Agile ToolsAllan Spartacus Mangune

Page 2: Agile Tools

Delivery

• Lectures and demos – 3 hours

• 3 case studies and hands-on exercises – 1 hour each

Page 3: Agile Tools

Agenda

Test-driven Development & Unit Testing

Version Control & Continuous Integration Testing

Web Performance & Load Testing

Page 4: Agile Tools

Test-driven Development

Similar to test-first

practice in Extreme

Programming

Designed for

product

development with

short iterations

Write failing test

code for desired

functionality

Write code to past

the test

Refactor code to

desired coding

standard

Page 5: Agile Tools

Development Cycle

Write a test

Run all tests

Write some

codeRun test

Refactor

Repeat

Page 6: Agile Tools

Write A Test

Write a failing unit test for each new

functionality

• The test must cover the requirements and how

exceptions are handled in the software product

Developer must have a correct

understanding of the functionality

• Refer to use case, domain models and details of the user

story

Write a test

Run all tests

Write some

codeRun test

Refactor

Repeat

Page 7: Agile Tools

Run All Tests

Ensures that the test harness is working

and the new unit test actually fails

• Pending the writing of correct program code

Write a test

Run all tests

Write some

codeRun test

Refactor

Repeat

Page 8: Agile Tools

Write Some Code

Based on the new functionality to be

developed, write the program code

The objective is to code enough to pass the

unit test

• Any duplicate code at this point must be refactored later

Write a test

Run all tests

Write some

codeRun test

Refactor

Repeat

Page 9: Agile Tools

Run Test

Run the test to verify that the written code passes

the test unit test

• If the test fails, review the code against specific requirements

and test cases and make the necessary modification

• Re-run the test

Write a test

Run all tests

Write some

codeRun test

Refactor

Repeat

Page 10: Agile Tools

Refactor

When the code is passing the test, refactor to the

desired standard

• Code follows coding standard

• No duplicate code

• Make design changes to improve the overall maintainability

of the system

Rerun all the tests after refactoring

• To ensure that all tests are passing

Write a test

Run all tests

Write some

codeRun test

Refactor

Repeat

Page 11: Agile Tools

Repeat

Repeat the cycle.

• Write a new unit test for a new functionality

Each cycle should be very short

• Few code edits and less that an hour

• A long cycle may prompt the developer to resort to

debugging

Write a test

Run all tests

Write some

codeRun test

Refactor

Repeat

Page 12: Agile Tools

Test Structure

Arrange

• Setup and initialize the desired state prior to testing

Act

• Execute the test against the method being tested

Assert

• Determines the outcome of the test

[TestClass]public class HomeControllerTest{

[TestMethod]public void Index(){

// ArrangeHomeController controller = new

HomeController();

// ActViewResult result = controller.Index() as

ViewResult;

// AssertAssert.IsNotNull(result);

}….

}

Page 13: Agile Tools

Fakes and Mocks

Isolate code

• Controls what is failing and where it is happening

Replaces other parts of the system with stubs and shims

• Stub - A class replacement with the same interface

• Shim – Used to replace the actual method call with the fake ones

Page 14: Agile Tools

Visual Studio Unit Test Explorer

Page 15: Agile Tools

Unit Test Explorer

Create and run a unit test

Isolating Code Under Test with Microsoft Fakes

Page 16: Agile Tools

Create and Run Unit Test (1)

Create a test

project

Create a test

class

Create a test

method against a

functionality

Run test

Page 17: Agile Tools

Create and Run Unit Test (2)

Create a test

project

Create a test

class

Create a test

method against a

functionality

Run test

Page 18: Agile Tools

Arrange, Act, Assert

Arrange

• Define the test input

Act

• Run the method under test

Assert

• Verify the result

Page 19: Agile Tools

Demo: Visual Studio Unit Test Explorer

Page 20: Agile Tools

Case Study & Hands-on Exercises

Page 21: Agile Tools

Version Control

Management of changes to source files

Each change is marked with change set or revision number

• A revision is made to one or more source files

A change set is usually accompanied by a unique ID, timestamp, and the name of the person who

committed the revision

Changes to one or more source files can be reverted to specific version

Page 22: Agile Tools

Continuous Integration Testing

Continuous integration is a process wherein the development team continuously integrate their source files to a version control system

• Allows the team to work on the latest version of the software

• Delays due to late integration are avoided

Use an automated build system to continuously run automated integration tests

• Breaking changes are uncovered and fixed

• Rules can be implemented to prevent source files that break the build from committed to the version control system

Source FilesVersion Control Server

Automated Build Server

Build is broken

Page 23: Agile Tools

Team Foundation Server Version Control

Page 24: Agile Tools

Team Foundation Server Version Control (TFSVC)

Manage multiple revisions to source files

• Check-ins

• Branching and merging

• Shelving

Contributor

• Check out files

• Check in modified or new files

• Delete source files

• Compare source files

• Merge changes between files

Page 25: Agile Tools

How to Use TFSVC?

Set up development workspace

Create the version control of your app’s solution files

Create a new solution under version control

Put an existing solution to the version control

Contribute source files

Isolate risks by branching from trunk

Resolve version control conflicts

Page 26: Agile Tools

Set up Development Workspace

Access the Team Explorer in

Visual Studio

• Connect to a Team’s project

Map the team’s project to a

local folder

• Developer’s PC

Map the workspace to get

the project’s source files

Page 27: Agile Tools

Create the Version Control

Access the Source Control Explorer and

create the main trunkCheck in files to the main trunk

Page 28: Agile Tools

Create a New Solution Under Version Control

Create a new project Add the project to a version control

Page 29: Agile Tools

Put an Existing Solution to the Version Control

Open your solutionAccess the solution’s property page

and add the solution to TFSVC

Page 30: Agile Tools

Contribute source files (changes)

Access the pending

changes in solution or

project

Relate change set to one

or more work items

Check in the pending

changes. Adding

comment helps

Page 31: Agile Tools

Branching

Manage simultaneous work of different teams

from the same code base

Merge changes from a branch to the main

trunk

Page 32: Agile Tools

Resolve Version Control Conflicts

Conflicts are highlighted

when checking in pending

changes

Access the Resolve Conflicts

link

Resolve conflicts by keeping

local version, server version

or merge conflicts

Page 33: Agile Tools

Demo: Team Foundation Server Version Control

Page 34: Agile Tools

Continuous Integration Testing with TFS Build Service

Page 35: Agile Tools

Using the Build Service for Continuous Integration Testing

Create or edit a build definition

On Build triggers, set continuous integration

Page 36: Agile Tools

Create or Edit Build Definition

Access the Builds tab

from Team Explorer

Create a new build

or edit a new one

Set the build

definitions

Page 37: Agile Tools

Continuous Integration Trigger

Access the Trigger tab Select Continuous Integration

Gated Check-in

offers a stricter

check in policy

Page 38: Agile Tools

Demo: Continuous Integration Testing with TFS Build Service

Page 39: Agile Tools

Case Study & Hands-on Exercises

Page 40: Agile Tools

Web Performance and Load Testing

Page 41: Agile Tools

Web Performance and Load Testing

Record web performance tests

Add a load test

Run load test

Analyze test results

Page 42: Agile Tools

Web Performance Test

Create a web performance and load test project

Record a web performance test

Page 43: Agile Tools

Load Test (1)

Create a load test

Choose a load pattern

Add a test mix

Plug the web performance

test

Run the load test

Analyze the results of the

test

Page 44: Agile Tools

Load Test (2)

Create a load test

Choose a load pattern

Add a test mix

Plug the web performance

test

Run the load test

Analyze the results of the

test

Page 45: Agile Tools

Demo: Web Performance and Load Testing

Page 46: Agile Tools

Case Study & Hands-on Exercises

Page 47: Agile Tools

ReferencesTest-driven development - http://en.wikipedia.org/wiki/Test-driven_development

http://en.wikipedia.org/wiki/Continuous_integration

http://en.wikipedia.org/wiki/Extreme_programming_practices#Continuous_integration

Use Team Foundation Version Control - http://msdn.microsoft.com/en-us/library/ms181237(v=vs.120).aspx

Unit Test - http://msdn.microsoft.com/en-us/library/dd264975.aspx

Build Service - http://msdn.microsoft.com/en-us/library/ms181709.aspx

Performance and load testing - http://msdn.microsoft.com/en-us/library/dn250793.aspx

Page 48: Agile Tools

Copyright (C) 2014. Allan Spartacus Mangune

This work is licensed under a Creative Commons Attribution-

NonCommercial-ShareAlike 4.0 International License.

License URL: http://creativecommons.org/licenses/by-nc-

sa/4.0/