SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
Introduction to TestNG
    and its Application for
Test-Driven GUI Development
        Zheng-Wen Shen
          2007/05/14



                          1
References
1.   "TestNG makes Java unit testing a breeze“, Filippo
     Diotalevi, developerWorks, January 2005

2.   "In pursuit of code quality: JUnit 4 vs. TestNG“, Andrew
     Glover, developerWorks, Aug 2006

3.   "In pursuit of code quality: Automate GUI testing with
     TestNG-Abbot“, Andrew Glover, developerWorks, February
     2007

4.   Alex Ruiz, Yvonne Wang Price, "Test-Driven GUI
     Development with TestNG and Abbot," IEEE Software,
     vol. 24, no. 3, pp. 51-57, May/Jun, 2007.

                                                                2
Outline
1. Introduction
2. TestNG Quick Start
3. TestNG Features
4. TestNG-Abbot: Test-Driven GUI
   Development
5. Summary



                                   3
1. Introduction 1/4
• JUnit: simple, pragmatic, and strict architecture
• Rules for using JUnit of unit testing
   – Every single piece of code must be tested.
   – Code must be tested in isolation (mock objects).
   – Software must be easy testable (written with tests in
     mind.)




                                                             4
1. Introduction 2/4
         Two opposed factions

                           KISS principle
                     The simplicity is necessary




Advanced features!
 more flexibility!
  more power!

                                                   5
1. Introduction 3/4
      Some peculiar features of JUnit
• The need to extend a TestCase class
• Impossible to pass parameters (setUp, tearDown)
• The execution model is a bit strange
  – The test class is reinstantiated every time a test
    method is executed.
• The management of different suites of tests in
  complex projects can be very tricky.


                                                         6
1. Introduction 4/4
1.       TestNG: Testing, the Next Generation
     • To cover all categories of tests:
     unit, functional, end-to-end, integration, …
     • JDK 5 Annotation
     • Flexible test configuration
     • Powerful execution model (no more TestSuite)   Cedric Beust
2.       TestNG-Abbot
     •     0.3.2 Release, 2007/05/08
     •     Capture-Replay GUI Testing
     •     Test-Driven GUI Development

                                                                 7
2. TestNG Quick Start 1/3
           A Test Class


         1


                   The Lang Component provides a host
                   of helper utilities for the java.lang API,
2            3     notably String manipulation methods,
                   basic numerical methods, object
                   reflection, creation and serialization,
                   and System properties.




                                                          8
2. TestNG Quick Start 2/3
   Configuration XML
testing.xml          Suite
                     Test 1
                     groups

                     classes

                     Test 2
                     groups

                     classes

                      …
                               9
2. TestNG Quick Start 3/3
       Test Results
                      HTML output




                                    10
3. TestNG Features
1.   Configuration Methods
2.   Test Group
3.   Dependency Testing
4.   Parametric Testing
5.   Factories
6.   Fail and Rerun



                                11
3.1 Configuration Methods 1/1
                                      Enter

•    @Configuration         beforeTestClass methods
    1.   beforeTestClass
    2.   afterTestClass     beforeTestMethod methods
    3.   beforeTestMethod      first test method
    4.   afterTestMethod
                            afterTestMethod methods

                            beforeTestMethod methods
                              second test method
                            afterTestMethod methods
                                      …
                            afterTestClass methods
                                                       12
                                      Exit
3.2 Test Group 1/2
• Groupings of test methods
• Maximum flexibility doesn’t recompile anything
• Check-in tests
   – Run before submit new code
   – Fast, just make sure no basic functionality was broken
• Functional tests
   – Cover all the functionalities of software
   – Run at least once a day
              Functional Test
               Check-in tests
                                                              13
3.2 Test Group 2/2
                                testing.xml




Functional Test
                                testMethod1
Check-in tests                  testMethod2
                                testMethod3
                  testMethod1
                  testMethod2
                                              14
3.3 Dependency Testing 1/2
• Invoke test methods in a certain order.
  – A certain number of test methods have completed
    and succeeded before running more test methods.
  – Initialization methods to be test methods
• Hard dependencies
• Soft dependencies



                                                      15
3.3 Dependency Testing 2/2
     (Hard) Dependency on method




     (Hard) Dependency on group




            Soft Dependency
 @Test {groups = {…} alwaysRun=true}   16
3.4 Parametric Testing 1/3
• Use arbitrary number of parameters on test
  method
