Automation of Testing in the Distributed Common Ground System (Army)

Slides:



Advertisements
Similar presentations
Computer Science 209 Testing With JUnit. Why Test? I don ’ t have time, I ’ ve got a deadline to meet The more pressure I feel, the fewer tests I will.
Advertisements

Chapter 7 User-Defined Methods. Chapter Objectives  Understand how methods are used in Java programming  Learn about standard (predefined) methods and.
Road Map Introduction to object oriented programming. Classes
Well-behaved objects 4.0 Testing. 2 Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling Main concepts to.
Software and Software Vulnerabilities. Synopsis Array overflows Stack overflows String problems Pointer clobbering. Dynamic memory management Integer.
Terms and Rules Professor Evan Korth New York University (All rights reserved)
ASP.NET Programming with C# and SQL Server First Edition
Java Unit 9: Arrays Declaring and Processing Arrays.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Data Objects (revisited) Recall that values are stored in data objects, and that each data object holds one value of a particular type. Data objects may.
Coding Methodology How to Design Code. © 2005 MIT-Africa Internet Technology Initiative Pay Attention to Detail When implementing or using APIs details.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 5 – Dental Payment Application: Introducing.
CIT 590 Intro to Programming First lecture on Java.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
Using Data Within a Program Chapter 2.  Classes  Methods  Statements  Modifiers  Identifiers.
TJHSST Computer Systems Lab Automation of Testing in the Distributed Common Ground System (Army) Michael Eng Mentor: Mark Pumphrey Northrop Grumman.
Unit Testing with JUnit and Clover Based on material from: Daniel Amyot JUnit Web site.
C# C1 CSC 298 Elements of C# code (part 1). C# C2 Style for identifiers  Identifier: class, method, property (defined shortly) or variable names  class,
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
 2007 Pearson Education, Inc. All rights reserved C Arrays.
Scalatest. 2 Test-Driven Development (TDD) TDD is a technique in which you write the tests before you write the code you want to test This seems backward,
Programmeren 1 6 september 2010 HOORCOLLEGE 2: INTERACTIE EN CONDITIES PROGRAMMEREN 1 6 SEPTEMBER 2009 Software Systems - Programming - Week.
Classes, Interfaces and Packages
Debugging, bug finding and bug avoidance Part 2 Alan Dix
Announcements You will receive your scores back for Assignment 2 this week. You will have an opportunity to correct your code and resubmit it for partial.
CS/ENGRD 2110 FALL 2013 Lecture 3: Fields, getters and setters, constructors, testing 1.
CHAPTER 6 ARRAYS IN C 1 st semester King Saud University College of Applied studies and Community Service Csc 1101 F. Alakeel.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
CSE 143 Lecture 14: testing.
SWE 434 SOFTWARE TESTING AND VALIDATION LAB2 – INTRODUCTION TO JUNIT 1 SWE 434 Lab.
C++ Exceptions.
Computer Organization and Design Pointers, Arrays and Strings in C
CMSC 345 Defensive Programming Practices from Software Engineering 6th Edition by Ian Sommerville.
Lecture 2 D&D Chapter 2 & Intro to Eclipse IDE Date.
Chapter 7 User-Defined Methods.
Dept of Computer Science University of Maryland College Park
Defensive Programming
CS1101X Programming Methodology
Michael Eng Mentors: Mark Pumphrey, Greg Cordero
Testing and Debugging.
C++, OBJECT ORIENTED PROGRAMMING
Computer Science 209 Testing With JUnit.
Testing & Testing Tools
Chapter 3 Inheritance © 2006 Pearson Education Inc., Upper Saddle River, NJ. All rights reserved.
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
Software Engineering 1, CS 355 Unit Testing with JUnit
Exceptions 10-Nov-18.
Topics Introduction to File Input and Output
C Arrays.
Overview of Eclipse Lectures
Java Programming Language
Chapter 12 Exception Handling
More About Data Types & Functions
Arrays in Java What, why and how Copyright Curt Hill.
Format String.
Arrays.
Automation of Testing in the Distributed Common Ground System (Army)
Bugs & Debugging - Testing
Fundamental OOP Programming Structures in Java: Comments, Data Types, Variables, Assignments, Operators.
Java Programming Language
CSE 143 Lecture 5 More ArrayIntList:
Exceptions 25-Apr-19.
In this class, we will cover:
Exceptions 22-Apr-19.
Exceptions 10-May-19.
CMPE212 – Reminders Assignment 2 due today, 7pm.
Topics Introduction to File Input and Output
Exceptions 5-Jul-19.
Testing Slides adopted from John Jannotti, Brown University
Presentation transcript:

