1 / 23

COMPSCI 230 S2C 2012 Software Design and Construction

COMPSCI 230 S2C 2012 Software Design and Construction. Revision. Learning Outcomes for the Testing Unit. Demonstrate a “theoretical understanding” of testing Discuss the role of testing in “famous failures” ( Ariane , LAS, INCIS)

weldon
Download Presentation

COMPSCI 230 S2C 2012 Software Design and Construction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. COMPSCI 230 S2C 2012Software Design and Construction Revision

  2. Learning Outcomes for the Testing Unit • Demonstrate a “theoretical understanding” of testing • Discuss the role of testing in “famous failures” (Ariane, LAS, INCIS) • Evaluate a test suite, with reference to Myers’ principles (“A” level) • Competently perform some test-driven development tasks • “B” level exam questions: write a unit test, specify a test suite, ... • Homework, tutorials: some experience with JUnit and XT. • Demonstrate a basic understanding (by defining or using) the fundamental concepts and standard terminology of software testing • Validation testing, defect testing, unit test, component test, system test, XT, XP, … (“C” level) Revision

  3. Learning Outcomes: Concurrency • Demonstrate a “theoretical understanding” of multi-threaded computations • Hand-execute a simple multi-threaded program (“B” level) • Analyse a program to discover consistency and visibility defects (“A” level) • Competently develop, maintain, and test a multi-threaded program • Modify the threading behaviour of a simple program e.g. primeRacer in A2 (“B” level) • Accurately diagnose a deadlock condition (“A” level) • Demonstrate proficiency with the basic concepts and vocabulary of concurrency in Java • Be able to define and use common terms and keywords e.g. volatile, mutex, synchronization (“C” level) Revision

  4. Detailed Goals (from lecture slides) • [T1] Develop a “working understanding” of Myers’ definition of “software testing”. • Memorisation is rarely helpful in practice, unless you can apply what you have memorised to a novel situation. • It’s easy to test someone’s memory; testing their understanding is more difficult (and error-prone). Even so, that’s what I’ll be testing: can you “apply” Myers’ definition to some novel situation? • [T1] Help you develop a strength in “active learning”. • I’ll teach-by-example. I won’t test this directly, but if you’re not actively learning I doubt you’ll develop much “working understanding” of anything I’m teaching – including active learning! • [T1] Develop a working understanding of test cases, including the rudiments of test-case analysis. Revision

  5. Detailed Goals (from lecture slides) • [T2] Develop a “working understanding” of Myers’ theory of the psychology and economics of software testing. • Can you imagine being interviewed for a job as an entry-level software tester? Would you want this job? • [T2] Develop a test suite for some code without looking at it. (Black-box testing.) • What are your initial questions? (Have you written some already?) • Should I try to “write it myself” (to discover some likely bugs)? • Should I carefully test interfaces, exceptions, or error returns, or should I concentrate on confirming the correctness of functional “internal” behaviour? Revision

  6. Detailed Goals (from lecture slides) • [T3] Develop a test suite for some code after looking at it. (White-box testing.) • What are your initial questions? (Have you written some already?) • Should I analyse the specification carefully, as in black-box testing, to discover “what the code should be doing”? • Does white-box testing have an advantage, over black-box testing, in testing “what the program is not intended to do”? • Should I carefully test interfaces, exceptions, or error returns, or should I concentrate on confirming the correctness of functional “internal” behaviour? • [T3] Start to develop your own “principled approach” to software testing. • Do you agree with all of Myers’ principles? Do you have any additional ones? • Do you understand Myers’ argument for each of his principles? Revision

  7. Detailed Goals (from lecture slides) • [T4] Have a working understanding of Myers’ principled approach to software testing. • Given some information about a testing situation, can you apply Myers’ principles? (“What would Myers do in this situation?”) • Under what conditions are Myers’ principles inapplicable or inappropriate? • (Note that I’m asking you to write some “test cases” for Myers’ principles – considering its “unexpected inputs” as well as the inputs he explicitly considered! ;-) Revision

  8. Detailed Goals (from lecture slides) • [Mutu-Grigg] What is the “real world” of software testing? • Why testing is important • What are the benefits of testing (which may justify its costs)? • Thinking outside the square • The project management triangle • Common forms of testing Revision

  9. Detailed Goals (from lecture slides) • [T5] Have a working understanding of XP (as explained by Myers). • Given a description of a software development process, discuss its conformance with XP principles. • What are the major arguments for XP? Against it? • Name, and briefly describe, some of the 12 core practices of XP (as explained by Myers). Revision

  10. Detailed Goals (from lecture slides) • [T6] Have a working understanding of XT (as explained by Myers). • Given a description of a software testing process, discuss its conformance with XT. • What are the major arguments for XT? Against it? • Given a development scenario, discuss whether XT could be applied. If it is applicable, what benefits might be expected from its use? Revision

  11. Detailed Goals (from lecture slides) • [T7] Develop black-box unit tests from a unit specification • Input validation • Boundary-value analysis • Automate tests using JUnit • This lecture: theory • In tutorial and lab assignment: some practical experience Revision

  12. Detailed Goals (from lecture slides) • [T8] Schadenfreude (pleasure derived from the misfortunes of others), with some lessons learned: • Software professionals are trusted to “do the right thing” and to “do no harm”. But we aren’t completely trustworthy: we all make mistakes, and some are unethical. • Safety-critical software can fail catastrophically, even if it is carefully tested. • Enterprise software: failure modes are complex, with no single “cause”, but technical factors are often important. • [T8] An overview of the ACM Code of Ethics • What would you do, if you were pressured to “sign off” on a test report for a system that you aren’t confident will be “safe to use”? • What other ethical conflicts might arise in your professional workplace? Revision

  13. Detailed Goals (from lecture slides) • [C1] Develop an appropriate “mental model” for multithreaded programs. • Predict the outputs of a simple multithreaded program. • [C2] Understand why multithreading is important – and difficult! • List, and briefly discuss, some of the ways in which multithreading is used in Java. • Recognise some common “design patterns” for multithreaded computations: Model-View-Controller, simulation with one-thread-per-actor, foreground/background computations. • Explain how a volatile variable differs from a non-volatile one: what are its advantages and disadvantages? Revision

  14. Detailed Goals (from lecture slides) • [C2] Refine your understanding of threading: • Make a careful distinction between the support of an operating system (or a computer) for running a thread, and an instance of a Thread object in the execution of a Java program. • [C2] Understand the “lifecycle” of a thread • Start to analyse a multi-threaded application, by identifying “where” in the code the state of a thread can change state i.e. are created, become runnable, start to wait, stop waiting, and are terminated. Revision

  15. Detailed Goals (from lecture slides) • [C3] Distinguish daemons from user threads • How are they different? What are they doing in your JVM? • [C3] What are some of the common uses of multithreading in Java? • What is the “thread architecture” of AWT/Swing? Which tasks belong on which thread? What can happen if the EDT is handling tasks that belong on the model or controller thread? • What is a TimerTask, an RMI, a servlet, and a JSP? When might I want to use these libraries in Java? • [C3] Develop a working understanding of synchronization • What are locks? Atomic operations? Synchronized methods? When should I use them? • What can happen if an application has defective synchronization? Revision

  16. Detailed Goals (from lecture slides) • [C4] Develop a stronger understanding of synchronization in Java. • Be able to analyse codes with a small number of interactions between a few threads, answering the question “what execution traces are possible?” • [C4] Learn the syntax for synchronized methods • What are the disadvantages of this “syntactic sugar”? • [C4] Learn an important design pattern: using a final instance of a collection to synchronize its methods. • A simple example: a thread-safe cache Revision

  17. Detailed Goals (from lecture slides) • [C5] Have a solid understanding of synchronization • Learn a new word and a new concept: mutex, and mutual exclusion • Work through a few more examples • Know Goetz’s advice on when to use, and when not to use, synchronization. • [C5] Be able to diagnose a deadlocked system • Note: deadlock avoidance is beyond the scope of CompSci 230. • [C5] Start to develop your own position on the relative importance of designing for features, correctness, security, and performance. • Agility and maintainability may be more important than some of the above… remember XP? • Consider taking Goetz’s advice and my advice, then decide for yourself! Revision

  18. Detailed Goals (from lecture slides) • [C6] Learn some more Java: • wait(), notify(), notifyAll(), thread priorities, thread groups, Thread.UncaughtExceptionHandler(), SwingUtilities.invokeLater(), SwingUtilities.invokeNow(). • Know when and where to use these methods. • [C6] Know the rough outlines of Goetz’s advice on dealing with interruptedException(). • [C6] Confirm your understanding of multi-threading in Java • Summarise what you learned from Goetz’s introduction (and from my presentation of it) • Start to prepare for graduation: you don’t really need me to learn other advanced features of Java, do you? Revision

  19. Detailed Goals (from lecture slides) • [C7] Know the rough outlines of Goetz’s advice on dealing with interruptedException(). • [C7] Confirm your understanding of multi-threading in Java • Summarise what you learned from Goetz’s introduction (and from my presentation of it) • Start to prepare for graduation: you don’t really need me to learn other advanced features of Java, do you? • [C7] A brief introduction to executors, tasks, concurrent collections, and synchronizers. • You’ll know, roughly, what they do. This is just an introduction! • You won’t know how to use them well. • You will have some ideas on what (and how!) you’ll have to read & study, if you want to learn how to use these well. • [C7] Start to develop your own point of view on the importance of learning low-level “assembly language”. • You’ll usually be programming in high-level constructs, so you don’t really need to know the low-level stuff. Or do you? Revision

  20. Detailed Goals (from lecture slides) • [C8] Work through most of the “Concurrency in Swing” tutorial at http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html • Know how to use the three types of threads in a Swing app • Develop a vague understanding of how background tasks are controlled in Swing (but you won’t know the names of methods, or their detailed semantics) Revision

  21. Exam Skeleton Question 1 [11 marks]: Inheritance Given a super class and an interface…, complete the following subclasses … Question 2 [4 marks]: Inheritance Question 3 [11 marks]: Polymorphism Consider the following classes … What is the output of the following code fragment … Question 4 [6marks]: a) What is the difference between …. And ……? b) … Illustrate with an example. Question 5 [6 marks] JTable a) Complete the… b) Complete the… Revision

  22. Exam Skeleton (cont.) Question 6 (15 marks) Concurrency Consider the following class: ... a) Assume that two threads are concurrently invoking ... b) Would this class be thread-safe if ... c) Assume that each thread of a multi-threaded program constructs a single instance ... Question 7 (14 marks) Testing In the answer box below, write JUnit test cases for ... import junit.framework.TestCase; public class XxxTest extends TestCase { public final void testYyy() { } } ... Revision

  23. Exam Skeleton (cont.) Question 8 (11 marks) Testing. a), b), c), d) are multiple-choice or true-false questions. 2 marks for a correct answer, 1 mark for a brief explanation of your answer (for questions a, b, d) Question 9 (12 marks) Concurrency. a), b), c), d) are multiple-choice or true-false questions. 2 marks for a correct answer, 1 mark for a brief explanation of your answer. Question 10 (10 marks) Concurrency. a), b), c), d) are multiple-choice or true-false questions. 2 marks for a correct answer, 1 mark for a brief explanation of your answer (for questions b, d) Revision

More Related