Google C++ Testing Framework in Visual Studio 2008

Andrea Francia
Andrea FranciaFull Stack Something at 7Pixel S.r.l.
Using Google Test with Visual Studio 2008 Andrea Francia (Galileian Plus) XPUG (14 aprile 2010) http:// www.galileianplus.it /   http:// www.andreafrancia.it /   http://blog.andreafrancia.it/
SISMA Project
GOCE-Italy
Contents ,[object Object],[object Object],[object Object],[object Object],[object Object]
Hello World Example // file: hello.c #include   <stdio.h> int  main( int  argc,  char  * argv[]) { printf( &quot;Hello World&quot; ); }
Steps in C compilation C Preprocessor  C Compiler  Linker a.out  (.exe) hello.c stdio.h hello.i hello.o  (.obj) libc.a  (.lib) where printf is declared where printf is defined (from /usr/lib/) (from /usr/include)
Which testing framework? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[1]  http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks#C.2B.2B
Narrowing selection ,[object Object],[object Object],[object Object],[object Object]
CppUnit ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[1] The author of “Working Effectively with Legacy Code”
CppUnitLite ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[1] He decided that using CppUnit was too elaborate!
Google C++ Testing Framework ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],     
The Winner is ,[object Object],[object Object]
What do you need? ,[object Object],[object Object],[object Object]
How test are defined ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Suggested nomeclature: A. The system under test. B. The tested features. Note: Autodiscovery!  No need of enumerating tests. 1. Include the library headers 2. Write a TEST() for each features 2.1. Write Assertions
The Output Window
The Optional main() function ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How To Set Up (live) 1/2 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How To Set Up (live) 2/2 ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Assertions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Expectations ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
References ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object]
1 of 22

Recommended

Introduzione al TDD by
Introduzione al TDDIntroduzione al TDD
Introduzione al TDDAndrea Francia
1.6K views65 slides
Presentation_C++UnitTest by
Presentation_C++UnitTestPresentation_C++UnitTest
Presentation_C++UnitTestRaihan Masud
270 views7 slides
20111018 boost and gtest by
20111018 boost and gtest20111018 boost and gtest
20111018 boost and gtestWill Shen
1.5K views28 slides
Test Driven Development With Python by
Test Driven Development With PythonTest Driven Development With Python
Test Driven Development With PythonSiddhi
18.9K views42 slides
Test Driven In Groovy by
Test Driven In GroovyTest Driven In Groovy
Test Driven In GroovyChristopher Bartling
2.3K views43 slides
Python Testing Fundamentals by
Python Testing FundamentalsPython Testing Fundamentals
Python Testing Fundamentalscbcunc
4K views153 slides

More Related Content

What's hot

Tdd With Groovy by
Tdd With GroovyTdd With Groovy
Tdd With GroovyMatthew Taylor
1.4K views17 slides
Modern Python Testing by
Modern Python TestingModern Python Testing
Modern Python TestingAlexander Loechel
2.4K views36 slides
C++ Unit Test with Google Testing Framework by
C++ Unit Test with Google Testing FrameworkC++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing FrameworkHumberto Marchezi
7.4K views52 slides
TDD in Python With Pytest by
TDD in Python With PytestTDD in Python With Pytest
TDD in Python With PytestEddy Reyes
8.1K views31 slides
Python-nose: A unittest-based testing framework for Python that makes writing... by
Python-nose: A unittest-based testing framework for Python that makes writing...Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...Timo Stollenwerk
5.7K views12 slides
Pyunit by
PyunitPyunit
PyunitIkuru Kanuma
744 views17 slides

What's hot(20)

C++ Unit Test with Google Testing Framework by Humberto Marchezi
C++ Unit Test with Google Testing FrameworkC++ Unit Test with Google Testing Framework
C++ Unit Test with Google Testing Framework
Humberto Marchezi7.4K views
TDD in Python With Pytest by Eddy Reyes
TDD in Python With PytestTDD in Python With Pytest
TDD in Python With Pytest
Eddy Reyes8.1K views
Python-nose: A unittest-based testing framework for Python that makes writing... by Timo Stollenwerk
Python-nose: A unittest-based testing framework for Python that makes writing...Python-nose: A unittest-based testing framework for Python that makes writing...
Python-nose: A unittest-based testing framework for Python that makes writing...
Timo Stollenwerk5.7K views
unittest in 5 minutes by Ray Toal
unittest in 5 minutesunittest in 5 minutes
unittest in 5 minutes
Ray Toal1.8K views
Testing in-python-and-pytest-framework by Arulalan T
Testing in-python-and-pytest-frameworkTesting in-python-and-pytest-framework
Testing in-python-and-pytest-framework
Arulalan T4.9K views
Google mock for dummies by Harry Potter
Google mock for dummiesGoogle mock for dummies
Google mock for dummies
Harry Potter1.9K views
Unit Test Your Database by David Wheeler
Unit Test Your DatabaseUnit Test Your Database
Unit Test Your Database
David Wheeler6.5K views
Unit Testing RPG with JUnit by Greg.Helton
Unit Testing RPG with JUnitUnit Testing RPG with JUnit
Unit Testing RPG with JUnit
Greg.Helton6.1K views
Python Unit Test by David Xie
Python Unit TestPython Unit Test
Python Unit Test
David Xie1.5K views