• Instruct TestNG to pass the correct parameters
  with the @Parameters annotation.
  – From testng.xml
  – From DataProviders




                                                   17
3.4 Parametric Testing 2/3
     From testing.xml
        testing.xml




               first-name = “Cedric”




                                       18
3.4 Parametric Testing 3/3
   From DataProviders
                           Same class




                Different classes




                                        19
3.5 Factories 1/2
• Create tests dynamically.
  – Access a Web page several times with different
    values




   Test Method



                                                     20
3.5 Factories 2/2




                    21
3.6 Fail and Rerun 1/1
                       Delineates the failed tests
   Run
              TestNG




testing.xml            testing_failed.xml




                                                     22
4. TestNG-Abbot 1/4
   Test-Driven GUI Development
• TestNG-Abbot (0.3.2 release, 2007/05/08)
• Intuitive fixture classes
  – Logically linked to the code under test by name only.
  – Tests do not rely on GUI components being
    specifically located
  – Tests can be authored early and withstand layout and
    aesthetic changes during the development phase



                                                        23
4. TestNG-Abbot 2/4
          Application Under Test
1. The user enters name
   and email address
2. The email address
   must be valid
3. The system displays
   an error message if
   the required input is
   missing or invalid



                                   24
4. TestNG-Abbot 3/4
The test class for testing Model

                 NewEmailAccountWizard View




                        Email          Model




                                               25
4. TestNG-Abbot 4/4
The test class for testing View

                                  1

             2



        3


        4
                           5




                                      26
5. Summary
• TestNG
  – annotations-based framework
  – Make the whole testing process much more simple
    and flexible
  – Free to choose the testing strategy you prefer
• Practice TDD, even for GUIs




                                                      27

Contenu connexe

Tendances

Software testing
Software testingSoftware testing
Software testingBala Ganesh
 
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Jacinto Limjap
 
Java Unit Test and Coverage Introduction
Java Unit Test and Coverage IntroductionJava Unit Test and Coverage Introduction
Java Unit Test and Coverage IntroductionAlex Su
 
Unit Testing & TDD Training for Mobile Apps
Unit Testing & TDD Training for Mobile AppsUnit Testing & TDD Training for Mobile Apps
Unit Testing & TDD Training for Mobile AppsMarcelo Busico
 
Unit Test Presentation
Unit Test PresentationUnit Test Presentation
Unit Test PresentationSayedur Rahman
 
Moq presentation
Moq presentationMoq presentation
Moq presentationLynxStar
 
Unit testing best practices
Unit testing best practicesUnit testing best practices
Unit testing best practicesnickokiss
 
Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And MockingJoe Wilson
 
Unit Testing Fundamentals
Unit Testing FundamentalsUnit Testing Fundamentals
Unit Testing FundamentalsRichard Paul
 
How and what to unit test
How and what to unit testHow and what to unit test
How and what to unit testEugenio Lentini
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit TestingJoe Tremblay
 
Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...
Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...
Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...Thomas Weller
 

Tendances (20)

Software testing
Software testingSoftware testing
Software testing
 
TestNG Framework
TestNG Framework TestNG Framework
TestNG Framework
 
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012Unit testing, UI testing and Test Driven Development in Visual Studio 2012
Unit testing, UI testing and Test Driven Development in Visual Studio 2012
 
Java Unit Test and Coverage Introduction
Java Unit Test and Coverage IntroductionJava Unit Test and Coverage Introduction
Java Unit Test and Coverage Introduction
 
Unit Testing & TDD Training for Mobile Apps
Unit Testing & TDD Training for Mobile AppsUnit Testing & TDD Training for Mobile Apps
Unit Testing & TDD Training for Mobile Apps
 
