Agile Development & Companies



Similar documents
GDB Tutorial. A Walkthrough with Examples. CMSC Spring Last modified March 22, GDB Tutorial

Intro to scientific programming (with Python) Pietro Berkes, Brandeis University

The programming language C. sws1 1

Manual Tester s Guide to Automated Testing Contents

Tools for Integration Testing

CS 241 Data Organization Coding Standards

Testing in a Mobile World

The University of Alabama in Huntsville Electrical and Computer Engineering CPE Test #4 November 20, True or False (2 points each)

Module 10. Coding and Testing. Version 2 CSE IIT, Kharagpur

Boolean Expressions, Conditions, Loops, and Enumerations. Precedence Rules (from highest to lowest priority)

Research Data Management CODING

Curriculum Map. Discipline: Computer Science Course: C++

First Java Programs. V. Paúl Pauca. CSC 111D Fall, Department of Computer Science Wake Forest University. Introduction to Computer Science

C Coding Style Guide. Technotes, HowTo Series. 1 About the C# Coding Style Guide. 2 File Organization. Version 0.3. Contents

Ultra-rapid Prototype Delivery

Analysis Programming

Coding Rules. Encoding the type of a function into the name (so-called Hungarian notation) is forbidden - it only confuses the programmer.

Programming Languages CIS 443

Introduction to Automated Testing

Unit and Functional Testing for the ios Platform. Christopher M. Judd

Chapter 13 Storage classes

Illustration 1: Diagram of program function and data flow

Moving from CS 61A Scheme to CS 61B Java

C++FA 5.1 PRACTICE MID-TERM EXAM

ISTQB Certified Tester. Foundation Level. Sample Exam 1

Agile.NET Development Test-driven Development using NUnit

Output: struct treenode{ int data; struct treenode *left, *right; } struct treenode *tree_ptr;

For the next three questions, consider the class declaration: Member function implementations put inline to save space.

Simplifying development through activity-based change management

Introduction to C Unit Testing (CUnit) Brian Nielsen Arne Skou

Software Project Models

This documentation is made available before final release and is subject to change without notice and comes with no warranty express or implied.

Copyright 2001, Bill Trudell. Permission is granted to copy for the PLoP 2001 conference. All other rights reserved.

Lecture 3. Arrays. Name of array. c[0] c[1] c[2] c[3] c[4] c[5] c[6] c[7] c[8] c[9] c[10] c[11] Position number of the element within array c

Empowered Employee Training With a Content Strategy

Object Oriented Software Design II

Software Development Lifecycle. Steve Macbeth Group Program Manager Search Technology Center Microsoft Research Asia

Embedded Storycrafting: Key to Controlling Risk and Schedule

What makes a good process?

CS 2112 Spring Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions

CS1010 Programming Methodology A beginning in problem solving in Computer Science. Aaron Tan 20 July 2015

Software Engineering Principles The TriBITS Lifecycle Model. Mike Heroux Ross Bartlett (ORNL) Jim Willenbring (SNL)

Introduction to SQL for Data Scientists

QUIZ-II QUIZ-II. Chapter 5: Control Structures II (Repetition) Objectives. Objectives (cont d.) 20/11/2015. EEE 117 Computer Programming Fall

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)

Compiler Construction

Monitoring, Tracing, Debugging (Under Construction)

MPLAB Harmony System Service Libraries Help

Interface and Simulation of a LCD Text Display

Software Development Life Cycle

Kentico Site Delivery Checklist v1.1

USERV Auto Insurance Rule Model in Corticon

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Test-Driven Development

The little endl that couldn t

Lab 2: Swat ATM (Machine (Machine))

White Paper. The Power of Siebel escripting at Runtime. Bringing Siebel Developer Closer to Rapid Application Development

Cours de C++ Utilisations des conteneurs

Functional Programming in C++11

1/20/2016 INTRODUCTION

Dice. David Watkins Emily Chen Khaled Atef Phillip Schiffrin. djw2146 ec2805 kaa2168 pjs2186. Manager System Architect Testing Language Guru

3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version

DNS. DNS Fundamentals. Goals of this lab: Prerequisites: LXB, NET

Dinopolis Java Coding Convention

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Chapter One Introduction to Programming

Finding Fault Location: Combining network topology and end-to-end measurments to locate network problems?

Outline. 1 Denitions. 2 Principles. 4 Implementation and Evaluation. 5 Debugging. 6 References

CISC 181 Project 3 Designing Classes for Bank Accounts

<Insert Picture Here> When to Automate Your Testing (and When Not To)

Chapter 2: Algorithm Discovery and Design. Invitation to Computer Science, C++ Version, Third Edition

AppendixA1A1. Java Language Coding Guidelines. A1.1 Introduction