Similar to Google C++ Testing Framework in Visual Studio 2008

Google test training by
Google test trainingGoogle test training
Google test trainingThierry Gayet
1.4K views138 slides
The Ring programming language version 1.8 book - Part 95 of 202 by
The Ring programming language version 1.8 book - Part 95 of 202The Ring programming language version 1.8 book - Part 95 of 202
The Ring programming language version 1.8 book - Part 95 of 202Mahmoud Samir Fayed
16 views10 slides
Test Automation Using Googletest by
Test Automation Using GoogletestTest Automation Using Googletest
Test Automation Using GoogletestMohammed_Publications
52 views3 slides
Canoo Show En by
Canoo Show EnCanoo Show En
Canoo Show EnRoman Hesteric
459 views26 slides
Testing in go by
Testing in goTesting in go
Testing in goEduardo Felipe Ewert Bonet
682 views47 slides
Tdd is not about testing (OOP) by
Tdd is not about testing (OOP)Tdd is not about testing (OOP)
Tdd is not about testing (OOP)Gianluca Padovani
294 views61 slides

Similar to Google C++ Testing Framework in Visual Studio 2008(20)

The Ring programming language version 1.8 book - Part 95 of 202 by Mahmoud Samir Fayed
The Ring programming language version 1.8 book - Part 95 of 202The Ring programming language version 1.8 book - Part 95 of 202
The Ring programming language version 1.8 book - Part 95 of 202
3 WAYS TO TEST YOUR COLDFUSION API by Gavin Pickin
3 WAYS TO TEST YOUR COLDFUSION API3 WAYS TO TEST YOUR COLDFUSION API
3 WAYS TO TEST YOUR COLDFUSION API
Gavin Pickin859 views
Moving from Jenkins 1 to 2 declarative pipeline adventures by Frits Van Der Holst
Moving from Jenkins 1 to 2 declarative pipeline adventuresMoving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventures
Frits Van Der Holst1.3K views
J unit presentation by Priya Sharma
J unit presentationJ unit presentation
J unit presentation
Priya Sharma1.5K views
JUnit Presentation by priya_trivedi
JUnit PresentationJUnit Presentation
JUnit Presentation
priya_trivedi17.7K views
Testing of javacript by Lei Kang
Testing of javacriptTesting of javacript
Testing of javacript
Lei Kang3K views
Continuous integration with Git & CI Joe by Shawn Price
Continuous integration with Git & CI JoeContinuous integration with Git & CI Joe
Continuous integration with Git & CI Joe
Shawn Price2.2K views
The GO Language : From Beginners to Gophers by Alessandro Sanino
The GO Language : From Beginners to GophersThe GO Language : From Beginners to Gophers
The GO Language : From Beginners to Gophers
Alessandro Sanino384 views
Rifartek Robot Training Course - How to use ClientRobot by Tsai Tsung-Yi
Rifartek Robot Training Course - How to use ClientRobotRifartek Robot Training Course - How to use ClientRobot
Rifartek Robot Training Course - How to use ClientRobot
Tsai Tsung-Yi311 views
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017 by Ortus Solutions, Corp
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
Mender.io | Develop embedded applications faster | Comparing C and Golang by Mender.io
Mender.io | Develop embedded applications faster | Comparing C and GolangMender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io | Develop embedded applications faster | Comparing C and Golang
Mender.io677 views
Legacy Dependency Kata v2.0 by William Munn
Legacy Dependency Kata v2.0Legacy Dependency Kata v2.0
Legacy Dependency Kata v2.0
William Munn1.6K views

More from Andrea Francia