Unit Testing (C#)
Unit Testing (C#)Unit Testing (C#)
Unit Testing (C#)
 
Unit Test Presentation
Unit Test PresentationUnit Test Presentation
Unit Test Presentation
 
Moq presentation
Moq presentationMoq presentation
Moq presentation
 
TestNg_Overview_Config
TestNg_Overview_ConfigTestNg_Overview_Config
TestNg_Overview_Config
 
Unit testing best practices
Unit testing best practicesUnit testing best practices
Unit testing best practices
 
Unit testing
Unit testingUnit testing
Unit testing
 
Unit Testing And Mocking
Unit Testing And MockingUnit Testing And Mocking
Unit Testing And Mocking
 
Unit Testing Fundamentals
Unit Testing FundamentalsUnit Testing Fundamentals
Unit Testing Fundamentals
 
Test ng tutorial
Test ng tutorialTest ng tutorial
Test ng tutorial
 
Unit testing
Unit testingUnit testing
Unit testing
 
How and what to unit test
How and what to unit testHow and what to unit test
How and what to unit test
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit Testing
 
Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...
Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...
Introduction to testing with MSTest, Visual Studio, and Team Foundation Serve...
 
Ppt19
Ppt19Ppt19
Ppt19
 
Software testing basics and its types
Software testing basics and its typesSoftware testing basics and its types
Software testing basics and its types
 

En vedette

Bade Smells in Code
Bade Smells in CodeBade Smells in Code
Bade Smells in CodeWill Shen
 
Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008Andrea Francia
 
Google mock for dummies
Google mock for dummiesGoogle mock for dummies
Google mock for dummiesLuis Goldster
 
20111018 boost and gtest
20111018 boost and gtest20111018 boost and gtest
20111018 boost and gtestWill Shen
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test frameworkAbner Chih Yi Huang
 

En vedette (6)

Bade Smells in Code
Bade Smells in CodeBade Smells in Code
Bade Smells in Code
 
Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008Google C++ Testing Framework in Visual Studio 2008
Google C++ Testing Framework in Visual Studio 2008
 
Google mock for dummies
Google mock for dummiesGoogle mock for dummies
Google mock for dummies
 
20111018 boost and gtest
20111018 boost and gtest20111018 boost and gtest
20111018 boost and gtest
 
Introduzione al TDD
Introduzione al TDDIntroduzione al TDD
Introduzione al TDD
 
An introduction to Google test framework
An introduction to Google test frameworkAn introduction to Google test framework
An introduction to Google test framework
 

Similaire à 20070514 introduction to test ng and its application for test driven gui development

TestNG introduction
TestNG introductionTestNG introduction
TestNG introductionDenis Bazhin
 
Database Unit Testing Made Easy with VSTS
Database Unit Testing Made Easy with VSTSDatabase Unit Testing Made Easy with VSTS
Database Unit Testing Made Easy with VSTSSanil Mhatre
 
Software testing part
Software testing partSoftware testing part
Software testing partPreeti Mishra
 
Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.Mohamed Taman
 
UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPTsuhasreddy1
 
Share point 2010 unit and integration testing
Share point 2010 unit and integration testingShare point 2010 unit and integration testing
Share point 2010 unit and integration testingEric Shupps
 
Hadoop testing workshop - july 2013
Hadoop testing workshop - july 2013Hadoop testing workshop - july 2013
Hadoop testing workshop - july 2013Ophir Cohen
 
Agile Acceptance testing with Fitnesse
Agile Acceptance testing with FitnesseAgile Acceptance testing with Fitnesse
Agile Acceptance testing with FitnesseClareMcLennan
 
Test case management with MTM 2013
Test case management with MTM 2013Test case management with MTM 2013
Test case management with MTM 2013Raluca Suditu
 
Test automation engineer
Test automation engineerTest automation engineer
Test automation engineerSadaaki Emura
 
Week 14 Unit Testing.pptx
Week 14  Unit Testing.pptxWeek 14  Unit Testing.pptx
Week 14 Unit Testing.pptxmianshafa
 
Unit testing using Munit Part 1
Unit testing using Munit Part 1Unit testing using Munit Part 1
Unit testing using Munit Part 1Anand kalla
 
Software Testing Strategies
Software Testing StrategiesSoftware Testing Strategies
Software Testing StrategiesAlpana Bhaskar
 
Test automation principles, terminologies and implementations
Test automation principles, terminologies and implementationsTest automation principles, terminologies and implementations
Test automation principles, terminologies and implementationsSteven Li
 

Similaire à 20070514 introduction to test ng and its application for test driven gui development (20)

TestNG introduction
TestNG introductionTestNG introduction
TestNG introduction
 
Test NG Framework Complete Walk Through
Test NG Framework Complete Walk ThroughTest NG Framework Complete Walk Through
Test NG Framework Complete Walk Through
 
Database Unit Testing Made Easy with VSTS
Database Unit Testing Made Easy with VSTSDatabase Unit Testing Made Easy with VSTS
Database Unit Testing Made Easy with VSTS
 
Software testing part
Software testing partSoftware testing part
Software testing part
 
Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.
 
testng
testngtestng
testng
 
UNIT TESTING PPT
UNIT TESTING PPTUNIT TESTING PPT
UNIT TESTING PPT
 
Higher Order Testing
Higher Order TestingHigher Order Testing
Higher Order Testing
 
Share point 2010 unit and integration testing
Share point 2010 unit and integration testingShare point 2010 unit and integration testing
Share point 2010 unit and integration testing
 
Hadoop testing workshop - july 2013
Hadoop testing workshop - july 2013Hadoop testing workshop - july 2013
Hadoop testing workshop - july 2013
 
Software testing methods
Software testing methodsSoftware testing methods
Software testing methods
 
Agile Acceptance testing with Fitnesse
Agile Acceptance testing with FitnesseAgile Acceptance testing with Fitnesse
Agile Acceptance testing with Fitnesse
 
Test case management with MTM 2013
Test case management with MTM 2013Test case management with MTM 2013
Test case management with MTM 2013
 
Manual testing - Introduction to Manual Software testing
Manual testing - Introduction to Manual Software testingManual testing - Introduction to Manual Software testing
Manual testing - Introduction to Manual Software testing
 
Test automation engineer
Test automation engineerTest automation engineer
Test automation engineer
 
TDD - Unit Testing
TDD - Unit TestingTDD - Unit Testing
TDD - Unit Testing
 
Week 14 Unit Testing.pptx
Week 14  Unit Testing.pptxWeek 14  Unit Testing.pptx
Week 14 Unit Testing.pptx
 
Unit testing using Munit Part 1
Unit testing using Munit Part 1Unit testing using Munit Part 1
Unit testing using Munit Part 1
 
Software Testing Strategies
Software Testing StrategiesSoftware Testing Strategies
Software Testing Strategies
 
Test automation principles, terminologies and implementations
Test automation principles, terminologies and implementationsTest automation principles, terminologies and implementations
Test automation principles, terminologies and implementations
 

Plus de Will Shen

20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)
20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)
20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)Will Shen
 