Objectives. Python Programming: An Introduction to Computer Science. Lab 01. What we ll learn in this class

AQA GCSE in Computer Science Computer Science Microsoft IT Academy Mapping

Comp151. Definitions & Declarations

Good FORTRAN Programs

What is a Loop? Pretest Loops in C++ Types of Loop Testing. Count-controlled loops. Loops can be...

Object Oriented Software Design II

Conditionals (with solutions)

An Overview of Quality Assurance Practices in Agile Methodologies

ECS 165B: Database System Implementa6on Lecture 2

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

Know or Go Practical Quest for Reliable Software

Software Engineering Practices for Python

Interpreters and virtual machines. Interpreters. Interpreters. Why interpreters? Tree-based interpreters. Text-based interpreters

The Advantages of Being Sensive and Mobile

Debugging Strategies

Agile Test Automation

Introduction site management software

Agile Aspects of Performance Testing. March 1, Page 1

Chapter 13: Program Development and Programming Languages

Modeling, Computers, and Error Analysis Mathematical Modeling and Engineering Problem-Solving

Peach Fuzzer Platform

Lecture 2 Mathcad Basics

PCSpim Tutorial. Nathan Goulding-Hotta v0.1

Why HTML5 Tests the Limits of Automated Testing Solutions

NXTware Remote. Advanced Development and Maintenance Environment for OpenVMS and other Strategic Platforms

Sensors and the Zaurus S Hardware

Transcription:

Agile Development & Companies Harvard Business Review: Why the lean start-up changes everything Agile development applied to entire business of start-ups Iterate! Simplest possible prototype! Image: leadnet.org

Vaughn Betz ECE 297 Testing

Testing Philosophy If you didn t test it, it doesn t work Assume all code broken until proven otherwise Look at what the program does not what it is supposed to do Scientist: you are testing hypotheses about program Think of every case your program should handle cover them all

Testing Time Develop tests as or before you code Test-driven development Prototype Refine Test & Evaluate

Test-Driven Development The tests are the detailed specification And now can be executed, not just read Less specification document More tests

Types of Tests End to End Tests End-to-end (system) tests Test entire system (like end user would) Hard to debug a failure problem could be anywhere! Fragile: often test some exact user input would produce some exact output text / file Unit Tests Unit Tests Test small pieces of system (single classes / functions) Much easier to debug a failure start with that class / function Don t check user interface (I/O): check API / class does what it should with code (testfixture)

Types of Tests End to End Tests Integration Tests Integration Tests Bigger unit tests Work the same way But now test multiple classes / bigger functionality Moderate difficulty to debug Unit Tests

You will re-test often Testing Automation Every time you change the program How to speed up? System tests: save in files Use file redirection prog.exe < in.txt > out.txt diff out.txt out_good.txt // matched known good result? Less fragile Write validity checker instead of checking exact output match Write scripts to run all tests and check results