Baby Steps TripServiceKata by
Baby Steps TripServiceKataBaby Steps TripServiceKata
Baby Steps TripServiceKataAndrea Francia
389 views39 slides
TDD on Legacy Code - Voxxed Days Milano 2019 by
TDD on Legacy Code - Voxxed Days Milano 2019TDD on Legacy Code - Voxxed Days Milano 2019
TDD on Legacy Code - Voxxed Days Milano 2019Andrea Francia
291 views18 slides
Lavorare con codice legacy “non testabile” - Incontro DevOps - 8 marzo 2019 -... by
Lavorare con codice legacy “non testabile” - Incontro DevOps - 8 marzo 2019 -...Lavorare con codice legacy “non testabile” - Incontro DevOps - 8 marzo 2019 -...
Lavorare con codice legacy “non testabile” - Incontro DevOps - 8 marzo 2019 -...Andrea Francia
506 views24 slides
Kata in Bash a DevOpsHeroes 2018 a Parma by
Kata in Bash a DevOpsHeroes 2018 a ParmaKata in Bash a DevOpsHeroes 2018 a Parma
Kata in Bash a DevOpsHeroes 2018 a ParmaAndrea Francia
150 views6 slides
User Stories - Andrea Francia @ WeDev 7 novembre 2018 by
User Stories - Andrea Francia @ WeDev 7 novembre 2018User Stories - Andrea Francia @ WeDev 7 novembre 2018
User Stories - Andrea Francia @ WeDev 7 novembre 2018Andrea Francia
459 views94 slides
Le pratiche ingegneristiche di eXtreme Programming by
Le pratiche ingegneristiche di eXtreme ProgrammingLe pratiche ingegneristiche di eXtreme Programming
Le pratiche ingegneristiche di eXtreme ProgrammingAndrea Francia
467 views135 slides

More from Andrea Francia(20)

TDD on Legacy Code - Voxxed Days Milano 2019 by Andrea Francia
TDD on Legacy Code - Voxxed Days Milano 2019TDD on Legacy Code - Voxxed Days Milano 2019
TDD on Legacy Code - Voxxed Days Milano 2019
Andrea Francia291 views
Lavorare con codice legacy “non testabile” - Incontro DevOps - 8 marzo 2019 -... by Andrea Francia
Lavorare con codice legacy “non testabile” - Incontro DevOps - 8 marzo 2019 -...Lavorare con codice legacy “non testabile” - Incontro DevOps - 8 marzo 2019 -...
Lavorare con codice legacy “non testabile” - Incontro DevOps - 8 marzo 2019 -...
Andrea Francia506 views
Kata in Bash a DevOpsHeroes 2018 a Parma by Andrea Francia
Kata in Bash a DevOpsHeroes 2018 a ParmaKata in Bash a DevOpsHeroes 2018 a Parma
Kata in Bash a DevOpsHeroes 2018 a Parma
Andrea Francia150 views
User Stories - Andrea Francia @ WeDev 7 novembre 2018 by Andrea Francia
User Stories - Andrea Francia @ WeDev 7 novembre 2018User Stories - Andrea Francia @ WeDev 7 novembre 2018
User Stories - Andrea Francia @ WeDev 7 novembre 2018
Andrea Francia459 views
Le pratiche ingegneristiche di eXtreme Programming by Andrea Francia
Le pratiche ingegneristiche di eXtreme ProgrammingLe pratiche ingegneristiche di eXtreme Programming
Le pratiche ingegneristiche di eXtreme Programming
Andrea Francia467 views
Test-Driven Development su Codice Esistente by Andrea Francia
Test-Driven Development su Codice EsistenteTest-Driven Development su Codice Esistente
Test-Driven Development su Codice Esistente
Andrea Francia107 views
Le 12 pratiche - Un introduzione a XP (Mini Italian Agile Day) by Andrea Francia
Le 12 pratiche - Un introduzione a XP (Mini Italian Agile Day)Le 12 pratiche - Un introduzione a XP (Mini Italian Agile Day)
Le 12 pratiche - Un introduzione a XP (Mini Italian Agile Day)
Andrea Francia799 views
Introduzione a eXtreme Programming by Andrea Francia
Introduzione a eXtreme ProgrammingIntroduzione a eXtreme Programming
Introduzione a eXtreme Programming
Andrea Francia279 views
Test-Driven Development e Sviluppo Incrementale (TDD-Milano 2017-01-10) by Andrea Francia
Test-Driven Development e Sviluppo Incrementale (TDD-Milano 2017-01-10)Test-Driven Development e Sviluppo Incrementale (TDD-Milano 2017-01-10)
Test-Driven Development e Sviluppo Incrementale (TDD-Milano 2017-01-10)
Andrea Francia271 views
Piccolo coding dojo (milano xpug 2013-04-11) by Andrea Francia
Piccolo coding dojo (milano xpug 2013-04-11)Piccolo coding dojo (milano xpug 2013-04-11)
Piccolo coding dojo (milano xpug 2013-04-11)
Andrea Francia1.2K views
Tutti i miei sbagli (Errori di un wannabe Open Source Developer) by Andrea Francia
Tutti i miei sbagli (Errori di un wannabe Open Source Developer)Tutti i miei sbagli (Errori di un wannabe Open Source Developer)
Tutti i miei sbagli (Errori di un wannabe Open Source Developer)
Andrea Francia5.2K views
Tutti i miei sbagli, versione 7 Marzo 2012 al XPUG mi by Andrea Francia
Tutti i miei sbagli, versione 7 Marzo 2012 al XPUG miTutti i miei sbagli, versione 7 Marzo 2012 al XPUG mi
Tutti i miei sbagli, versione 7 Marzo 2012 al XPUG mi
Andrea Francia1.4K views
Writing a Crawler with Python and TDD by Andrea Francia
Writing a Crawler with Python and TDDWriting a Crawler with Python and TDD
Writing a Crawler with Python and TDD
Andrea Francia1.9K views
Subversion @ JUG Milano 11 dic 2009 by Andrea Francia
Subversion @ JUG Milano 11 dic 2009Subversion @ JUG Milano 11 dic 2009
Subversion @ JUG Milano 11 dic 2009
Andrea Francia1.3K views
Working Effectively with Legacy Code (draft) by Andrea Francia
Working Effectively with Legacy Code (draft)Working Effectively with Legacy Code (draft)
Working Effectively with Legacy Code (draft)
Andrea Francia1.6K views