16格筆記讀書法
16格筆記讀書法16格筆記讀書法
16格筆記讀書法Will Shen
 
Intro To BOOST.Spirit
Intro To BOOST.SpiritIntro To BOOST.Spirit
Intro To BOOST.SpiritWill Shen
 
20060411 face recognition using face arg matching
20060411 face recognition using face arg matching20060411 face recognition using face arg matching
20060411 face recognition using face arg matchingWill Shen
 
20060411 Analytic Hierarchy Process (AHP)
20060411 Analytic Hierarchy Process (AHP)20060411 Analytic Hierarchy Process (AHP)
20060411 Analytic Hierarchy Process (AHP)Will Shen
 
20050713 critical paths for gui regression testing
20050713 critical paths for gui regression testing20050713 critical paths for gui regression testing
20050713 critical paths for gui regression testingWill Shen
 
20050314 specification based regression test selection with risk analysis
20050314 specification based regression test selection with risk analysis20050314 specification based regression test selection with risk analysis
20050314 specification based regression test selection with risk analysisWill Shen
 
20041113 A Test Generation Tool for Specifications in the Form of State Machine
20041113 A Test Generation Tool for Specifications in the Form of State Machine20041113 A Test Generation Tool for Specifications in the Form of State Machine
20041113 A Test Generation Tool for Specifications in the Form of State MachineWill Shen
 
Junit Recipes - Elementary tests (2/2)
Junit Recipes - Elementary tests (2/2)Junit Recipes - Elementary tests (2/2)
Junit Recipes - Elementary tests (2/2)Will Shen
 
Junit Recipes - Elementary tests (1/2)
Junit Recipes  - Elementary tests (1/2)Junit Recipes  - Elementary tests (1/2)
Junit Recipes - Elementary tests (1/2)Will Shen
 
Junit Recipes - Intro
Junit Recipes - IntroJunit Recipes - Intro
Junit Recipes - IntroWill Shen
 
20051019 automating regression testing for evolving gui software
20051019 automating regression testing for evolving gui software20051019 automating regression testing for evolving gui software
20051019 automating regression testing for evolving gui softwareWill Shen
 
