Submit Search
Upload
Python Programming Essentials - M39 - Unit Testing
•
1 like
•
1,326 views
P3 InfoTech Solutions Pvt. Ltd.
Follow
Slides from the training on the topic "Python Programming Essentials"
Read less
Read more
Report
Share
Report
Share
1 of 20
Recommended
Python Programming Essentials - M37 - Brief Overview of Misc Concepts
Python Programming Essentials - M37 - Brief Overview of Misc Concepts
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M35 - Iterators & Generators
Python Programming Essentials - M35 - Iterators & Generators
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M21 - Exception Handling
Python Programming Essentials - M21 - Exception Handling
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M27 - Logging module
Python Programming Essentials - M27 - Logging module
P3 InfoTech Solutions Pvt. Ltd.
Test Driven Development With Python
Test Driven Development With Python
Siddhi
unittest in 5 minutes
unittest in 5 minutes
Ray Toal
Python testing
Python testing
John(Qiang) Zhang
Python Unit Test
Python Unit Test
David Xie
Recommended
Python Programming Essentials - M37 - Brief Overview of Misc Concepts
Python Programming Essentials - M37 - Brief Overview of Misc Concepts
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M35 - Iterators & Generators
Python Programming Essentials - M35 - Iterators & Generators
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M21 - Exception Handling
Python Programming Essentials - M21 - Exception Handling
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M27 - Logging module
Python Programming Essentials - M27 - Logging module
P3 InfoTech Solutions Pvt. Ltd.
Test Driven Development With Python
Test Driven Development With Python
Siddhi
unittest in 5 minutes
unittest in 5 minutes
Ray Toal
Python testing
Python testing
John(Qiang) Zhang
Python Unit Test
Python Unit Test
David Xie
Pyunit
Pyunit
Ikuru Kanuma
Python Testing Fundamentals
Python Testing Fundamentals
cbcunc
PHPUnit
PHPUnit
Hampton Roads PHP User Grop
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
Python unittest
Python unittest
Felipe Ruhland
Effective testing with pytest
Effective testing with pytest
Hector Canto
Python testing using mock and pytest
Python testing using mock and pytest
Suraj Deshmukh
Modern Python Testing
Modern Python Testing
Alexander Loechel
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-framework
Arulalan T
Test Driven Development with PHPUnit
Test Driven Development with PHPUnit
Mindfire Solutions
Python unit testing
Python unit testing
Darryl Sherman
PHPUnit: from zero to hero
PHPUnit: from zero to hero
Jeremy Cook
Unit Testng with PHP Unit - A Step by Step Training
Unit Testng with PHP Unit - A Step by Step Training
Ram Awadh Prasad, PMP
Phpunit
Phpunit
japan_works
Phpunit testing
Phpunit testing
Nikunj Bhatnagar
Test your code like a pro - PHPUnit in practice
Test your code like a pro - PHPUnit in practice
Sebastian Marek
Advanced PHPUnit Testing
Advanced PHPUnit Testing
Mike Lively
Introduction to Unit Testing with PHPUnit
Introduction to Unit Testing with PHPUnit
Michelangelo van Dam
20111018 boost and gtest
20111018 boost and gtest
Will Shen
Rc2010 tdd
Rc2010 tdd
JasonOffutt
Python Programming Essentials - M28 - Debugging with pdb
Python Programming Essentials - M28 - Debugging with pdb
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M40 - Invoking External Programs
Python Programming Essentials - M40 - Invoking External Programs
P3 InfoTech Solutions Pvt. Ltd.
More Related Content
What's hot
Pyunit
Pyunit
Ikuru Kanuma
Python Testing Fundamentals
Python Testing Fundamentals
cbcunc
PHPUnit
PHPUnit
Hampton Roads PHP User Grop
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
Python unittest
Python unittest
Felipe Ruhland
Effective testing with pytest
Effective testing with pytest
Hector Canto
Python testing using mock and pytest
Python testing using mock and pytest
Suraj Deshmukh
Modern Python Testing
Modern Python Testing
Alexander Loechel
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-framework
Arulalan T
Test Driven Development with PHPUnit
Test Driven Development with PHPUnit
Mindfire Solutions
Python unit testing
Python unit testing
Darryl Sherman
PHPUnit: from zero to hero
PHPUnit: from zero to hero
Jeremy Cook
Unit Testng with PHP Unit - A Step by Step Training
Unit Testng with PHP Unit - A Step by Step Training
Ram Awadh Prasad, PMP
Phpunit
Phpunit
japan_works
Phpunit testing
Phpunit testing
Nikunj Bhatnagar
Test your code like a pro - PHPUnit in practice
Test your code like a pro - PHPUnit in practice
Sebastian Marek
Advanced PHPUnit Testing
Advanced PHPUnit Testing
Mike Lively
Introduction to Unit Testing with PHPUnit
Introduction to Unit Testing with PHPUnit
Michelangelo van Dam
20111018 boost and gtest
20111018 boost and gtest
Will Shen
Rc2010 tdd
Rc2010 tdd
JasonOffutt
What's hot
(20)
Pyunit
Pyunit
Python Testing Fundamentals
Python Testing Fundamentals
PHPUnit
PHPUnit
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 unittest
Python unittest
Effective testing with pytest
Effective testing with pytest
Python testing using mock and pytest
Python testing using mock and pytest
Modern Python Testing
Modern Python Testing
Testing in-python-and-pytest-framework
Testing in-python-and-pytest-framework
Test Driven Development with PHPUnit
Test Driven Development with PHPUnit
Python unit testing
Python unit testing
PHPUnit: from zero to hero
PHPUnit: from zero to hero
Unit Testng with PHP Unit - A Step by Step Training
Unit Testng with PHP Unit - A Step by Step Training
Phpunit
Phpunit
Phpunit testing
Phpunit testing
Test your code like a pro - PHPUnit in practice
Test your code like a pro - PHPUnit in practice
Advanced PHPUnit Testing
Advanced PHPUnit Testing
Introduction to Unit Testing with PHPUnit
Introduction to Unit Testing with PHPUnit
20111018 boost and gtest
20111018 boost and gtest
Rc2010 tdd
Rc2010 tdd
Viewers also liked
Python Programming Essentials - M28 - Debugging with pdb
Python Programming Essentials - M28 - Debugging with pdb
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M40 - Invoking External Programs
Python Programming Essentials - M40 - Invoking External Programs
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M31 - PEP 8
Python Programming Essentials - M31 - PEP 8
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M44 - Overview of Web Development
Python Programming Essentials - M44 - Overview of Web Development
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M25 - os and sys modules
Python Programming Essentials - M25 - os and sys modules
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M29 - Python Interpreter and Files
Python Programming Essentials - M29 - Python Interpreter and Files
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M34 - List Comprehensions
Python Programming Essentials - M34 - List Comprehensions
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M5 - Variables
Python Programming Essentials - M5 - Variables
P3 InfoTech Solutions Pvt. Ltd.
Introduction To Django
Introduction To Django
Tuan Anh Tran
Python Programming Essentials - M15 - References
Python Programming Essentials - M15 - References
P3 InfoTech Solutions Pvt. Ltd.
Automated hardware testing using python
Automated hardware testing using python
Yuvaraja Ravi
Learn python
Learn python
Kracekumar Ramaraju
Python Programming Essentials - M2 - Introduction to Python
Python Programming Essentials - M2 - Introduction to Python
P3 InfoTech Solutions Pvt. Ltd.
Why I Love Python V2
Why I Love Python V2
gsroma
Viewers also liked
(14)
Python Programming Essentials - M28 - Debugging with pdb
Python Programming Essentials - M28 - Debugging with pdb
Python Programming Essentials - M40 - Invoking External Programs
Python Programming Essentials - M40 - Invoking External Programs
Python Programming Essentials - M31 - PEP 8
Python Programming Essentials - M31 - PEP 8
Python Programming Essentials - M44 - Overview of Web Development
Python Programming Essentials - M44 - Overview of Web Development
Python Programming Essentials - M25 - os and sys modules
Python Programming Essentials - M25 - os and sys modules
Python Programming Essentials - M29 - Python Interpreter and Files
Python Programming Essentials - M29 - Python Interpreter and Files
Python Programming Essentials - M34 - List Comprehensions
Python Programming Essentials - M34 - List Comprehensions
Python Programming Essentials - M5 - Variables
Python Programming Essentials - M5 - Variables
Introduction To Django
Introduction To Django
Python Programming Essentials - M15 - References
Python Programming Essentials - M15 - References
Automated hardware testing using python
Automated hardware testing using python
Learn python
Learn python
Python Programming Essentials - M2 - Introduction to Python
Python Programming Essentials - M2 - Introduction to Python
Why I Love Python V2
Why I Love Python V2
Similar to Python Programming Essentials - M39 - Unit Testing
TEST AUTOMATION: AKA QUALITY CONTROL
TEST AUTOMATION: AKA QUALITY CONTROL
Nyarai Tinashe Gomiwa
TEST AUTOMATION: AKA QUALITY CONTROL
TEST AUTOMATION: AKA QUALITY CONTROL
SovTech
Junit_.pptx
Junit_.pptx
Suman Sourav
Unit testing for WordPress
Unit testing for WordPress
Harshad Mane
MT_01_unittest_python.pdf
MT_01_unittest_python.pdf
Hans Jones
Unit testing php-unit - phing - selenium_v2
Unit testing php-unit - phing - selenium_v2
Tricode (part of Dept)
Php unit (eng)
Php unit (eng)
Anatoliy Okhotnikov
qtp 9.2 features
qtp 9.2 features
krishna3032
Qtp 92 Tutorial
Qtp 92 Tutorial
sasidhar
Ppt Qtp
Ppt Qtp
rosaleenm
Qtp 92 Tutorial769
Qtp 92 Tutorial769
subhasis100
Qtp 92 Tutorial Anil
Qtp 92 Tutorial Anil
guest3373d3
Qtp 9.2 Tutorial
Qtp 9.2 Tutorial
guest37ae7f
Qtp 92 Tutorial769
Qtp 92 Tutorial769
vinayaka.nadiger
Qtp 92 Tutorial769
Qtp 92 Tutorial769
subhasis100
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
Enterprise PHP Center
Application Testing
Application Testing
Reggie Niccolo Santos
Unit testing with JUnit
Unit testing with JUnit
Pokpitch Patcharadamrongkul
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Comunidade NetPonto
Unit testingandcontinousintegrationfreenest1dot4
Unit testingandcontinousintegrationfreenest1dot4
JAMK
Similar to Python Programming Essentials - M39 - Unit Testing
(20)
TEST AUTOMATION: AKA QUALITY CONTROL
TEST AUTOMATION: AKA QUALITY CONTROL
TEST AUTOMATION: AKA QUALITY CONTROL
TEST AUTOMATION: AKA QUALITY CONTROL
Junit_.pptx
Junit_.pptx
Unit testing for WordPress
Unit testing for WordPress
MT_01_unittest_python.pdf
MT_01_unittest_python.pdf
Unit testing php-unit - phing - selenium_v2
Unit testing php-unit - phing - selenium_v2
Php unit (eng)
Php unit (eng)
qtp 9.2 features
qtp 9.2 features
Qtp 92 Tutorial
Qtp 92 Tutorial
Ppt Qtp
Ppt Qtp
Qtp 92 Tutorial769
Qtp 92 Tutorial769
Qtp 92 Tutorial Anil
Qtp 92 Tutorial Anil
Qtp 9.2 Tutorial
Qtp 9.2 Tutorial
Qtp 92 Tutorial769
Qtp 92 Tutorial769
Qtp 92 Tutorial769
Qtp 92 Tutorial769
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
EPHPC Webinar Slides: Unit Testing by Arthur Purnama
Application Testing
Application Testing
Unit testing with JUnit
Unit testing with JUnit
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Testes? Mas isso não aumenta o tempo de projecto? Não quero...
Unit testingandcontinousintegrationfreenest1dot4
Unit testingandcontinousintegrationfreenest1dot4
More from P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M24 - math module
Python Programming Essentials - M24 - math module
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M23 - datetime module
Python Programming Essentials - M23 - datetime module
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M22 - File Operations
Python Programming Essentials - M22 - File Operations
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M20 - Classes and Objects
Python Programming Essentials - M20 - Classes and Objects
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M19 - Namespaces, Global Variables and Docstr...
Python Programming Essentials - M19 - Namespaces, Global Variables and Docstr...
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M18 - Modules and Packages
Python Programming Essentials - M18 - Modules and Packages
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M17 - Functions
Python Programming Essentials - M17 - Functions
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M16 - Control Flow Statements and Loops
Python Programming Essentials - M16 - Control Flow Statements and Loops
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M14 - Dictionaries
Python Programming Essentials - M14 - Dictionaries
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M13 - Tuples
Python Programming Essentials - M13 - Tuples
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M12 - Lists
Python Programming Essentials - M12 - Lists
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M11 - Comparison and Logical Operators
Python Programming Essentials - M11 - Comparison and Logical Operators
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M10 - Numbers and Artihmetic Operators
Python Programming Essentials - M10 - Numbers and Artihmetic Operators
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M9 - String Formatting
Python Programming Essentials - M9 - String Formatting
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M8 - String Methods
Python Programming Essentials - M8 - String Methods
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M7 - Strings
Python Programming Essentials - M7 - Strings
P3 InfoTech Solutions Pvt. Ltd.
Python Programming Essentials - M6 - Code Blocks and Indentation
Python Programming Essentials - M6 - Code Blocks and Indentation
P3 InfoTech Solutions Pvt. Ltd.
More from P3 InfoTech Solutions Pvt. Ltd.
(17)
Python Programming Essentials - M24 - math module
Python Programming Essentials - M24 - math module
Python Programming Essentials - M23 - datetime module
Python Programming Essentials - M23 - datetime module
Python Programming Essentials - M22 - File Operations
Python Programming Essentials - M22 - File Operations
Python Programming Essentials - M20 - Classes and Objects
Python Programming Essentials - M20 - Classes and Objects
Python Programming Essentials - M19 - Namespaces, Global Variables and Docstr...
Python Programming Essentials - M19 - Namespaces, Global Variables and Docstr...
Python Programming Essentials - M18 - Modules and Packages
Python Programming Essentials - M18 - Modules and Packages
Python Programming Essentials - M17 - Functions
Python Programming Essentials - M17 - Functions
Python Programming Essentials - M16 - Control Flow Statements and Loops
Python Programming Essentials - M16 - Control Flow Statements and Loops
Python Programming Essentials - M14 - Dictionaries
Python Programming Essentials - M14 - Dictionaries
Python Programming Essentials - M13 - Tuples
Python Programming Essentials - M13 - Tuples
Python Programming Essentials - M12 - Lists
Python Programming Essentials - M12 - Lists
Python Programming Essentials - M11 - Comparison and Logical Operators
Python Programming Essentials - M11 - Comparison and Logical Operators
Python Programming Essentials - M10 - Numbers and Artihmetic Operators
Python Programming Essentials - M10 - Numbers and Artihmetic Operators
Python Programming Essentials - M9 - String Formatting
Python Programming Essentials - M9 - String Formatting
Python Programming Essentials - M8 - String Methods
Python Programming Essentials - M8 - String Methods
Python Programming Essentials - M7 - Strings
Python Programming Essentials - M7 - Strings
Python Programming Essentials - M6 - Code Blocks and Indentation
Python Programming Essentials - M6 - Code Blocks and Indentation
Python Programming Essentials - M39 - Unit Testing
1.
http://www.skillbrew.com /SkillbrewTalent brewed by
the industry itself Unit Testing Pavan Verma @YinYangPavan Founder, P3 InfoTech Solutions Pvt. Ltd. Python Programming Essentials
2.
© SkillBrew http://skillbrew.com What
is Unit Testing A software testing method by which individual units of source code are tested to determine if they are fit for use. Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation. Unit testing is often automated but it can also be done manually.
3.
© SkillBrew http://skillbrew.com Unit
Testing Glossary test fixture – A test fixture represents the preparation needed to perform one or more tests, and any associate cleanup actions. This may involve, for example, creating temporary or proxy databases, directories, or starting a server process.
4.
© SkillBrew http://skillbrew.com Unit
Testing Glossary (2) test case – A test case is the smallest unit of testing. It checks for a specific response to a particular set of inputs. Python unittest module provides a base class, TestCase, which may be used to create new test cases.
5.
© SkillBrew http://skillbrew.com Unit
Testing Glossary (3) test suite – A test suite is a collection of test cases, test suites, or both. It is used to aggregate tests that should be executed together.
6.
© SkillBrew http://skillbrew.com Unit
Testing Glossary (4) test runner – A test runner is a component which orchestrates the execution of tests and provides the outcome to the user. The runner may use a graphical interface, a textual interface, or return a special value to indicate the results of executing the tests.
7.
© SkillBrew http://skillbrew.com Unittest
module The unittest module started life as the third-party module PyUnit. PyUnit was a Python port of JUnit, the Java unit testing framework.
8.
© SkillBrew http://skillbrew.com Program
to test – primes.py def is_prime(number): """Return True if *number* is prime.""“ for element in range(number): if number % element == 0: return False return True
9.
© SkillBrew http://skillbrew.com Basic
unit test example import unittest from primes import is_prime class PrimesTestCase(unittest.TestCase): """Tests for `primes.py`.""“ def test_is_five_prime(self): """Is five successfully determined to be prime?""“ self.assertTrue(is_prime(5)) if __name__ == '__main__': unittest.main()
10.
© SkillBrew http://skillbrew.com Running
a unit test $ python test_primes.py E ====================================================================== ERROR: test_is_five_prime (__main__.PrimesTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "test_primes.py", line 8, in test_is_five_prime self.assertTrue(is_prime(5)) File "/home/jknupp/code/github_code/blug_private/primes.py", line 4, in is_prime if number % element == 0: ZeroDivisionError: integer division or modulo by zero ---------------------------------------------------------------------- Ran 1 test in 0.000s
11.
© SkillBrew http://skillbrew.com Assertions Method
Checks that assertEqual(a, b) a == b assertNotEqual(a, b) a != b assertTrue(x) bool(x) is True assertFalse(x) bool(x) is False assertIs(a, b) a is b assertIsNot(a, b) a is not b assertIsNone(x) x is None assertIsNotNone(x) x is not None assertIn(a, b) a in b assertNotIn(a, b) a not in b assertIsInstance(a, b) isinstance(a, b) assertNotIsInstance(a, b) not isinstance(a, b)
12.
© SkillBrew http://skillbrew.com Assertions
(2) Method Checks that assertAlmostEqual(a, b) round(a-b, 7) == 0 assertNotAlmostEqual(a, b) round(a-b, 7) != 0 assertGreater(a, b) a > b assertGreaterEqual(a, b) a >= b assertLess(a, b) a < b assertLessEqual(a, b) a <= b assertRegexpMatches(s, r) r.search(s) assertNotRegexpMatches(s, r) not r.search(s) assertItemsEqual(a, b) sorted(a) == sorted(b) and works with unhashable objs assertDictContainsSubset(a, b) all the key/value pairs in a exist in b
13.
© SkillBrew http://skillbrew.com setUp
and tearDown #!/usr/bin/python import unittest class FooTest(unittest.TestCase): """Sample test case""" # preparing to test def setUp(self): """ Setting up for the test """ print "FooTest:setUp_:begin" ## do something... print "FooTest:setUp_:end" # ending the test
14.
© SkillBrew http://skillbrew.com setUp
and tearDown (2) def tearDown(self): """Cleaning up after the test""" print "FooTest:tearDown_:begin" ## do something... print "FooTest:tearDown_:end" # test routine A def testA(self): """Test routine A""" print "FooTest:testA" # test routine B def testB(self): """Test routine B""" print "FooTest:testB"
15.
© SkillBrew http://skillbrew.com setUp
and tearDown (3)
16.
© SkillBrew http://skillbrew.com Unittest
features setupClass() / tearDownClass() Skip tests Expected failures
17.
© SkillBrew http://skillbrew.com Testing
Frameworks pytest Nose
18.
© SkillBrew http://skillbrew.com Code
coverage coverage http://nedbatchelder.com/code/coverage/
19.
© SkillBrew http://skillbrew.com References
https://docs.python.org/2/library/unittest.ht ml http://pytest.org/ http://nose.readthedocs.org/ http://nedbatchelder.com/code/coverage/