JUnit tes)ng. Elisa Turrini
|
|
- Ariel Hunter
- 5 years ago
- Views:
Transcription
1 JUnit tes)ng Elisa Turrini
2 Automated Tes)ng Code that isn t tested doesn t work Code that isn t regression tested suffers from code rot (breaks eventually) If it is not automated it is not done! Boring Repe))ve Error- prone (for humans) Time consuming
3 Test Framework A test framework is a sokware tool for wri)ng and running unit- tests Provides reusable test func)onality which: Enables automa)c execu)on for regression tests Is standardized Easy to use Test report genera)on Programmer Friendly
4 What is xunit? A set of Frameworks for programming and automated execu)on of test- cases X stands for programming language Most Famous is J- UNIT for Java But exists for almost all programming language (C- unit, Cpp- Unit, DUnit, JUnit NUnit, ) and development plaxorms
5 xunit architecture All xunit frameworks share the following basic concepts: Test Runner Test case Test Fixtures Test Suites Test Result FormaZer Asser)ons
6 Test runner: an executable program that runs tests implemented using an xunit framework and reports the test results.
7 Test runner: an executable program that runs tests implemented using an xunit framework and reports the test results. Test case: a set of condi)ons under which a tester will determine whether a so#ware unit (i.e. individual unit of source code) is working as it was originally established for it to do. a class containing all test methods for a given sokware unit or func)on or class
8 Test Fixture: test context the set of precondi)ons or state needed to run a test.
9 Test Fixture: test context the set of precondi)ons or state needed to run a test. Test Suite: set of tests that all share the same fixture the order of the tests shouldn't mazer. Collec)on of related test cases Can be executed automa)cally in a single command
10 Structure of a Unit Test Setup Prepare an input Call a method Check an output Tear down
11 JUNIT TESTING
12 JUnit It is an instance of the xunit architecture for unit tes)ng frameworks. A programmer- oriented tes)ng framework for Java. JUnit is a simple framework to write repeatable tests JUnit4 Annota)ons Asser)ons
13 ECLIPSE DEMO
14 public class Calculator {!!! public int multiply(int x, int y) {! // the following is just an example! if (x > 999) {! throw new IllegalArgumentException!!!!!("X should be less than 1000");! }! return x * y;! }! }!
15 public class CalculatorTest public static void testsetup() {! public static void testcleanup() {! // Teardown for data used by the unit tests! = IllegalArgumentException.class)! public void testexceptionisthrown() {! Calculator tester = new Calculator();! tester.multiply(1000, 5);! public void testmultiply() {! Calculator tester = new Calculator();! assertequals("10 x 5 must be 50", 50, tester.multiply(10, 5)); }! }!
16 Tes)ng the methods in the unit vs. tes)ng unit behaviours One test should be responsible for one scenario only Test behaviour, not methods: One method, mul)ple behaviours - > Mul)ple tests One behaviour, mul)ple methods - > One test
17 Annota)ons In java, an annota)on is a form of syntac)c metadata that can be added to Java source code Annota)on provide data/informa)on about a program that is not part of the program itself Java annota)ons can be embedded in class files generated by the compiler and may be retained by the Java VM to be made retrievable at run- )me.
18 Junit iden)fies a method as a test (expected = Excep)on.class): Fails, if the method does not throw the named Fails, if the method takes longer than 100 milliseconds.
19 Junit This method is executed before each test. It is used to can prepare the test environment (e.g. read input data, ini)alize the This method is executed aker each test. It is used to cleanup the test environment (e.g. delete temporary data, restore defaults). It can also save memory by cleaning up expensive memory structures.
20 Junit This method is executed once, before the start of all tests. Methods annotated with this annota)on need to be defined as sta)c to work with This method is executed once, aker all tests have been finished. It is used to perform clean- up ac)vi)es. Methods annotated with this annota)on need to be defined as sta)c to work with JUnit.
21 Junit Ignores the test method. This is useful when the underlying code has been changed and the test case has not yet been adapted. Or if the execu)on )me of this test is too long to be included.
22 Assert statement JUnit provides sta)c methods in the Assert class to test for certain condi)ons. These asser-on methods typically start with assert and allow you to specify the error message the expected result the actual result. An asser-on method compares the actual value returned by a test to the expected value, and throws an Asser)onExcep)on if the comparison test fails.
23 Assert statement fail(string): Let the method fail. Might be used to check that a certain part of the code is not reached. Or to have a failing test before the test code is implemented. The String parameter is op)onal. asserttrue([message], boolean condi)on): Checks that the boolean condi)on is true. assertfalse([message], boolean condi)on): Checks that the boolean condi)on is false.
24 Assert statement assertequals([string message], expected, actual): Tests that two values are the same. Note: for arrays the reference is checked not the content of the arrays. assertequals([string message], expected, actual, tolerance) : Test that float or double values match. The tolerance is the number of decimals which must be the same.
25 Assert statement assertnull([message], object) Checks that the object is null. assertnotnull([message], object) Checks that the object is not null. assertsame([string], expected, actual) Checks that both variables refer to the same object. assertnotsame([string], expected, actual) Checks that both variables refer to different objects.
26 BEST PRACTICES
27 Unit Test Best Prac)ces 1. Consistent 2. Atomic 3. Single Responsibility 4. Self- descrip)ve 5. No condi)onal logic or loops 6. No excep)on handling 7. Informa)ve Asser)on messages 8. No test logic in produc)on code 9. Separa)on per business module 10. Separa)on per type
28 Consistent Mul)ple runs of the test should consistently return true or consistently return false, provided no changes were made on code Code that can cause problems: Dim currentdate as Date = Now() Dim value as Integer = New Random().Next
29 Unit Test Best Prac)ces 1. Consistent 2. Atomic 3. Single Responsibility 4. Self- descrip)ve 5. No condi)onal logic or loops 6. No excep)on handling 7. Informa)ve Asser)on messages 8. No test logic in produc)on code 9. Separa)on per business module 10. Separa)on per type
30 Atomic Only two possible results: PASS or FAIL No par)ally successful tests. Isola)on of tests: Different execu)on order must yield same results. Test B should not depend on outcome of Test A Use Mocks instead.
31 Unit Test Best Prac)ces 1. Consistent 2. Atomic 3. Single Responsibility 4. Self- descrip)ve 5. No condi)onal logic or loops 6. No excep)on handling 7. Informa)ve Asser)on messages 8. No test logic in produc)on code 9. Separa)on per business module 10. Separa)on per type
32 Single Responsibility One test should be responsible for one scenario only. Test behavior, not methods: One method, mul)ple behaviors à Mul)ple tests One behavior, mul)ple methods à One test
33 Single Responsibility Sub TestMethod() Assert.IsTrue(behavior1) Assert.IsTrue(behavior2) Assert.IsTrue(behavior3) End Sub Sub TestMethodCheckBehavior1() Assert.IsTrue(behavior1) End Sub Sub TestMethodCheckBehavior2() Assert.IsTrue(behavior2) End Sub Sub TestMethodCheckBehavior3() Assert.IsTrue(behavior3) End Sub
34 Unit Test Best Prac)ces 1. Consistent 2. Atomic 3. Single Responsibility 4. Self- descriplve 5. No condi)onal logic or loops 6. No excep)on handling 7. Informa)ve Asser)on messages 8. No test logic in produc)on code 9. Separa)on per business module 10. Separa)on per type
35 Self Descrip)ve Unit test must be easy to read and understand Variable Names Method Names Class Names No condi)onal logic No loops Self descrip)ve Name tests to represent PASS condi)ons: Public Sub CanMakeReserva)on() Public Sub TotalBillEqualsSumOfMenuItemPrices()
36 Unit Test Best Prac)ces 1. Consistent 2. Atomic 3. Single Responsibility 4. Self- descrip)ve 5. No condilonal logic or loops 6. No excep)on handling 7. Informa)ve Asser)on messages 8. No test logic in produc)on code 9. Separa)on per business module 10. Separa)on per type
37 No condi)onal logic or loops Test should have no uncertainty: All inputs should be known Method behavior should be predictable Expected output should be strictly defined Split in to two tests rather than using If or Case Tests should not contain While, Do While or For loops. If test logic has to be repeated, it probably means the test is too complicated. Call method mul)ple )mes rather than looping inside of method.
38 No condi)onal logic or loops Sub TestBeforeOrAfter() If before Then Assert.IsTrue(behavior1) ElseIf after Then Else Assert.IsTrue(behavior2) Assert.IsTrue(behavior3) End If End Sub Sub TestBefore() Dim before as Boolean = true Assert.IsTrue(behavior1) End Sub Sub TestAfter() Dim after as Boolean = true Assert.IsTrue(behavior2) End Sub Sub TestNow() Dim before as Boolean = false Dim after as Boolean = false Assert.IsTrue(behavior3) End Sub
39 No condi)onal logic or loops Sub Test() Dim result = mymethod(param); If result Then Assert.IsTrue(myMethod_A) Else Then Assert.IsTrue(myMethod_B) End If End Sub Sub TestBehavior1 () Dim result = mymethod(param1); Assert.IsTrue(result) Assert.IsTrue(myMethod_A) End Sub Sub TestBehavior2 () Dim result = mymethod(param2); Assert.IsFalse(result) Assert.IsTrue(myMethod_B) End Sub
40 Unit Test Best Prac)ces 1. Consistent 2. Atomic 3. Single Responsibility 4. Self- descrip)ve 5. No condi)onal logic or loops 6. No exceplon handling 7. Informa)ve Asser)on messages 8. No test logic in produc)on code 9. Separa)on per business module 10. Separa)on per type
41 No Excep)on Handling Indicate expected excep)on with azribute. Catch only the expected type of excep)on. Fail test if expected excep)on is not caught. Let other excep)ons go uncaught.
42 No Excep)on Handling <ExpectedException( MyException )> _ Sub TestException() mymethod(parameter) Assert.Fail( MyException expected. ) End Sub
43 Unit Test Best Prac)ces 1. Consistent 2. Atomic 3. Single Responsibility 4. Self- descrip)ve 5. No condi)onal logic or loops 6. No excep)on handling 7. InformaLve AsserLon messages 8. No test logic in produc)on code 9. Separa)on per business module 10. Separa)on per type
44 Informa)ve Asser)on Messages By reading the asser)on message, one should know why the test failed and what to do. Include business logic informa)on in the asser)on message (such as input values, etc.) Good asser)on messages: Improve documenta)on of the code, Inform developers about the problem if the test fails.
45 Unit Test Best Prac)ces 1. Consistent 2. Atomic 3. Single Responsibility 4. Self- descrip)ve 5. No condi)onal logic or loops 6. No excep)on handling 7. Informa)ve Asser)on messages 8. No test logic in produclon code 9. Separa)on per business module 10. Separa)on per type
46 No test logic in Produc)on Code Separate Unit tests and Produc)on code in separate projects. Do not create Methods or Proper)es used only by unit tests. Use Dependency Injec)on or Mocks to isolate Produc)on code.
47 Unit Test Best Prac)ces 1. Consistent 2. Atomic 3. Single Responsibility 4. Self- descrip)ve 5. No condi)onal logic or loops 6. No excep)on handling 7. Informa)ve Asser)on messages 8. No test logic in produc)on code 9. SeparaLon per business module 10. Separa)on per type
48 Separa)on per Business Module Create separate test project for every layer or assembly Decrease execu)on )me of test suites by splivng in to smaller suites Suite I - All Factories Suite II - All Controllers Smaller Suites can be executed more frequently
49 Unit Test Best Prac)ces 1. Consistent 2. Atomic 3. Single Responsibility 4. Self- descrip)ve 5. No condi)onal logic or loops 6. No excep)on handling 7. Informa)ve Asser)on messages 8. No test logic in produc)on code 9. Separa)on per business module 10.SeparaLon per type
50 Separa)on per Type Align Test Fixtures with type defini)ons. Reminder: Unit tests are separate from integra)on tests! Different purpose Different frequency Different )me of execu)on Different ac)on in case of failure
51 MOCK OBJECT
52 TesLng with stub and mock objects A unit test should test a class in isola)on but Java classes usually depend on other classes.
53 TesLng with stub and mock objects A unit test should test a class in isola)on but Java classes usually depend on other classes. Solu)on: you can use stubs or mock objects.
54 TesLng with stub and mock objects A tested object usually talks to other objects known as collaborators. To make unit tes)ng simpler, it is useful to replace the real coopera)ng objects with their fake replacements called test doubles. Test doubles can also be easily programmed with specific expecta)ons, such as recording any interac)ons they've had.
55 Test doubles Dummy - an empty object passed in an invoca)on (usually only to sa)sfy a compiler when a method argument is required) Stub - an object with hardcoded behavior suitable for a given test (or a group of tests) Mock - an object with the ability to have a programmed expected behavior, and verify the interac)ons occurring in its life)me (this object is usually created with the help of mocking framework) Spy - a mock created as a proxy to an exis)ng real object; some methods can be stubbed, while the un- stubbed ones are forwarded to the covered object
56 Stub vs. mock objects A stub class is an implementa)on for an interface or class with the purpose of using an instance of this stub class during tes)ng. Require a custom implementa)on A mock object is a dummy implementa)on for an interface or a class in which you define the output of certain method calls. are typically configured require less code to configure
57 Stub vs. mock objects Stub and mock objects can be passed to other objects which are tested. Your tests can validate that the class reacts correctly during tests, i.e., you can validate if certain methods on the mock object were called. This helps to ensure that you only test the class while running tests and that your tests are not affected by any side effects.
58 Mock object generalon You can create these mock objects manually (via code) or use a mock framework. The classical example for a mock object is a data provider. Mock objects can be provided to the class which is tested. Therefore the class to be tested should avoid any hard dependency on external data. Mock frameworks also allow to test the expected interac)on with the mock object.
59 Mock frameworks EasyMock jmock Mockito
60 MOCKITO
61 public interface ITranslator {!! public abstract String translate!!!(string fromlanguage, String tolanguage,!!!string word);! }!
62 public class Greeting {!! private ITranslator translator;!!! public Greeting(ITranslator translator){! this.translator = translator;! }!! public String sayhello!!!!!(string language, String name){!!!!string t = translator.translate!!!!!("english", language, "Hello");!!!!t = t + " " + name;!!!!return t;! }! }!
63 public void shouldtestgreetinginitalian(){! //setup! ITranslator mocktranslator =!!!!!mock(itranslator.class);! Greeting greeting =!!!!!new Greeting(mockTranslator);!!!!!when(mockTranslator.translate!!!!!("English", "Italian", "Hello")).!!!!!thenReturn("Ciao");!!!//execute!!!!String result =!!!!!greeting.sayhello("italian", Pippo );!! assertequals("ciao Pippo,result);!!!!//verify! verify(mocktranslator).translate!!!!!("english", "Italian", "Hello");! }!
64 TEST DRIVEN DESIGN
65 Unit Tes)ng vs. Test Driven Design
66 Unit Tes)ng vs. Test Driven Design Unit TesLng is the prac)ce of tes)ng your own code to understand whether it behaves the way you want or not.
67 Unit Tes)ng vs. Test Driven Design Unit TesLng is the prac)ce of tes)ng your own code to understand whether it behaves the way you want or not. Test Driven Design (TDD) is the discipline of using "Unit Tes)ng" when you design the sokware.
68 Bibliografy hzp://junit.sourceforge.net hzp://people.cs.aau.dk/~bnielsen/tov08/lek)oner/unit- intro.pdf hzp:// hzp:// tes)ng- concepts- and- best- prac)ces hzp:// tes)ng- best- prac)ces hzp://en.wikipedia.org/wiki/xunit hzp://code.google.com/p/mockito/ hzp:// hzp://refcardz.dzone.com/refcardz/mockito
69 Tutorials hzp:// ar)cle.html hzp://courses.cs.washington.edu/courses/ cse143/11wi/eclipse- tutorial/junit.shtml hzp:// tutorials- and- example/
Test-Driven Development JUnit
Test-Driven Development JUnit Click to edit Master EECS text 2311 styles - Software Development Project Second level Third level Fourth level Fifth level Wednesday, January 24, 2018 1 Unit Testing Testing
More informationIntroduction to Automated Unit Testing (xunit) Brian Nielsen Arne Skou
Introduction to Automated Unit Testing (xunit) Brian Nielsen Arne Skou {bnielsen ask}@cs.aau.dk Conventional Test Execution Ad hoc manner Manual stimulation & observation E.g. adding a function to a module,
More informationTest-Driven Development JUnit
Test-Driven Development JUnit Click to edit Master EECS text 2311 styles - Software Development Project Second level Third level Fourth level Fifth level Wednesday, January 18, 2017 1 Simulator submission
More informationTest automation / JUnit. Building automatically repeatable test suites
Test automation / JUnit Building automatically repeatable test suites Test automation n Test automation is software that automates any aspect of testing n Generating test inputs and expected results n
More informationTest automation Test automation / JUnit
Test automation Test automation / JUnit Building automatically repeatable test suites Test automation is software that automates any aspect of testing Generating test inputs and expected results Running
More informationTest suites Obviously you have to test your code to get it working in the first place You can do ad hoc testing (testing whatever occurs to you at
JUnit Test suites Obviously you have to test your code to get it working in the first place You can do ad hoc testing (testing whatever occurs to you at the moment), or You can build a test suite (a thorough
More informationJUnit Framework. Terminology: assertions, annotations, fixtures. Dr. Siobhán Drohan Mairead Meagher. Produced by:
JUnit Framework Terminology: assertions, annotations, fixtures Produced by: Dr. Siobhán Drohan Mairead Meagher Department of Computing and Mathematics http://www.wit.ie/ Topic List General Terminology
More informationProgrammieren II. Unit Testing & Test-Driven Development. Alexander Fraser.
Programmieren II Unit Testing & Test-Driven Development Alexander Fraser fraser@cl.uni-heidelberg.de (Based on material from Lars Vogel and T. Bögel) July 2, 2014 1 / 62 Outline 1 Recap 2 Testing - Introduction
More informationEECS 4313 Software Engineering Testing
EECS 4313 Software Engineering Testing Topic 03: Test automation / JUnit - Building automatically repeatable test suites Zhen Ming (Jack) Jiang Acknowledgement Some slides are from Prof. Alex Orso Relevant
More informationSection 4: Graphs and Testing
Section 4: Graphs and Testing Slides by Erin Peach and Nick Carney with material from Vinod Rathnam, Alex Mariakakis, Krysta Yousoufian, Mike Ernst, Kellen Donohue AGENDA Graphs JUnit Testing Test Script
More informationIntroduc)on to tes)ng with JUnit. Workshop 3
Introduc)on to tes)ng with JUnit Workshop 3 We have to deal with errors Early errors are usually syntax errors. The compiler will spot these. Later errors are usually logic errors. The compiler cannot
More informationTools for Unit Test - JUnit
Tools for Unit Test - JUnit Conrad Hughes School of Informatics Slides thanks to Stuart Anderson 15 January 2010 Software Testing: Lecture 2 1 JUnit JUnit is a framework for writing tests Written by Erich
More informationUnit Testing. SWEN-610 Foundations of Software Engineering. Department of Software Engineering Rochester Institute of Technology
Unit Testing SWEN-610 Foundations of Software Engineering Department of Software Engineering Rochester Institute of Technology There are many levels of software testing. The developer of the software has
More informationProofs about Programs
Proofs about Programs Program Verification (Rosen, Sections 5.5) TOPICS Program Correctness Preconditions & Postconditions Program Verification Assignment Statements Conditional Statements Loops Composition
More informationTuesday, November 15. Testing
Tuesday, November 15 1 Testing Testing Waterfall model show testing as an activity or box In practice, testing is performed constantly There has never been a project where there was too much testing. Products
More informationCISC327 - So*ware Quality Assurance. Lecture 13 Black Box Unit
CISC327 - So*ware Quality Assurance Lecture 13 Black Box Unit Tes@ng Black Box Unit Tes@ng Black box method tes@ng Test harnesses Role of code- level specifica@ons (asser@ons) Automa@ng black box unit
More informationTools for Unit Test JUnit
Tools for Unit Test JUnit Stuart Anderson JUnit is a framework for writing tests JUnit 1 Written by Erich Gamma (Design Patterns) and Kent Beck (extreme Programming) JUnit uses Java s reflection capabilities
More information10/7/15. MediaItem tostring Method. Objec,ves. Using booleans in if statements. Review. Javadoc Guidelines
Objec,ves Excep,ons Ø Wrap up Files Streams MediaItem tostring Method public String tostring() { String classname = getclass().tostring(); StringBuilder rep = new StringBuilder(classname); return rep.tostring();
More informationUnit Testing & Testability
CMPT 473 Software Quality Assurance Unit Testing & Testability Nick Sumner - Fall 2014 Levels of Testing Recall that we discussed different levels of testing for test planning: Unit Tests Integration Tests
More informationAgenda. Excep,ons Object oriented Python Library demo: xml rpc
Agenda Excep,ons Object oriented Python Library demo: xml rpc Resources h?p://docs.python.org/tutorial/errors.html h?p://docs.python.org/tutorial/classes.html h?p://docs.python.org/library/xmlrpclib.html
More informationJUnit in EDA Introduction. 2 JUnit 4.3
Lunds tekniska högskola Datavetenskap, Nov 25, 2010 Görel Hedin EDA260 Programvaruutveckling i grupp projekt Labb 3 (Test First): Bakgrundsmaterial JUnit in EDA260 1 Introduction The JUnit framework is
More informationUnit Tes2ng Ac2vity. SWEN-261 Introduc2on to So3ware Engineering. Department of So3ware Engineering Rochester Ins2tute of Technology
Unit Tes2ng Ac2vity SWEN-261 Introduc2on to So3ware Engineering Department of So3ware Engineering Rochester Ins2tute of Technology Your activity for the Unit Testing lesson is to build tests for existing
More informationAutoma'c Test Genera'on
Automa'c Test Genera'on First, about Purify Paper about Purify (and PurifyPlus) posted How do you monitor reads and writes: insert statements before and a?er reads, writes in code can s'll be done with
More informationIntroduction to Software Engineering: Tools and Environments. Session 5. Oded Lachish
Introduction to Software Engineering: Tools and Environments Session 5 Oded Lachish Room: Mal 405 Visiting Hours: Wednesday 17:00 to 20:00 Email: oded@dcs.bbk.ac.uk Module URL: http://www.dcs.bbk.ac.uk/~oded/tools2012-2013/web/tools2012-2013.html
More informationSo#ware Tes+ng. See also Sommerville, Chapter 8 Amman and Offut, Introduc)on to So,ware Tes)ng, Cambridge University Press, 2008.
So#ware Tes+ng See also Sommerville, Chapter 8 Amman and Offut, Introduc)on to So,ware Tes)ng, Cambridge University Press, 2008. Tes+ng Most basic form of post- hoc SQA Helps define program func+onality
More informationCSE332: Data Abstrac0ons Sec%on 3
CSE332: Data Abstrac0ons Sec%on 3 Nicholas Shahan Winter 2015 Adapted from slides by Hye In Kim Today Announcements Ques%ons? WriDen HW1 Grading Example Project 2 Tips Junit Generics Inheritance Comparators
More informationDesign Principles & Prac4ces
Design Principles & Prac4ces Robert France Robert B. France 1 Understanding complexity Accidental versus Essen4al complexity Essen%al complexity: Complexity that is inherent in the problem or the solu4on
More informationThinking Induc,vely. COS 326 David Walker Princeton University
Thinking Induc,vely COS 326 David Walker Princeton University slides copyright 2017 David Walker permission granted to reuse these slides for non-commercial educa,onal purposes Administra,on 2 Assignment
More informationSQLite with a Fine-Toothed Comb. John Regehr Trust-in-So1 / University of Utah
SQLite with a Fine-Toothed Comb John Regehr Trust-in-So1 / University of Utah Feasible states for a system we care about No execu
More informationLecture 3. Black- box Tes3ng
Lecture 3 Black- box Tes3ng Black- box Tes3ng Test cases are constructed without reference to the code structure + Can test the requirements not the code + Can overcome combinatorial explosions + Complementary
More informationRemedial Java - Excep0ons 3/09/17. (remedial) Java. Jars. Anastasia Bezerianos 1
(remedial) Java anastasia.bezerianos@lri.fr Jars Anastasia Bezerianos 1 Disk organiza0on of Packages! Packages are just directories! For example! class3.inheritancerpg is located in! \remedialjava\src\class3\inheritencerpg!
More informationTest automation / JUnit. Building automatically repeatable test suites
Test automation / JUnit Building automatically repeatable test suites JUnit in Eclipse For this course, we will use JUnit in Eclipse It is automatically a part of Eclipse One documentation site (all one
More informationFounda'ons of So,ware Engineering. Lecture 11 Intro to QA, Tes2ng Claire Le Goues
Founda'ons of So,ware Engineering Lecture 11 Intro to QA, Tes2ng Claire Le Goues 1 Learning goals Define so;ware analysis. Reason about QA ac2vi2es with respect to coverage and coverage/adequacy criteria,
More informationCSc 120. Introduc/on to Computer Programming II. 02: Problem Decomposi1on and Program Development. Adapted from slides by Dr.
CSc 120 Introduc/on to Computer Programming II Adapted from slides by Dr. Saumya Debray 02: Problem Decomposi1on and Program Development A common student lament "I have this big programming assignment.
More informationTEST DRIVEN DEVELOPMENT
PERSONAL SOFTWARE ENGINEERING PROJECT: TEST DRIVEN DEVELOPMENT Kirsi Männistö kirsi.mannisto@welho.com 60114V PSEA_Test_driven_development.rtf Page 1 of 1 RoadRunners Change history Version Description
More informationCISC327 - So*ware Quality Assurance
CISC327 - So*ware Quality Assurance Lecture 8 Introduc
More informationProgram Verification (Rosen, Sections 5.5)
Program Verification (Rosen, Sections 5.5) TOPICS Program Correctness Preconditions & Postconditions Program Verification Assignments Composition Conditionals Loops Proofs about Programs Why study logic?
More informationInstructor: Randy H. Katz hap://inst.eecs.berkeley.edu/~cs61c/fa13. Fall Lecture #7. Warehouse Scale Computer
CS 61C: Great Ideas in Computer Architecture Everything is a Number Instructor: Randy H. Katz hap://inst.eecs.berkeley.edu/~cs61c/fa13 9/19/13 Fall 2013 - - Lecture #7 1 New- School Machine Structures
More informationCOSC 310: So*ware Engineering. Dr. Bowen Hui University of Bri>sh Columbia Okanagan
COSC 310: So*ware Engineering Dr. Bowen Hui University of Bri>sh Columbia Okanagan 1 Admin A2 is up Don t forget to keep doing peer evalua>ons Deadline can be extended but shortens A3 >meframe Labs This
More informationJava. Package, Interface & Excep2on
Java Package, Interface & Excep2on Package 2 Package Java package provides a mechanism for par55oning the class name space into more manageable chunks Both naming and visibility control mechanism Define
More informationSoftware Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore
Software Testing Prof. Meenakshi D Souza Department of Computer Science and Engineering International Institute of Information Technology, Bangalore Lecture 04 Software Test Automation: JUnit as an example
More informationVulnerability Analysis (III): Sta8c Analysis
Computer Security Course. Vulnerability Analysis (III): Sta8c Analysis Slide credit: Vijay D Silva 1 Efficiency of Symbolic Execu8on 2 A Sta8c Analysis Analogy 3 Syntac8c Analysis 4 Seman8cs- Based Analysis
More informationUnit Testing Activity
Unit Testing Activity SWEN-261 Introduction to Software Engineering Department of Software Engineering Rochester Institute of Technology Your activity for the Unit Testing lesson is to build tests for
More informationFunctional Testing (Testování funkčnosti)
Functional Testing (Testování funkčnosti) http://d3s.mff.cuni.cz Pavel Parízek parizek@d3s.mff.cuni.cz CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Nástroje pro vývoj software Functional
More informationDesign and Debug: Essen.al Concepts Numerical Conversions CS 16: Solving Problems with Computers Lecture #7
Design and Debug: Essen.al Concepts Numerical Conversions CS 16: Solving Problems with Computers Lecture #7 Ziad Matni Dept. of Computer Science, UCSB Announcements We are grading your midterms this week!
More informationUnit Testing. CS 240 Advanced Programming Concepts
Unit Testing CS 240 Advanced Programming Concepts F-22 Raptor Fighter 2 F-22 Raptor Fighter Manufactured by Lockheed Martin & Boeing How many parts does the F-22 have? 3 F-22 Raptor Fighter What would
More informationSept 26, 2016 Sprenkle - CSCI Documentation is a love letter that you write to your future self. Damian Conway
Objec,ves Javadocs Inheritance Ø Final methods, fields Abstract Classes Interfaces Sept 26, 2016 Sprenkle - CSCI209 1 JAVADOCS Documentation is a love letter that you write to your future self. Damian
More informationTest Execution and Automation. CSCE Lecture 15-03/20/2018
Test Execution and Automation CSCE 747 - Lecture 15-03/20/2018 Executing Tests We ve covered many techniques to derive test cases. How do you run them on the program? You could run the code and check results
More informationLecture 2. White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2)
Lecture 2 White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2) White- box Tes2ng (aka. Glass- box or structural tes2ng) An error may exist at one (or more) loca2on(s) Line numbers
More informationAdvantage: high portability, low cost, and easy integra.on with external systems. It was wriien using the C programming language.
Tutorial 2 Introduc.on to CLIPS CLIPS (C Language Integrated Produc.on System): A programming language designed by NASA/Johnson Space Center. Advantage: high portability, low cost, and easy integra.on
More informationcsc444h: so(ware engineering I matt medland
csc444h: so(ware engineering I matt medland matt@cs.utoronto.ca http://www.cs.utoronto.ca/~matt/csc444 tes2ng top- 10 infrastructure source code control including other types of testing reproducible builds
More informationTopics covered. Introduction to JUnit JUnit: Hands-on session Introduction to Mockito Mockito: Hands-on session. JUnit & Mockito 2
JUnit & Mockito 1 Topics covered Introduction to JUnit JUnit: Hands-on session Introduction to Mockito Mockito: Hands-on session JUnit & Mockito 2 Introduction to JUnit JUnit & Mockito 3 What is JUnit?
More informationAgile Software Development. Lecture 7: Software Testing
Agile Software Development Lecture 7: Software Testing Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Slides are a modified version of the slides by Prof. Kenneth M. Anderson Outline Testing Terminology Types
More informationEncapsula)on CMSC 202
Encapsula)on CMSC 202 Types of Programmers Class creators Those developing new classes Want to build classes that expose the minimum interface necessary for the client program and hide everything else
More informationWhite-box testing. Software Reliability and Testing - Barbara Russo SERG - Laboratory of Empirical Software Engineering.
White-box testing Software Reliability and Testing - Barbara Russo SERG - Laboratory of Empirical Software Engineering Barbara Russo 1 White-box testing White-box testing is a verification technique that
More informationPreliminary ACTL-SLOW Design in the ACS and OPC-UA context. G. Tos? (19/04/2016)
Preliminary ACTL-SLOW Design in the ACS and OPC-UA context G. Tos? (19/04/2016) Summary General Introduc?on to ACS Preliminary ACTL-SLOW proposed design Hardware device integra?on in ACS and ACTL- SLOW
More informationHomework 1 Simple code genera/on. Luca Della Toffola Compiler Design HS15
Homework 1 Simple code genera/on Luca Della Toffola Compiler Design HS15 1 Administra1ve issues Has everyone found a team- mate? Mailing- list: cd1@lists.inf.ethz.ch Please subscribe if we forgot you 2
More informationAgenda. JUnit JaCoCo Project. CSE 4321, Jeff Lei, UTA
Agenda JUnit JaCoCo Project 1 JUnit Introduction A JUnit Example Major APIs Practical Tips 2 Unit Testing Test individual units of source code in isolation Procedures, functions, methods, and classes Engineers
More informationIntroduction to JUnit
Introduction to JUnit Minsoo Ryu Hanyang University History Kent Beck developed the first xunit automated test tool for Smalltalk in mid-90 s Beck and Gamma (of design patterns Gang of Four) developed
More informationLecture 4: Build Systems, Tar, Character Strings
CIS 330:! / / / / (_) / / / / _/_/ / / / / / \/ / /_/ / `/ \/ / / / _/_// / / / / /_ / /_/ / / / / /> < / /_/ / / / / /_/ / / / /_/ / / / / / \ /_/ /_/_/_/ _ \,_/_/ /_/\,_/ \ /_/ \ //_/ /_/ Lecture 4:
More informationCSE332: Data Abstrac0ons Sec%on 3. HyeIn Kim CSE 331 Slides (JUnit/Javadoc) Spring2014
CSE332: Data Abstrac0ons Sec%on 3 HyeIn Kim CSE 331 Slides (JUnit/Javadoc) Spring2014 Section Agenda Project 2: Shake-n-Bacon - More Generics - Comparator - Inheritance review - Iterator / Anonymous class
More informationProgramming Languages and Techniques (CIS120)
Programming Languages and Techniques (CIS120) Lecture 36 April 23, 2014 Overriding and Equality HW 10 has a HARD deadline Announcements You must submit by midnight, April 30 th Demo your project to your
More informationAn introduction to formal specifications and JML. Invariant properties
An introduction to formal specifications and JML Invariant properties Yves Ledru Université Grenoble-1 Laboratoire d Informatique de Grenoble Yves.Ledru@imag.fr 2013 Page 1 Invariant properties Invariants
More informationques4ons? Midterm Projects, etc. Path- Based Sta4c Analysis Sta4c analysis we know Example 11/20/12
Midterm Grades and solu4ons are (and have been) on Moodle The midterm was hard[er than I thought] grades will be scaled I gave everyone a 10 bonus point (already included in your total) max: 98 mean: 71
More informationDebugging. BBM Introduc/on to Programming I. Hace7epe University Fall Fuat Akal, Aykut Erdem, Erkut Erdem, Vahid Garousi
Debugging BBM 101 - Introduc/on to Programming I Hace7epe University Fall 2015 Fuat Akal, Aykut Erdem, Erkut Erdem, Vahid Garousi Slides based on material prepared by Ruth Anderson, Michael Ernst and Bill
More informationCondi(onals and Loops
Condi(onals and Loops 1 Review Primi(ve Data Types & Variables int, long float, double boolean char String Mathema(cal operators: + - * / % Comparison: < > = == 2 A Founda(on for Programming any program
More informationCSE332: Data Abstrac0ons Sec%on 4. HyeIn Kim CSE 331 Slides Spring 2013
CSE332: Data Abstrac0ons Sec%on 4 HyeIn Kim CSE 331 Slides Spring 2013 Section Agenda Project 2: Shake-n-Bacon - More Generics - Comparator - Inheritance review - Iterator / Anonymous class - JUnit Testing
More informationObject Oriented Software Design - I
Object Oriented Software Design - I Unit Testing Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa November 28, 2011 G. Lipari (Scuola Superiore Sant Anna) Unit Testing November
More informationArchitecture of So-ware Systems RMI and Distributed Components. Mar<n Rehák
Architecture of So-ware Systems RMI and Distributed Components Mar
More informationDocumen(ng code, Javadoc, Defensive Programming, Asserts, Excep(ons & Try/Catch
Documen(ng code, Javadoc, Defensive Programming, Asserts, Excep(ons & Try/Catch 1 Most important reason to comment A) To summarize the code B) To explain how the code works C) To mark loca(ons that need
More informationMore Course Overview: Models, Tests, Bugs, and Symbols
Some logis@cs More Course Overview: Models, Tests, Bugs, and Symbols Everyone who wants to be registered is, right? Homework 1 will be posted tonight or tomorrow Due September 29, by 9 AM on moodle Requires
More informationChapter 2 NUnit Fundamentals
Chapter 2 NUnit Fundamentals Rev. 4.7 Copyright 2015 Object Innovations Enterprises, LLC 35 NUnit Fundamentals Objectives After completing this unit you will be able to: Describe the general structure
More informationUnit testing basics & more...
Unit testing basics & more... by Papapetrou P.Patroklos Twitter hashtag : Thessaloniki Java Meetup - December 2014 Agenda Unit testing introduction Differences with other types of tests Key concepts Rules
More informationObjec&ves. Servlets Review JSPs Web Applica&on Organiza&on Version Control. May 3, 2016 Sprenkle - CS335 1
Objec&ves Servlets Review JSPs Web Applica&on Organiza&on Version Control May 3, 2016 Sprenkle - CS335 1 Servlets Review How do we access a servlet s init parameter? Why do we use init parameters? Where
More informationCISC327 - So*ware Quality Assurance
CISC327 - So*ware Quality Assurance Lecture 12 Black Box Tes?ng CISC327-2003 2017 J.R. Cordy, S. Grant, J.S. Bradbury, J. Dunfield Black Box Tes?ng Outline Last?me we con?nued with black box tes?ng and
More informationArray Basics: Outline
Array Basics: Outline More Arrays (Savitch, Chapter 7) TOPICS Array Basics Arrays in Classes and Methods Programming with Arrays Searching and Sorting Arrays Multi-Dimensional Arrays Static Variables and
More informationDouble Objects. Mariana Bravo Translation: Paulo Cheque. Summer 2009
Double Objects Mariana Bravo marivb@agilcoop.org.br Translation: Paulo Cheque Summer 2009 License: Creative Commons: Attribution-Share Alike 3.0 Unported http://creativecommons.org/licenses/by-sa/3.0/
More informationClasses & Objects CMSC 202
Classes & Objects CMSC 202 Programming & Abstrac9on All programming languages provide some form of abstrac'on Also called informa'on hiding Separa9ng how one uses a program and how the program has been
More informationArray Basics: Outline
Array Basics: Outline More Arrays (Savitch, Chapter 7) TOPICS Array Basics Arrays in Classes and Methods Programming with Arrays Searching and Sorting Arrays Multi-Dimensional Arrays Static Variables and
More informationReview. Asser%ons. Some Per%nent Ques%ons. Asser%ons. Page 1. Automated Tes%ng. Path- Based Tes%ng. But s%ll need to look at execu%on results
Review Asser%ons Computer Science 521-621 Fall 2011 Prof. L. J. Osterweil Material adapted from slides originally prepared by Prof. L. A. Clarke Dynamic Tes%ng Execute program on real data and compare
More informationLecture 2. White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2)
Lecture 2 White- box Tes2ng and Structural Coverage (see Amman and Offut, Chapter 2) White- box Tes2ng (aka. Glass- box or structural tes2ng) An error may exist at one (or more) loca2on(s) Line numbers
More informationProgramming Environments
Programming Environments There are several ways of crea/ng a computer program Using an Integrated Development Environment (IDE) Using a text editor You should use the method you are most comfortable with.
More informationF.P. Brooks, No Silver Bullet: Essence and Accidents of Software Engineering CIS 422
The hardest single part of building a software system is deciding precisely what to build. No other part of the conceptual work is as difficult as establishing the detailed technical requirements...no
More informationhttps://www.lri.fr/ linaye/gl.html
Software Engineering https://www.lri.fr/ linaye/gl.html lina.ye@centralesupelec.fr Sequence 3, 2017-2018 1/61 Software Engineering Plan 1 2 3 4 5 2/61 Software Engineering Software Testing 3/61 Software
More informationCompila(on /15a Lecture 6. Seman(c Analysis Noam Rinetzky
Compila(on 0368-3133 2014/15a Lecture 6 Seman(c Analysis Noam Rinetzky 1 You are here Source text txt Process text input characters Lexical Analysis tokens Annotated AST Syntax Analysis AST Seman(c Analysis
More informationCOMP 111. Introduction to Computer Science and Object-Oriented Programming. Week 3
COMP 111 Introduction to Computer Science and Object-Oriented Programming Tasks and Tools download submit edit Web-CAT compile unit test view results Working with Java Classes You Use You Complete public
More informationEncapsula)on, cont d. Polymorphism, Inheritance part 1. COMP 401, Spring 2015 Lecture 7 1/29/2015
Encapsula)on, cont d. Polymorphism, Inheritance part 1 COMP 401, Spring 2015 Lecture 7 1/29/2015 Encapsula)on In Prac)ce Part 2: Separate Exposed Behavior Define an interface for all exposed behavior In
More informationProgramming Languages and Techniques (CIS120)
Programming Languages and Techniques (CIS120) Lecture 20 Feb 29, 2012 Transi@on to Java II DON T PANIC Smoothing the transi@on Eclipse set- up instruc@ons in lab today/tomorrow First Java homework assignment
More informationFounda'ons of So,ware Engineering. Sta$c analysis (1/2) Claire Le Goues
Founda'ons of So,ware Engineering Sta$c analysis (1/2) Claire Le Goues 1 Two fundamental concepts Abstrac'on. Elide details of a specific implementa$on. Capture seman$cally relevant details; ignore the
More informationArray Basics: Outline
Array Basics: Outline More Arrays (Savitch, Chapter 7) TOPICS Array Basics Arrays in Classes and Methods Programming with Arrays Searching and Sorting Arrays Multi-Dimensional Arrays Static Variables and
More informationGarbage collec,on Parameter passing in Java. Sept 21, 2016 Sprenkle - CSCI Assignment 2 Review. public Assign2(int par) { onevar = par; }
Objec,ves Inheritance Ø Overriding methods Garbage collec,on Parameter passing in Java Sept 21, 2016 Sprenkle - CSCI209 1 Assignment 2 Review private int onevar; public Assign2(int par) { onevar = par;
More informationPhilosophy of Unit Testing
Unit Testing in.net Philosophy of Unit Testing What? Where? Why? How? What it is not? Test individual components (units) in isolation isolate and validate verify to confirm preexisting specification. Inputs
More informationBEGINNING ios PROGRAMMING
BEGINNING ios PROGRAMMING GEORGIA TECH RESEARCH NETWORK OPERATIONS CENTER (RNOC) *slides are based on the presentations by Professor Russell J Clark and Brian Davidson Swi$ Objec+ve- C OPTIONS RubyMo+on
More informationxtreme Programming (summary of Kent Beck s XP book) Stefan Resmerita, WS2015
xtreme Programming (summary of Kent Beck s XP book) 1 Contents The software development problem The XP solution The JUnit testing framework 2 The Software Development Problem 3 Risk Examples delivery schedule
More informationCSCE 747 Unit Testing Laboratory Name(s):
CSCE 747 Unit Testing Laboratory Name(s): You have been hired to test our new calendar app! Congrats!(?) This program allows users to book meetings, adding those meetings to calendars maintained for rooms
More informationReturn Values SECTION /26/16 Page 33
Return Values SECTION 5.4 9/26/16 Page 33 Return Values Func%ons can (op%onally) return one value Add a return statement that returns a value A return statement does two things: 1) Immediately terminates
More informationCharlie Garrod Michael Hilton
Principles of So3ware Construc9on: Objects, Design, and Concurrency Part 5: Concurrency Introduc9on to concurrency, part 2 Concurrency primi9ves, con9nued Charlie Garrod Michael Hilton School of Computer
More informationMacro Assembler. Defini3on from h6p://www.computeruser.com
The Macro Assembler Macro Assembler Defini3on from h6p://www.computeruser.com A program that translates assembly language instruc3ons into machine code and which the programmer can use to define macro
More informationWhy OO programming? want but aren t. Ø What are its components?
9/21/15 Objec,ves Assign 1 Discussion Object- oriented programming in Java Java Conven,ons: Ø Constructors Ø Default constructors Ø Sta,c methods, variables Ø Inherited methods Ø Class names: begin with
More informationUnit Testing and JUnit
Unit Testing and JUnit Moinul Hossain CS 791Z 03/02/2015 Outline What is Software Testing? What and Why Unit Testing? JUnit JUnit features and Examples Test Driven Development (TDD) What is Software Testing?
More information