20060712 automated model based testing of community-driven open-source gui ap...
20060712 automated model based testing of community-driven open-source gui ap...20060712 automated model based testing of community-driven open-source gui ap...
20060712 automated model based testing of community-driven open-source gui ap...Will Shen
 
20041221 gui testing survey
20041221 gui testing survey20041221 gui testing survey
20041221 gui testing surveyWill Shen
 
20060927 application facades
20060927 application facades20060927 application facades
20060927 application facadesWill Shen
 
Data collection for field studies
Data collection for field studiesData collection for field studies
Data collection for field studiesWill Shen
 

Plus de Will Shen (16)

20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)
20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)
20180717 Introduction of Seamless BLE Connection Migration System (SeamBlue)
 
16格筆記讀書法
16格筆記讀書法16格筆記讀書法
16格筆記讀書法
 
Intro To BOOST.Spirit
Intro To BOOST.SpiritIntro To BOOST.Spirit
Intro To BOOST.Spirit
 
20060411 face recognition using face arg matching
20060411 face recognition using face arg matching20060411 face recognition using face arg matching
20060411 face recognition using face arg matching
 
20060411 Analytic Hierarchy Process (AHP)
20060411 Analytic Hierarchy Process (AHP)20060411 Analytic Hierarchy Process (AHP)
20060411 Analytic Hierarchy Process (AHP)
 
20050713 critical paths for gui regression testing
20050713 critical paths for gui regression testing20050713 critical paths for gui regression testing
20050713 critical paths for gui regression testing
 
20050314 specification based regression test selection with risk analysis
20050314 specification based regression test selection with risk analysis20050314 specification based regression test selection with risk analysis
20050314 specification based regression test selection with risk analysis
 
20041113 A Test Generation Tool for Specifications in the Form of State Machine
20041113 A Test Generation Tool for Specifications in the Form of State Machine20041113 A Test Generation Tool for Specifications in the Form of State Machine
20041113 A Test Generation Tool for Specifications in the Form of State Machine
 
Junit Recipes - Elementary tests (2/2)
Junit Recipes - Elementary tests (2/2)Junit Recipes - Elementary tests (2/2)
Junit Recipes - Elementary tests (2/2)
 
Junit Recipes - Elementary tests (1/2)
Junit Recipes  - Elementary tests (1/2)Junit Recipes  - Elementary tests (1/2)
Junit Recipes - Elementary tests (1/2)
 
Junit Recipes - Intro
Junit Recipes - IntroJunit Recipes - Intro
Junit Recipes - Intro
 
20051019 automating regression testing for evolving gui software
20051019 automating regression testing for evolving gui software20051019 automating regression testing for evolving gui software
20051019 automating regression testing for evolving gui software
 
20060712 automated model based testing of community-driven open-source gui ap...
20060712 automated model based testing of community-driven open-source gui ap...20060712 automated model based testing of community-driven open-source gui ap...
20060712 automated model based testing of community-driven open-source gui ap...
 
20041221 gui testing survey
20041221 gui testing survey20041221 gui testing survey
20041221 gui testing survey
 
20060927 application facades
20060927 application facades20060927 application facades
20060927 application facades
 
Data collection for field studies
Data collection for field studiesData collection for field studies
Data collection for field studies
 

Dernier

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 