Automation of Testing in the Distributed Common Ground System (Army) Michael Eng Mentor: Mark Pumphrey, Greg Cordero Northrop Grumman Mission Systems

Outline Purpose DCGS-A overview JUnit Automation of testing Problems encountered Results/conclusion

Purpose Explore methods of software testing and testing automation Help to test and debug the DCGS-A project Improve software quality

DCGS-A Distributed Common Ground System- Army Modular & decentralized Integrate multiple types/sources of intelligence Java, JavaBeans, Oracle Similar efforts taking place in other branches of the military

Why Test? System crashes in field System is hacked Loss of communication between commander and soldiers No one knows where the enemy is Intelligence database cannot be updated System is hacked Self-explanatory

JUnit Unit testing framework for Java Test classes correspond to main classes E.g., MyClass.java & MyClassTest.java Run  status bar- green or red Used with Eclipse to test DCGS-A Perfect for testing individual instances of objects, methods, etc. http://www.onjava.com/pub/a/onjava/2005/07/13/pisces.html?page=2

Methodology/Procedure Each method with logic is tested Every constructor is tested Unit testing- method input arguments, conditional statements tested Edge testing Dummy objects Hardcoded characteristics- force all possibilities “logic…that is, not a simple get or set method” THIS INCLUDES GARBAGE DATA AND RANDOMLY GENERATED DATA- FUZZ TESTING

Procedure continued JUnit4TestRunner, Logger JUnit formatting JUnit Javadoc notation- @Before, @After, @Test Assertions E.g., assertEquals(array[0], “Proper answer”); assertNull([something that returns null]); Expected void test (expected =NullPointerException.class) Exception testing Javadoc notation is placed before the method to signify to the TestRunner that the method is a test method Before is used to reset variables before each test After usually is used to free up memory and resources or reset variables after each test

Example Test Program class myClassTest class myClass{ void testParse() myClass.parse(null); void testParse2() myClass.parse(“”); void testParse3() myClass.parse(“ABC”); void testParse4() myClass.parse(“3##”); void testParse5() myClass.parse(“53”); void testParse6() myClass.parse( new Object().toString()); void testParse7() myClass.parse(new Integer(54)); void testParse8() myClass.parse(new String[2]); And so on… class myClass{ static char parse (String s){ …logic to parse out the first number character in a String (e.g. ‘3’ in “ABC3WW5”)… return that number as a char or null if not found } Say we have a class MyClass with method parse that gets the first number character in an input String and returns it or null if there’s no numbers in the string. On the right we have a JUnit test class. So, we test the method by sending null. Then we send an empty String and expect a null output, or maybe an Exception if the method doesn’t check for that sort of thing (which we would then fix in the main class). Then we send a String that’s all letters and expect it to return null. Then a string that actually has a number. Then an all-number string. Then an Object forced into a String. Then an Integer object. Then a String array instead of an object. We could even go so far as to send a string one character too large (32767 is the limit) to see how gracefully the program handles overflows. And so on.

Procedure continued One method can have many, many cases Vast majority of possibilities must be tested Errors, if-else ladders, arguments, etc. “Hardened” classes important System must be protected Reflection, buffer overflow attacks “One method can have many, many cases”…and most, if not all need to be covered in testing “System must be protected…tactics like reflection and data overflow attacks have to be handled- for example reflection can be stopped by making critical values private and final, and many overflow attacks can be stopped with bounds checking” http://www.dabbledoo.com/ee/images/uploads/gamertell/access_denied.jpg

Automation Tests are written, now what? JUnit AllTests- template for mass runs Project has over 700 test methods “Each subdirectory has an AllTests file that basically loads either the AllTests files below it, or loads each test class into it and runs the tests. It actually only takes a little under 10 seconds to run the whole system’s tests. So that saves a LOT of time.” http://java.sun.com/developer/technicalArticles/JavaLP/JavaToMac/images/WindowsJUnit.gif

Problems Encountered External frameworks Test dependency hell Undocumented or still being integrated Test dependency hell E.g., testing a class nested in another that depends on unavailable/unfinished properties file Mock objects/files Not really a problem, but constant updates to data classes still in development/pre-debugging Constant updates of old tests http://gallery.nofactzone.net/albums/userpics/normal_headdesk.jpg

Results/Conclusion Created over 20 test classes Modified over 10 existing test classes and main classes (bug fixes, etc.) Still working on getting 100% function, path, and condition coverage for classes that need testing Modifying existing tests to reflect updates in development