Want: Unit Tests To test individual classes / functions How? Carefully chosen user input? Output... No! struct Point { float x; float y; t_point& operator*=(float rhs);...

Unit Tests Write new code To put class in right state To directly send it some input / make some calls To immediately check the responses Test driver

Unit Tests struct Point { float x; float y; t_point& operator*=(float rhs);... test_main.cpp int main () { int error = 0; error += test1();... // Lots more tests mycode.cpp tester.cpp int test1 () { Point testme (1, 2); testme *= 3; if (testme!= Point (3, 6)) { cout << uh oh << endl; return (1); return (0); g++ mycode.cpp main.cpp o prog.exe g++ mycode.cpp tester.cpp test_main.cpp o test.exe

Unit Test Frameworks Lots of repetitive code to create test drivers Set up the test Check if the test passed Run all the tests Output appropriate messages Collect statistics Unit Test Frameworks Useful macros (#defines) and functions to simplify coding We are using UnitTest++ Powerful, but easy to learn ECE 297 Unit Test Quick Start Guide TEST(..) or TESTFIXTURE ( ) CHECK(..) RunAllTests() Automatic Automatic

Overlapping tests good Test the Seams Your code + partner s code Both unit tested Make sure there s an integration test Therac-25

What tools? 1. Debugger Testing Tools Use to debug when a test fails Use to verify new code Step through it and watch execution 2.Memory checker Program seg faults? Program behaving very strangely? Maybe you are accessing memory you shouldn t be! Run valgrind

3. Code coverage MyCode.cpp Testing Tools Tools that can track what lines of your programs have executed over all your tests int somefunc (int input) { if (input == 0) return (3); else return (7); main.cpp int main () { int j = somefunc (8); // Wow I m bad at testing!

3. Code coverage Testing Tools Tools that can track what lines of your programs have executed over all your tests MyCode.cpp int somefunc (int input) { if (input == 0) return (3); else return (7); No test reaches this line. Code coverage: 6 out of 7 lines or 86% main.cpp int main () { int j = somefunc (8); // Wow I m bad at testing!

Google: Testing so Important, Tutorials in the Bathroom

Testing on the Toilet

Good Coding Style

1. Use White Space int sumvec (int vec[], int nelem) { int i, result = 0; for (i = 0; i < nelem; i++) { result += vec[i]; return (result); void nextfunc (int i) { int sumvec (int vec[], int nelem) { int i, result = 0; for (i = 0; i < nelem; i++) { result += vec[i]; return (result); void nextfunc (int i) { White space: show code organization Indent properly (3 or 4 spaces) per {. Leave blank lines between functions / key blocks

float di (float a, float b) { float val, d, x, x2, y; What does this do? d = 1.e-4; val = 0; for (x = a; x < b; x += d) { x2 = x + d; if (x2 > b) x2 = b; y = 0.5 * ((1. / x) + (1. / x2)); val += y * (x2 - x); return (val);

float definite_integral (float x_left, float x_right) { float integral, step_size, x1, x2, y_average; What does this do? step_size = 1.e-4; integral = 0; for (x1 = x_left; x1 < x_right; x1 += step_size) { x2 = x1 + step_size; if (x2 > x_right) x2 = x_right; y_average = 0.5 * ((1. / x1) + (1. / x2)); integral += y_average * (x2 x1); return (integral);

2. Descriptive Variable Names Use descriptive names Variables, functions, structs/types, get_file_name ( ); // Use _ to separate getfilename (); // Or use upper case to mark words Types: start with a capital letter Variables: start with lowercase class MyClass { MyClass onevar;

float definite_integral (float x_left, float x_right) { float integral, step_size, x1, x2, y_average; What does this do? step_size = 1.e-4; integral = 0; for (x1 = x_left; x1 < x_right; x1 += step_size) { x2 = x1 + step_size; if (x2 > x_right) x2 = x_right; y_average = 0.5 * ((1. / x1) + (1. / x2)); integral += y_average * (x2 x1); return (integral);

// Compute the definite integral of 1/x between x_left and x_right via the // trapezoidal method. Smaller values of step_size improve accuracy, but // increase computation time. Comment what whole function does float definite_integral_of_one_over_x (float x_left, float x_right) { float integral, step_size, x1, x2, y_average; step_size = 1e-4; integral = 0.; for (x1 = x_left; x1 < x_right; x1 += step_size) { x2 = x1 + step_size; if (x2 > x_right) // in case (x_right x_left) is not a multiple of step_size x2 = x_right; y_average = 0.5 * ((1. / x1) + (1. / x2)); // average of y(x1) and y(x2) integral += y_average * (x2 x1); return (integral); Comment any tricky bits of code

Comments: Usefulness? trans_sim.cpp /* Functions to simulate transistors. * We model transistors as nonlinear elements, * by looking up the source-drain current for each V */ StudentRecord.h /* Main data structure used to store all information * about a U of T student. Linked list. */ struct StudentRecord { int nclassescurrent; // Number of classes enrolled in. int nclassescomplete; // Number of completed classes, // not including currently enrolled ones StudentRecord *next; // Pointer to next (linked list) record program.cpp // Compute the sum of the array, over all its elements int sum = 0; for (int i = 0; i < nelem; i++) sum += array[i];

3. High-Level Comments Most important comments: give the big picture Documentation should be in the comments Not a separate document will get out of date 1. Top of files // Functions to simulate transistors. We proceed in 6 stages 2. Class / data structure definitions Understand the data can understand the program! 3. Start of functions 4. Tricky code Not very useful comments: Translate C++ to English Most important Least important

Thoughts on This Code? int checkweights (int weights[20]) { for (int i = 0; i < 20; i++) { if (weights[i] < 0) return (-1); if (weights[i] == 0) return (1); return (0); 1. Using a magic number : 20 Change array size: must find and change all 20 s 2. Returning magic numbers: -1, 0, 1 Must read code carefully to see what each means

4. Use Named Constants const int NUM_WEIGHTS = 20; // 1. Constant variable #define WEIGHT_ZERO 0 // 2. Pre-processor constant enum WtReturn {HAS_NEG = -1, HAS_ZERO = 0, ALL_POS = 1; // 3. make an enumeration (list) of int constants int checkweights (int weights[num_weights]) { for (int i = 0; i < NUM_WEIGHTS; i++) { if (weights[i] < 0) return (HAS_NEG); if (weights[i] == 0) return (HAS_ZERO); return (ALL_POS); Three ways to make constants use any way you like Name: ALL CAPITALS (convention)