applying unit tests & test-driven development€¦ · applying unit tests & test-driven...
TRANSCRIPT
![Page 1: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/1.jpg)
© Improving Enterprises, Inc.
Applying Unit Tests &Test-Driven Development
@donmcgreal
linkedin.com/in/donmcgreal
![Page 2: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/2.jpg)
© Improving Enterprises, Inc.
The Plan...
Unit Testing
Test Driven Development
Behavior Driven Development
Getting the most from your tests
Q&A
![Page 3: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/3.jpg)
© Improving Enterprises, Inc.
The Plan...
Unit Testing
Test Driven Development
Behavior Driven Development
Getting the most from your tests
Q&A
![Page 4: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/4.jpg)
© Improving Enterprises, Inc.
“I don’t want to touch that! It’ll take forever, and I don’t know
what else will break if I do.I’ll just rewrite it.”
Familiar?
![Page 5: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/5.jpg)
© Improving Enterprises, Inc.
Unit TestingTest the code quality
“Alarm System”
Regression testing
Reduce number of defects
Fix defects quicker
Confidence in the code
“Virtuous Cycle”
More Test
More Change
More Quality
More Confidence
CODE
![Page 6: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/6.jpg)
© Improving Enterprises, Inc.
Unit Testing
What is a Unit?
What is a Test?
Smallest testable part of an application
Validation that the code is working properly
![Page 7: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/7.jpg)
© Improving Enterprises, Inc.
Unit Testing - Traditionalpublic class MyClassTest { [Test] public void TestMethod1() { MyClass instance = new MyClass(); instance.Method1(); Assert.AreEqual("expected", instance.Value); } [Test] public void TestMethod2() { MyClass instance = new MyClass(); Result result = instance.Method2(); Assert.IsNotNull(result); Assert.AreEqual("expected", result.Value); }
}
Exercise
Verify
Setup AreEqual(expected, actual);AreNotEqual(expected, actual);Greater(expected, actual);Less(expected, actual);IsFalse(condition);IsTrue(condition);IsNull(object);IsNotNull(object);IsEmpty(object);AreSame(expected, actual);AreNotSame(expected, actual);Pass();Fail();
Teardown
![Page 8: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/8.jpg)
© Improving Enterprises, Inc.
Unit Testing Example
Let’s try it...
![Page 9: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/9.jpg)
© Improving Enterprises, Inc.
The Plan...
Unit Testing
Test Driven Development
Behavior Driven Development
Getting the most from your tests
Q&A
![Page 10: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/10.jpg)
© Improving Enterprises, Inc.
The Plan...
Unit Testing
Test Driven Development
Behavior Driven Development
Getting the most from your tests
Q&A
![Page 11: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/11.jpg)
© Improving Enterprises, Inc.
Test Driven Development
Start Here
![Page 12: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/12.jpg)
© Improving Enterprises, Inc.
Think
Test
Code
Design
2-10 Minutes
TDD Mantra
![Page 13: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/13.jpg)
© Improving Enterprises, Inc.
RefactorGreen
RedThink
Test
Code
Design
2-10 Minutes
TDD Mantra
![Page 14: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/14.jpg)
© Improving Enterprises, Inc.
Step 0: Think(take as long as you need*)
*Jim Shore
![Page 15: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/15.jpg)
© Improving Enterprises, Inc.
Step 1: Write a test.
![Page 16: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/16.jpg)
© Improving Enterprises, Inc.
Step 2: Make the test pass. (Just barely)
![Page 17: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/17.jpg)
© Improving Enterprises, Inc.
Step 3: Refactor.
![Page 18: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/18.jpg)
© Improving Enterprises, Inc.
RefactorGreen
RedThink
Test
Code
Design
2-10 Minutes
TDD Mantra
![Page 19: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/19.jpg)
© Improving Enterprises, Inc.
TDD lets you know when...
Y aA i n ’ tG o n n aN e e dI t !
![Page 20: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/20.jpg)
© Improving Enterprises, Inc.
“Only write code to fix a failing test”
So...
![Page 21: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/21.jpg)
© Improving Enterprises, Inc.
Case StudyEmpirical studies compared 4 projects, at Microsoft and IBM, that used TDD with similar projects that did not use TDD. The findings were similar to other case studies:
Defect density decreased 40%–90%
Development time increased by 15–35%
(though teams agreed that this was offset by reduced maintenance
http://www.infoq.com/news/2009/03/TDD-Improves-Quality
![Page 22: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/22.jpg)
© Improving Enterprises, Inc.
TDD Example
Let’s try it...
![Page 23: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/23.jpg)
© Improving Enterprises, Inc.
The Plan...
Unit Testing
Test Driven Development
Behavior Driven Development
Getting the most from your tests
Q&A
![Page 24: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/24.jpg)
© Improving Enterprises, Inc.
The Plan...
Unit Testing
Test Driven Development
Behavior Driven Development
Getting the most from your tests
Q&A
![Page 25: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/25.jpg)
© Improving Enterprises, Inc.
Unit Testing - Traditionalpublic class MyClassTest { [Test] public void TestMethod1() { MyClass instance = new MyClass(); instance.Method1(); Assert.AreEqual("expected", instance.Value); } [Test] public void TestMethod2() { MyClass instance = new MyClass(); Result result = instance.Method2(); Assert.IsNotNull(result); Assert.AreEqual("expected", result.Value); }
}
Exercise
Verify
Setup AreEqual(expected, actual);AreNotEqual(expected, actual);Greater(expected, actual);Less(expected, actual);IsFalse(condition);IsTrue(condition);IsNull(object);IsNotNull(object);IsEmpty(object);AreSame(expected, actual);AreNotSame(expected, actual);Pass();Fail();
Teardown
![Page 26: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/26.jpg)
© Improving Enterprises, Inc.
Unit Testing - BDD Stylepublic class WhenSystemIsInParticularState { private MyClass instance;
[SetUp] public void Init() { instance = new MyClass(); }
[Test] public void ShouldDoThisAndThat() { instance.Method1(); Assert.AreEqual("expected", instance.Value); } [Test] public void ShouldDoThatAndThis() { Result result = instance.Method2(); Assert.IsNotNull(result); Assert.AreEqual("expected", result.Value); }
}
Setup
Exercise
VerifyassertEquals(expected, actual);assertFalse(condition);assertTrue(condition);assertNull(object);assertNotNull(object);assertSame(expected, actual);assertNotSame(unexpected, actual);fail();
Teardown
![Page 27: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/27.jpg)
© Improving Enterprises, Inc.
Unit Testing - BDD Stylepublic class WhenSystemIsInParticularState { private MyClass instance;
[SetUp] public void Init() { instance = new MyClass(); }
[Test] public void ShouldDoThisAndThat() { instance.Method1(); Assert.AreEqual("expected", instance.Value); } [Test] public void ShouldDoThatAndThis() { Result result = instance.Method2(); Assert.IsNotNull(result); Assert.AreEqual("expected", result.Value); }
}
Setup
Exercise
VerifyassertEquals(expected, actual);assertFalse(condition);assertTrue(condition);assertNull(object);assertNotNull(object);assertSame(expected, actual);assertNotSame(unexpected, actual);fail();
Teardown
![Page 28: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/28.jpg)
© Improving Enterprises, Inc.
Behavior Driven Development
Forget about Tests; Think about Specificationsit’s easy to come up with reasons not to test, but writing specs can become an integral part of development
Forget about Units; Think about Behaviorsworry more about how a developer will interact with the code, and not what methods a class has
![Page 29: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/29.jpg)
© Improving Enterprises, Inc.
BDD
BDD Frameworks for Java & .Net
• JBehave
• easyb (Groovy)
• NSpec
• nbehave
• others...
![Page 30: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/30.jpg)
© Improving Enterprises, Inc.
BDD Example
Let’s try it...
![Page 31: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/31.jpg)
© Improving Enterprises, Inc.
The Plan...
Unit Testing
Test Driven Development
Behavior Driven Development
Getting the most from your tests
Q&A
![Page 32: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/32.jpg)
© Improving Enterprises, Inc.
The Plan...
Unit Testing
Test Driven Development
Behavior Driven Development
Getting the most from your tests
Q&A
![Page 33: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/33.jpg)
© Improving Enterprises, Inc.
The Problem
External dependencies affect
Performance
Portability Stability
... of your tests.
Application
Remote Application
Data
This is an opportunity and a driving force to design more modular, more testable and more re-usable code.
![Page 34: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/34.jpg)
© Improving Enterprises, Inc.
Integration Tests
Testing external connections to other systems and databases are acceptable, but not as part of the general test suite.
These are called Integration Tests
Application
Remote Application
Data
![Page 35: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/35.jpg)
© Improving Enterprises, Inc.
The Solution
ClientApp RemoteBank
debit(amt):booleancredit(amt):boolean
SoaBankJmsBank FakeBank
Dependency Injection
bank
debit(amt):booleancredit(amt):boolean
debit(amt):booleancredit(amt):boolean
debit(amt):booleancredit(amt):boolean
![Page 36: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/36.jpg)
© Improving Enterprises, Inc.
XUnit Patterns
Test Doubles:• dummies
• stubs• fakes
• mocks
![Page 37: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/37.jpg)
© Improving Enterprises, Inc.
Dummy Object Null, "Ignored String", new Object()
public class ItemBehavior { @Test public void shouldCheckIfInventoryIsLow() { Item item = new Item("name", 0.0, 10); item.setQuantity(20); assertFalse(item.isLowInventory()); item.setQuantity(2); assertTrue(item.isLowInventory()); } @Test public void shouldStoreItemInformation() { Item item = new Item("iPhone", 400.00, 10); assertEquals("iPhone", item.getName()); assertEquals(400.00, item.getPrice()); assertEquals(10, item.getQuantity()); }}
![Page 38: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/38.jpg)
© Improving Enterprises, Inc.
Dummy Object Null, "Ignored String", new Object()
public class ItemBehavior { @Test public void shouldCheckIfInventoryIsLow() { Item item = new Item("name", 0.0, 10); item.setQuantity(20); assertFalse(item.isLowInventory()); item.setQuantity(2); assertTrue(item.isLowInventory()); } @Test public void shouldStoreItemInformation() { Item item = new Item("iPhone", 400.00, 10); assertEquals("iPhone", item.getName()); assertEquals(400.00, item.getPrice()); assertEquals(10, item.getQuantity()); }}
![Page 39: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/39.jpg)
© Improving Enterprises, Inc.
Test Stub
Replace a real object with a test-specific object that feeds the desired inputs into the system under test.
http://xunitpatterns.com/Test%20Stub.html
ClientApp app = new ClientApp();RemoteBank bank = new FakeBank();app.setBank(bank); boolean success = app.debit(1000);
![Page 40: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/40.jpg)
© Improving Enterprises, Inc.
Fake Object
Replace a component that the SUT depends on with a much lighter-weight implementation.
http://xunitpatterns.com/Fake%20Object.html
ClientApp app = new ClientApp();RemoteLogger log = new FakeLogger();app.setLogging(log); boolean success = app.debit(1000);
![Page 41: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/41.jpg)
© Improving Enterprises, Inc.
Mock Object
http://xunitpatterns.com/Mock%20Object.html
Replace an object the SUT depends on with a test-specific object that verifies it is being used correctly by the SUT.
![Page 42: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/42.jpg)
© Improving Enterprises, Inc.
Mock Object
http://xunitpatterns.com/Mock%20Object.html
public class MockLogger implements RemoteLogger{
public void logMessage(Date actualDate, String actualUser, String actualActionCode, Object actualDetail) { actualNumberCalls++;
Assert.assertEquals("date", expectedDate, actualDate); Assert.assertEquals("user", expectedUser, actualUser); Assert.assertEquals("action code", expectedActionCode, actualActionCode); Assert.assertEquals("detail", expectedDetail, actualDetail); }
}
A Mock Logger object:
ClientApp app = new ClientApp();RemoteLogger log = new MockLogger();app.setLogging(log); boolean success = app.debit(1000);
![Page 43: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/43.jpg)
© Improving Enterprises, Inc.
The Plan...
Unit Testing
Test Driven Development
Behavior Driven Development
Getting the most from your tests
Q&A
![Page 44: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/44.jpg)
© Improving Enterprises, Inc.
The Plan...
Unit Testing
Test Driven Development
Behavior Driven Development
Getting the most from your tests
Q&A
![Page 47: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/47.jpg)
www.synerzip.com39 3939
Synerzip in a Nut-shell
www.synerzip.com
![Page 48: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/48.jpg)
www.synerzip.com39 3939
Synerzip in a Nut-shell1. Software product development partner for small/mid-sized
technology companies• Exclusive focus on small/mid-sized technology companies• By definition, all Synerzip work is the IP of its respective clients• Deep experience in full SDLC – design, dev, QA/testing, deployment• Technology and industry domain agnostic
www.synerzip.com
![Page 49: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/49.jpg)
www.synerzip.com39 3939
Synerzip in a Nut-shell1. Software product development partner for small/mid-sized
technology companies• Exclusive focus on small/mid-sized technology companies• By definition, all Synerzip work is the IP of its respective clients• Deep experience in full SDLC – design, dev, QA/testing, deployment• Technology and industry domain agnostic
2. Dedicated team of high caliber software professionals • Seamlessly extends client’s local team, offering full transparency• NOT just “staff augmentation”, but provide full mgmt support
www.synerzip.com
![Page 50: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/50.jpg)
www.synerzip.com39 3939
Synerzip in a Nut-shell1. Software product development partner for small/mid-sized
technology companies• Exclusive focus on small/mid-sized technology companies• By definition, all Synerzip work is the IP of its respective clients• Deep experience in full SDLC – design, dev, QA/testing, deployment• Technology and industry domain agnostic
2. Dedicated team of high caliber software professionals • Seamlessly extends client’s local team, offering full transparency• NOT just “staff augmentation”, but provide full mgmt support
3. Actually reduces risk of development/delivery• Experienced team - uses appropriate level of engineering discipline• Practices Agile development – responsive, yet disciplined
www.synerzip.com
![Page 51: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/51.jpg)
www.synerzip.com39 3939
Synerzip in a Nut-shell1. Software product development partner for small/mid-sized
technology companies• Exclusive focus on small/mid-sized technology companies• By definition, all Synerzip work is the IP of its respective clients• Deep experience in full SDLC – design, dev, QA/testing, deployment• Technology and industry domain agnostic
2. Dedicated team of high caliber software professionals • Seamlessly extends client’s local team, offering full transparency• NOT just “staff augmentation”, but provide full mgmt support
3. Actually reduces risk of development/delivery• Experienced team - uses appropriate level of engineering discipline• Practices Agile development – responsive, yet disciplined
4. Reduces cost – dual-shore team, 50% cost advantage
www.synerzip.com
![Page 52: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/52.jpg)
www.synerzip.com39 3939
Synerzip in a Nut-shell1. Software product development partner for small/mid-sized
technology companies• Exclusive focus on small/mid-sized technology companies• By definition, all Synerzip work is the IP of its respective clients• Deep experience in full SDLC – design, dev, QA/testing, deployment• Technology and industry domain agnostic
2. Dedicated team of high caliber software professionals • Seamlessly extends client’s local team, offering full transparency• NOT just “staff augmentation”, but provide full mgmt support
3. Actually reduces risk of development/delivery• Experienced team - uses appropriate level of engineering discipline• Practices Agile development – responsive, yet disciplined
4. Reduces cost – dual-shore team, 50% cost advantage5. Offers long term flexibility – allows (facilitates) taking
offshore team captive – aka “BOT” optionwww.synerzip.com
![Page 53: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/53.jpg)
www.synerzip.com40
4040
Our Clients
![Page 54: Applying Unit Tests & Test-Driven Development€¦ · Applying Unit Tests & Test-Driven Development Don.McGreal@ImprovingEnterprises.com @donmcgreal ... Unit Testing - Traditional](https://reader034.vdocuments.mx/reader034/viewer/2022051512/602f549342e76475f52ce649/html5/thumbnails/54.jpg)
www.synerzip.com41 414141
Call Us for a Free Consultation!
www.synerzip.com Hemant Elhence
Thanks!