Recently uploaded

Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveNetwork Automation Forum
34 views35 slides
Case Study Copenhagen Energy and Business Central.pdf by
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdfAitana
16 views3 slides
Info Session November 2023.pdf by
Info Session November 2023.pdfInfo Session November 2023.pdf
Info Session November 2023.pdfAleksandraKoprivica4
13 views15 slides
Piloting & Scaling Successfully With Microsoft Viva by
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft VivaRichard Harbridge
12 views160 slides
Business Analyst Series 2023 - Week 3 Session 5 by
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5DianaGray10
300 views20 slides
The Research Portal of Catalonia: Growing more (information) & more (services) by
The Research Portal of Catalonia: Growing more (information) & more (services)The Research Portal of Catalonia: Growing more (information) & more (services)
The Research Portal of Catalonia: Growing more (information) & more (services)CSUC - Consorci de Serveis Universitaris de Catalunya
80 views25 slides

Recently uploaded(20)

Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive by Network Automation Forum
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLiveAutomating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Automating a World-Class Technology Conference; Behind the Scenes of CiscoLive
Case Study Copenhagen Energy and Business Central.pdf by Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana16 views
Piloting & Scaling Successfully With Microsoft Viva by Richard Harbridge
Piloting & Scaling Successfully With Microsoft VivaPiloting & Scaling Successfully With Microsoft Viva
Piloting & Scaling Successfully With Microsoft Viva
Business Analyst Series 2023 - Week 3 Session 5 by DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10300 views
Unit 1_Lecture 2_Physical Design of IoT.pdf by StephenTec
Unit 1_Lecture 2_Physical Design of IoT.pdfUnit 1_Lecture 2_Physical Design of IoT.pdf
Unit 1_Lecture 2_Physical Design of IoT.pdf
StephenTec12 views
Data Integrity for Banking and Financial Services by Precisely
Data Integrity for Banking and Financial ServicesData Integrity for Banking and Financial Services
Data Integrity for Banking and Financial Services
Precisely25 views
Voice Logger - Telephony Integration Solution at Aegis by Nirmal Sharma
Voice Logger - Telephony Integration Solution at AegisVoice Logger - Telephony Integration Solution at Aegis
Voice Logger - Telephony Integration Solution at Aegis
Nirmal Sharma39 views
Special_edition_innovator_2023.pdf by WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2218 views
SAP Automation Using Bar Code and FIORI.pdf by Virendra Rai, PMP
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdf
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors by sugiuralab
TouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective SensorsTouchLog: Finger Micro Gesture Recognition  Using Photo-Reflective Sensors
TouchLog: Finger Micro Gesture Recognition Using Photo-Reflective Sensors
sugiuralab21 views

Google C++ Testing Framework in Visual Studio 2008

  • 1. Using Google Test with Visual Studio 2008 Andrea Francia (Galileian Plus) XPUG (14 aprile 2010) http:// www.galileianplus.it / http:// www.andreafrancia.it / http://blog.andreafrancia.it/
  • 4.
  • 5. Hello World Example // file: hello.c #include <stdio.h> int main( int argc, char * argv[]) { printf( &quot;Hello World&quot; ); }
  • 6. Steps in C compilation C Preprocessor C Compiler Linker a.out (.exe) hello.c stdio.h hello.i hello.o (.obj) libc.a (.lib) where printf is declared where printf is defined (from /usr/lib/) (from /usr/include)
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.