Urnik – Unit testing, TDD DUnit, DUnit2, DUnitX, TestInsight – odmor – Unit testing v resničnem svetu, mocking.

Slides:



Advertisements
Similar presentations
JUnit Tutorial Hong Qing Yu Nov JUnit Tutorial The testing problems The framework of JUnit A case study JUnit tool Practices.
Advertisements

Mock junit framework uses pre- populated mock java objects instead of live database connection for executing the unit test cases.
What is Unit Testing? How TDD Works? Tsvyatko Konov Telerik Corporation
Unit and Functional Testing with JUnit and Related Tools Greg Barnes University of Washington
TEST-DRIVEN DEVELOPMENT Lecture 3. Definition Test-driven development (development through testing) is a technique of programming, in which the unit tests.
A) 80 b) 53 c) 13 d) x 2 = : 10 = 3, x 3 = 309.
George Blank University Lecturer. JUnit for Test Driven Development By Vivek Bhagat, George Blank.
A Unit Testing Framework: JUnit COMP 302 Software Engineering Koc University, Istanbul.
CZ Biz. Auto. System & Test-Driven Development Teoman Soygul (Sept 24, 2012).
© 2012 Autodesk Automated Testing with the AutoCAD ®.NET API Scott McFarlane Senior Software Engineer, Woolpert, Inc.
JUnit The framework. Goal of the presentation showing the design and construction of JUnit, a piece of software with proven value.
Spring core v3.x Prepared by: Nhan Le. History v3.0 Spring Expression Language Java based bean metadata v3.1 Cache Abstraction Bean Definition Profile.
Miha Pihler MCSA, MCSE, MCT, CISSP, Microsoft MVP
ATTRIBUTES AND RTTI CODE FASTER!. ATTRIBUTES “Attributes are a language feature in Delphi that allows annotating types and type members with special objects.
$100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300 $400 $500 $100 $200 $300.
PODPORA IKT PRI POUČEVANJU NARAVOSLOVNIH VSEBIN
© Craig Murphy Craig Murphy An Introduction to Test-Driven Development (TDD)
Uvod v C# Drugi del. Dedovanje Sintaksa Prirejanje in preverjanje tipov.
Dave Lloyd Unit Testing in the Real World.
1 EDUKACIJA BOLNIKOV pred uvedbo zdravila MAREVAN (tudi Sintrom) Alenka Mavri.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Testing Spring Applications Unit Testing.
S Ramakrishnan1 Systems V & V, Quality and Standards Dr Sita Ramakrishnan School CSSE Monash University.
Approaches to Automatically Testing Visual Components Richard B. Winston CPCUG Programmers SIG Nov. 1, 2006.
Organisations and Human Resources Research Centre Uporaba ADS podatkov v praksi (predavanja) Doc. dr. Miroljub Ignjatović februar 2014.
Pregled programa MED Nacionalni informativni dan ob prvem razpisu Ljubljana, 9. september 2015 mag. Nadja Kobe Služba Vlade RS za razvoj in.
Dependency injection Marko Tošić

1 JUnit. 2 Unit Testing with JUnit If code has no automated test case written for it to prove that it works, it must be assumed not to work. An API that.
Topic: Junit Presenters: Govindaramanujam, Sama & Jansen, Erwin.
Introduction to Inversion Of Control (IOC). IOC Definition (based on Wikipedia)  Consider the way in which an object obtains references to its dependencies.
Automated Testing with PHPUnit. How do you know your code works?
Installfest delavnica mag. Aleš Košir Lugos
6. poglavje: Računalniška vezja
Test Driven Development (TDD)
Unit testing Java programs Using JUnit
An Introduction to Test-Driven Development (TDD)
Programming I Packets and JAR 11th lecture.
MALE SIVE CELICE, RTV Slovenija
NEED FOR SPEED PRO STREET
Quick guide to moq Presenter: PhuongNQK.
UVOD V VIZUALNO PROGRAMIRANJE
Uvod v Python
Urnik – varno programiranje – odmor – napredno razhroščevanje Cilj: v prvem delu vsakomur dati vsaj eno dobro.
طه ما انزلنا علیک القرآن لتشغی الا تذکره لمن یخشی.
Grafični vmesnik - GUI Izdelava obrazca: lastnosti, odzivne metode
DELOVANJE POVEZAV V STANOVANJU
Izdelal: Razred: Mentorica: Predmet:
Српски језик ,, ЖАБА ЧИТА НОВИНЕ”, Ј. Ј. ЗМАЈ
Fotografiranje hrane Predmet: Tipografija in reprodukcija.
Verstva in etika Izbirni predmet
THE PAST SIMPLE TENSE navadni preteklik.
Component Testing (Unit Testing)
Microsoftove rešitve za šolstvo
Operacijski sistemi Lucijan Katan, 1.at Mentor: Branko Potisk.
OGM – VAJE RAČUNALNIŠKI PROGRAMI: Amses FRAME 2D
Ogrodje .NET Temelj za izgradnjo aplikacij nove generacije
SIMATIC BATCH SIMATIC BATCH
Test-driven development (TDD)
Why are we for PEACE? Zakaj smo za mir.
Ugani število Napišimo program, ki si “izmisli” naključno število, potem pa nas v zanki sprašuje, katero je izmišljeno število. Če število uganemo, nas.
Gorenje, d.d. Organizacija in informatika Peter Tovšak
Obravnava izjem (exception handling).
Informacijska varnost v Oracle okolju
NetBeans Platfrom.
Unit testing with JUnit
Tuesday Brown Bag Inversion of Control with Howard Abrams
True or False: {image} is one-to-one function.
Objective SWBAT use properties of exponents involving quotients.
x 4 = 7 x 4 = 3 x 4 = x 4 = 1 x 4 = 2 x 4 = x 4 = 6 x 4 = 0 x 4 = Instructions Cut out the cards choose a question, find the.
Neprekinjeno testiranje v .NET Core
Presentation transcript:

Urnik 09.00 – 10.30 Unit testing, TDD DUnit, DUnit2, DUnitX, TestInsight 10.30 – 11.00 odmor 11.00 – 12.30 Unit testing v resničnem svetu, mocking

Preizkušanje enot

»Unit« Testing »unit« <> »unit« »unit« = »enota« = majhen samostojen del programa razred

Zakaj? Odpornost proti napakam Olajšano predelovanje Testiranje robnih pogojev Dokumentacija Dobra zasnova programov

Kdaj? Pred spreminjanjem programa Med programiranjem Pred commitom V build serverju Med izdelavo release verzije

TDD Najprej test, nato koda repeat WriteATest(); WatchItFail(); WriteTheCode(); WatchTestPass(); until false;

Kako? Čim manjši del funkcionalnosti Le en test pravilnosti Izogibamo se if in case Pripravi, pokliči, preveri Najprej pogosti primeri, nato robni Preverimo proženje izjem Preverimo vse možne poti Medsebojno neodvisni preizkusi

Ogrodja

DUnit [JUnit] Juanco Anez Od 2005 del Delphija Čarovnika za izdelavo projekta in testnega primera Grafično in tekstovno izvajalno okolje

API TTestCase Setup TearDown RegisterTest CheckXXXX ExpectedException

Izvajanje for i := FirstTest to LastTest do begin testCase := TMyTestCase.Create; try testCase.Setup; RunTestCase(testCase, i); finally testCase.Teardown; end; finally testCase.Free; end; end;

DUnit2 [DUnit] Peter McNab http://dunit2.sourceforge.net/ Združljiv

Izboljšave Testira »puščanje« pomnilnika XML reporter Obsežnejši API Hierarhični testi Testiranje programov (simulacija interakcije) GUIAutomation Hitrejše izvajanje

Izvajanje testCase := TMyTestCase.Create; try for i := FirstTest to LastTest do begin testCase.Setup; RunTestCase(testCase, i); finally testCase.Teardown; end; end; finally testCase.Free; end;

DUnitX Moderna zasnova Vincent Parrett (Final Builder) https://github.com/VSoftTechnologies/DUnitX

Atributi [TestFixture] [Setup], [TearDown] [SetupFixture], [TearDownFixture] [Test], [TestCase] [RepeatTest] [Ignore] [Category]

API Assert.XXXX Assert.WillRaise

TestInsight Integrirani grafični poganjalnik za DUnit, DUnit2, DUnitX Vgrajen v Delphi Samodejno izvajanje testov

Od teorije k praksi …

Mocking

Odvisni razredi

Lažni razredi

Dependency Injection Inversion of Control (IoC) Običajno: Razred izdela primerke razredov, ki jih uporablja Obrnjeno (IoC): Razredu nastavimo (injection) primerke razredov, ki jih uporablja

Primer type ILogger = interface procedure Log(const msg: string); end; TTestedClass = class strict private FLogger: ILogger; public property Logger: ILogger read FLogger write FLogger;

Delphi Mocks Vincent Parrett (DUnitX) https://github.com/VSoftTechnologies/Delphi-Mocks Avtomatska izdelava lažnih razredov TStub TMock Osnovano na vmesnikih + RTTI

Preizkušamo lahko tudi drugače

Načini preizkušanja Preizkušanje enot Integracijsko preizkušanje Regresijsko preizkušanje Aplikacijsko preizkušanje TestComplete DUnit + OpenCTF DUnit2

Vprašanja?