Dernier (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 

20070514 introduction to test ng and its application for test driven gui development

  • 1. Introduction to TestNG and its Application for Test-Driven GUI Development Zheng-Wen Shen 2007/05/14 1
  • 2. References 1. "TestNG makes Java unit testing a breeze“, Filippo Diotalevi, developerWorks, January 2005 2. "In pursuit of code quality: JUnit 4 vs. TestNG“, Andrew Glover, developerWorks, Aug 2006 3. "In pursuit of code quality: Automate GUI testing with TestNG-Abbot“, Andrew Glover, developerWorks, February 2007 4. Alex Ruiz, Yvonne Wang Price, "Test-Driven GUI Development with TestNG and Abbot," IEEE Software, vol. 24, no. 3, pp. 51-57, May/Jun, 2007. 2
  • 3. Outline 1. Introduction 2. TestNG Quick Start 3. TestNG Features 4. TestNG-Abbot: Test-Driven GUI Development 5. Summary 3
  • 4. 1. Introduction 1/4 • JUnit: simple, pragmatic, and strict architecture • Rules for using JUnit of unit testing – Every single piece of code must be tested. – Code must be tested in isolation (mock objects). – Software must be easy testable (written with tests in mind.) 4
  • 5. 1. Introduction 2/4 Two opposed factions KISS principle The simplicity is necessary Advanced features! more flexibility! more power! 5
  • 6. 1. Introduction 3/4 Some peculiar features of JUnit • The need to extend a TestCase class • Impossible to pass parameters (setUp, tearDown) • The execution model is a bit strange – The test class is reinstantiated every time a test method is executed. • The management of different suites of tests in complex projects can be very tricky. 6
  • 7. 1. Introduction 4/4 1. TestNG: Testing, the Next Generation • To cover all categories of tests: unit, functional, end-to-end, integration, … • JDK 5 Annotation • Flexible test configuration • Powerful execution model (no more TestSuite) Cedric Beust 2. TestNG-Abbot • 0.3.2 Release, 2007/05/08 • Capture-Replay GUI Testing • Test-Driven GUI Development 7
  • 8. 2. TestNG Quick Start 1/3 A Test Class 1 The Lang Component provides a host of helper utilities for the java.lang API, 2 3 notably String manipulation methods, basic numerical methods, object reflection, creation and serialization, and System properties. 8
  • 9. 2. TestNG Quick Start 2/3 Configuration XML testing.xml Suite Test 1 groups classes Test 2 groups classes … 9
  • 10. 2. TestNG Quick Start 3/3 Test Results HTML output 10
  • 11. 3. TestNG Features 1. Configuration Methods 2. Test Group 3. Dependency Testing 4. Parametric Testing 5. Factories 6. Fail and Rerun 11
  • 12. 3.1 Configuration Methods 1/1 Enter • @Configuration beforeTestClass methods 1. beforeTestClass 2. afterTestClass beforeTestMethod methods 3. beforeTestMethod first test method 4. afterTestMethod afterTestMethod methods beforeTestMethod methods second test method afterTestMethod methods … afterTestClass methods 12 Exit
  • 13. 3.2 Test Group 1/2 • Groupings of test methods • Maximum flexibility doesn’t recompile anything • Check-in tests – Run before submit new code – Fast, just make sure no basic functionality was broken • Functional tests – Cover all the functionalities of software – Run at least once a day Functional Test Check-in tests 13
  • 14. 3.2 Test Group 2/2 testing.xml Functional Test testMethod1 Check-in tests testMethod2 testMethod3 testMethod1 testMethod2 14
  • 15. 3.3 Dependency Testing 1/2 • Invoke test methods in a certain order. – A certain number of test methods have completed and succeeded before running more test methods. – Initialization methods to be test methods • Hard dependencies • Soft dependencies 15
  • 16. 3.3 Dependency Testing 2/2 (Hard) Dependency on method (Hard) Dependency on group Soft Dependency @Test {groups = {…} alwaysRun=true} 16
  • 17. 3.4 Parametric Testing 1/3 • Use arbitrary number of parameters on test method • Instruct TestNG to pass the correct parameters with the @Parameters annotation. – From testng.xml – From DataProviders 17
  • 18. 3.4 Parametric Testing 2/3 From testing.xml testing.xml first-name = “Cedric” 18
  • 19. 3.4 Parametric Testing 3/3 From DataProviders Same class Different classes 19
  • 20. 3.5 Factories 1/2 • Create tests dynamically. – Access a Web page several times with different values Test Method 20
  • 22. 3.6 Fail and Rerun 1/1 Delineates the failed tests Run TestNG testing.xml testing_failed.xml 22
  • 23. 4. TestNG-Abbot 1/4 Test-Driven GUI Development • TestNG-Abbot (0.3.2 release, 2007/05/08) • Intuitive fixture classes – Logically linked to the code under test by name only. – Tests do not rely on GUI components being specifically located – Tests can be authored early and withstand layout and aesthetic changes during the development phase 23
  • 24. 4. TestNG-Abbot 2/4 Application Under Test 1. The user enters name and email address 2. The email address must be valid 3. The system displays an error message if the required input is missing or invalid 24
  • 25. 4. TestNG-Abbot 3/4 The test class for testing Model NewEmailAccountWizard View Email Model 25
  • 26. 4. TestNG-Abbot 4/4 The test class for testing View 1 2 3 4 5 26
  • 27. 5. Summary • TestNG – annotations-based framework – Make the whole testing process much more simple and flexible – Free to choose the testing strategy you prefer • Practice TDD, even for GUIs 27