-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
112 lines (106 loc) · 16.8 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<!DOCTYPE html>
<html lang="en-US" xmlns:fb="https://www.facebook.com/2008/fbml" xmlns:addthis="https://www.addthis.com/help/api-spec">
<head>
<meta charset="UTF-8" />
<title>Python Unittest Framework – Beginners Tutorial with Examples</title> <meta name="robots" content="noodp,noydir" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="dns-prefetch" href="//fonts.googleapis.com" />
<link rel="dns-prefetch" href="//s.w.org" />
<link rel="alternate" type="application/rss+xml" title="Try QA » Feed" href="http://tryqa.com/feed/" />
<link rel="alternate" type="application/rss+xml" title="Try QA » Comments Feed" href="http://tryqa.com/comments/feed/" />
<link rel="alternate" type="application/rss+xml" title="Try QA » Python Unittest Framework – Beginners Tutorial with Examples Comments Feed" href="http://tryqa.com/python-unittest-framework-tutorial-examples/feed/" />
<link rel="canonical" href="http://tryqa.com/python-unittest-framework-tutorial-examples/" />
<script type="text/javascript">
window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.2.1\/72x72\/","ext":".png","svgUrl":"https:\/\/s.w.org\/images\/core\/emoji\/2.2.1\/svg\/","svgExt":".svg","source":{"concatemoji":"http:\/\/tryqa.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.7.27"}};
!function(t,a,e){var r,n,i,o=a.createElement("canvas"),l=o.getContext&&o.getContext("2d");function c(t){var e=a.createElement("script");e.src=t,e.defer=e.type="text/javascript",a.getElementsByTagName("head")[0].appendChild(e)}for(i=Array("flag","emoji4"),e.supports={everything:!0,everythingExceptFlag:!0},n=0;n<i.length;n++)e.supports[i[n]]=function(t){var e,a=String.fromCharCode;if(!l||!l.fillText)return!1;switch(l.clearRect(0,0,o.width,o.height),l.textBaseline="top",l.font="600 32px Arial",t){case"flag":return(l.fillText(a(55356,56826,55356,56819),0,0),o.toDataURL().length<3e3)?!1:(l.clearRect(0,0,o.width,o.height),l.fillText(a(55356,57331,65039,8205,55356,57096),0,0),e=o.toDataURL(),l.clearRect(0,0,o.width,o.height),l.fillText(a(55356,57331,55356,57096),0,0),e!==o.toDataURL());case"emoji4":return l.fillText(a(55357,56425,55356,57341,8205,55357,56507),0,0),e=o.toDataURL(),l.clearRect(0,0,o.width,o.height),l.fillText(a(55357,56425,55356,57341,55357,56507),0,0),e!==o.toDataURL()}return!1}(i[n]),e.supports.everything=e.supports.everything&&e.supports[i[n]],"flag"!==i[n]&&(e.supports.everythingExceptFlag=e.supports.everythingExceptFlag&&e.supports[i[n]]);e.supports.everythingExceptFlag=e.supports.everythingExceptFlag&&!e.supports.flag,e.DOMReady=!1,e.readyCallback=function(){e.DOMReady=!0},e.supports.everything||(r=function(){e.readyCallback()},a.addEventListener?(a.addEventListener("DOMContentLoaded",r,!1),t.addEventListener("load",r,!1)):(t.attachEvent("onload",r),a.attachEvent("onreadystatechange",function(){"complete"===a.readyState&&e.readyCallback()})),(r=e.source||{}).concatemoji?c(r.concatemoji):r.wpemoji&&r.twemoji&&(c(r.twemoji),c(r.wpemoji)))}(window,document,window._wpemojiSettings);
</script>
<style type="text/css">
img.wp-smiley,
img.emoji {
display: inline !important;
border: none !important;
box-shadow: none !important;
height: 1em !important;
width: 1em !important;
margin: 0 .07em !important;
vertical-align: -0.1em !important;
background: none !important;
padding: 0 !important;
}
</style>
<link rel="stylesheet" id="eleven40-pro-css" href="http://tryqa.com/wp-content/themes/eleven40-pro/style.css?ver=2.2.3" type="text/css" media="all" />
<link rel="stylesheet" id="toc-screen-css" href="http://tryqa.com/wp-content/plugins/table-of-contents-plus/screen.min.css?ver=1509" type="text/css" media="all" />
<link rel="stylesheet" id="dashicons-css" href="http://tryqa.com/wp-includes/css/dashicons.min.css?ver=4.7.27" type="text/css" media="all" />
<link rel="stylesheet" id="google-fonts-css" href="//fonts.googleapis.com/css?family=Open+Sans%3A400%7COswald%3A400&ver=2.4.2" type="text/css" media="all" />
<link rel="stylesheet" id="addthis_all_pages-css" href="http://tryqa.com/wp-content/plugins/addthis/frontend/build/addthis_wordpress_public.min.css?ver=4.7.27" type="text/css" media="all" />
<script type="text/javascript" src="http://tryqa.com/wp-includes/js/jquery/jquery.js?ver=1.12.4"></script>
<script type="text/javascript" src="http://tryqa.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1"></script>
<script type="text/javascript" src="http://tryqa.com/wp-content/themes/genesis/lib/js/skip-links.js?ver=4.7.27"></script>
<!--[if lt IE 9]>
<script type='text/javascript' src='http://tryqa.com/wp-content/themes/genesis/lib/js/html5shiv.min.js?ver=3.7.3'></script>
<![endif]-->
<script type="text/javascript" src="http://tryqa.com/wp-content/themes/eleven40-pro/js/responsive-menu.js?ver=1.0.0"></script>
<script type="text/javascript" src="http://tryqa.com/wp-content/plugins/optinmonster215a/assets/js/api.js?ver=2.1.5"></script>
<link rel="https://api.w.org/" href="http://tryqa.com/wp-json/" />
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://tryqa.com/xmlrpc.php?rsd" />
<link rel="alternate" type="application/json+oembed" href="http://tryqa.com/wp-json/oembed/1.0/embed?url=http%3A%2F%2Ftryqa.com%2Fpython-unittest-framework-tutorial-examples%2F" />
<link rel="alternate" type="text/xml+oembed" href="http://tryqa.com/wp-json/oembed/1.0/embed?url=http%3A%2F%2Ftryqa.com%2Fpython-unittest-framework-tutorial-examples%2F&format=xml" />
<link rel="icon" href="http://tryqa.com/wp-content/themes/eleven40-pro/images/favicon.ico" />
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-38219227-1', 'auto');
ga('send', 'pageview');
</script>
<script>
(function(h,o,t,j,a,r){
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
h._hjSettings={hjid:404843,hjsv:6};
a=o.getElementsByTagName('head')[0];
r=o.createElement('script');r.async=1;
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
a.appendChild(r);
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
</script>
<script>
var isTryMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isTryMobile.Android() || isTryMobile.BlackBerry() || isTryMobile.iOS() || isTryMobile.Opera() || isTryMobile.Windows());
}
};
</script>
</head>
<body class="post-template-default single single-post postid-2645 single-format-standard header-full-width sidebar-content-sidebar eleven40-pro-red" itemscope itemtype="http://schema.org/WebPage"><div class="site-container"><section><h2 class="screen-reader-text">Skip links</h2><ul class="genesis-skip-link"><li><a href="#genesis-nav-primary" class="screen-reader-shortcut"> Skip to primary navigation</a></li><li><a href="#genesis-content" class="screen-reader-shortcut"> Skip to content</a></li><li><a href="#genesis-sidebar-primary" class="screen-reader-shortcut"> Skip to primary sidebar</a></li><li><a href="#genesis-sidebar-secondary" class="screen-reader-shortcut"> Skip to secondary sidebar</a></li></ul></section>
<header class="site-header" itemscope itemtype="http://schema.org/WPHeader"><div class="wrap"><div class="title-area"><h1 class="site-title" itemprop="headline"><a href="http://tryqa.com/"><img style="height:40px;display:inline" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAUQAAAByCAMAAAAcYFjwAAACUlBMVEXmShn///8AAADmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShk3R0/mShnmShk3R083R0/mShnmShk3R0/mShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShk3R0/mShk3R083R083R083R083R083R0/mShnmShnmShk3R0/mShnmShnmShnmShnmShnmShnmShnmShnmShk3R083R0/mShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShnmShk3R08qzSuZAAAAxHRSTlMAAAAportFDnjk9pkiBlnPcg86tchOH5L0/KQqCW/d6H4RA0/J0lgyqrI3GYbw8oll19lkBUbBvECe+/eUJRR95g1dxUv+JJbqhSF346MtAVLLxE2t4pMe7j3UXALvghj5py/GcAuVtzzWYeuEFTB0M8xEqqCIRO40VXf4YDirgBY1szmQIGkEvWYim7vdZojMEfXndjMs8/0o8SdaBztVmY7sPz7pHRsa5eASznXe3NDaCrnt0Ul5+sp7K1FTn3+prDFja9gXxAAACGJJREFUeNrt3fl/E0UUAPA0sgJNyo0WCylbQKIICtYDylUERBbBq7JgOT1AsdKkJDUrIp6YmqaJGkRBGgVvvO/7mvxf5trNHjOzMzsJh7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bt/A4t4UZsirEUeRKrGCUBRIl62kc8zyuY+12xWxVjkJaxEE/78LH5yPfHuBHZyo0D5w0x7JodW4Y397SPeO5Mivmd/IjkYln30/v6I0Zqc1c2Q0b0Z7wiZnJ+F8Ry8CI21Ra6lJptRa03Iu7Ro5b5PztARswNuiEOu9Xi1BexqSkZoZfaODJc0rkzD2K/oyuG7Ad/oylM8Vd1CZSxVoSN2hGz6XyGWhVWb0Tz19Iq30tLRjFrwqgihYyLAkqi374ICmDqEQOU+sRoolT1UCqpUIsTNa5IfCidT1X7VCZV2rCprb3ThlFGy/qHKlcND1nXQqMasT6x/oiXZGTLJyzxLPcPNgTxsvyWKSACIiACIiACIiACIiACIiACIiACIiACIiD+fxHPAqIwItoPiKKIqw+2AKIY4owxbfD8REHEuT/AQygFEdt/nAxP8hRD/GnMSXgcqiDiz9PhmbKCiBt+keHBvIKIe36FpxsLIp77rRceES2G2L5qMjxnWwzxxJHj8LByQcSJv8MT30UQ/0Box5998Nh8IcS/0N//wN8eEEPsnf1vL/wBBwZEIABEQARECECsZ/wHTHK1Qyj7XwoAAAAASUVORK5CYII=" alt="Genislab">Genislab Technologies</a></h1></div><h2 class="screen-reader-text">Main navigation</h2><nav class="nav-primary" itemscope itemtype="http://schema.org/SiteNavigationElement" id="genesis-nav-primary" aria-label="Main navigation"><div class="wrap"><ul id="menu-topnav" class="menu genesis-nav-menu menu-primary js-superfish"><li id="menu-item-1910" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-home menu-item-1910"><a href="http://tryqa.com" itemprop="url"><span itemprop="name">Home</span></a></li>
<li id="menu-item-1909" class="menu-item menu-item-type-taxonomy menu-item-object-category current-post-ancestor current-menu-parent current-post-parent menu-item-1909"><a title="Software Testing Blog" href="http://tryqa.com/category/software-testing-pro/" itemprop="url"><span itemprop="name">Blog</span></a></li>
<li id="menu-item-1839" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1839"><a title="ISTQB Foundation Certification" href="http://tryqa.com/istqb-certification-the-definitive-guide/" itemprop="url"><span itemprop="name">ISTQB Foundation Level</span></a></li>
<li id="menu-item-3025" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-3025"><a href="http://tryqa.com/istqb-advanced-level-test-manager-study-material/" itemprop="url"><span itemprop="name">ISTQB Advanced Level Test Manager</span></a></li>
<li id="menu-item-1837" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1837"><a href="http://tryqa.com/istqb-agile-testing-certification/" itemprop="url"><span itemprop="name">Agile Testing Tutorial</span></a></li>
<li id="menu-item-1663" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-1663"><a href="http://tryqa.com/istqb-dumps-download-mock-tests-and-sample-question-papers/" itemprop="url"><span itemprop="name">ISTQB Dumps – Mock Tests</span></a></li>
<li id="menu-item-1155" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1155"><a href="http://tryqa.com/contact-us/" itemprop="url"><span itemprop="name">Contact Us</span></a>
<ul class="sub-menu">
<li id="menu-item-1144" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1144"><a href="http://tryqa.com/privacy-policy/" itemprop="url"><span itemprop="name">Privacy Policy</span></a></li>
<li id="menu-item-1152" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1152"><a href="http://tryqa.com/terms-of-use/" itemprop="url"><span itemprop="name">Terms of Use</span></a></li>
<li id="menu-item-1464" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1464"><a href="http://tryqa.com/disclaimer/" itemprop="url"><span itemprop="name">Disclaimer</span></a></li>
<li id="menu-item-1143" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-1143"><a href="http://tryqa.com/about-us/" itemprop="url"><span itemprop="name">About Us</span></a></li>
</ul>
</li>
</ul></div></nav></div></header><div class="site-inner"><div class="wrap"><h2 class="site-description" itemprop="description">Study material for ISTQB Exam Certification Foundation level, Premium & Free for ISTQB and ASTQB Exam, Certification questions, answers, software testing tutorials and more</h2><div class="content-sidebar-wrap"><main class="content" id="genesis-content"><article class="post-2645 post type-post status-publish format-standard category-software-testing-pro tag-beginners-python-unittest-framework-tutorial tag-doctest-module tag-examples-of-pytest tag-exception-handling-in-doctest tag-expected-failures tag-finalisation tag-grouping-tests tag-how-to-run-pytests tag-learn-python-testing tag-pytest-fixtures tag-pytest-module tag-python-testing-framework-tutorial tag-python-testing-frameworks tag-python-testing-tutorial tag-python-unittest-framework tag-python-unittest-framework-examples tag-python-unittest-framework-tutorial tag-python-unittest-framework-tutorial-with-examples tag-python-unittesting-tutorial tag-raising-exceptions-in-pytest tag-skipping-tests-in-unittest tag-subtests tag-teardown-code tag-test-layouts tag-testsuites-in-python tag-unittest-module entry" itemscope itemtype="http://schema.org/CreativeWork"><header class="entry-header"><div class="prev-next-post-links"><div class="ak-previous-post-link" title="Previous Post: What is a Test Case? Example Template, Types, Best Practices"><a href="http://tryqa.com/test-case/" rel="prev">« Previous Topic</a></div><div class="ak-next-post-link" title="Next Post: Complete Guide to Career in Software Testing / QA - Career Growth, Roles, Responsibilities"><a href="http://tryqa.com/beginners-guide-to-career-in-software-testing-growth/" rel="next">Next Topic »</a></div></div><h1 class="entry-title" itemprop="headline">Python Unittest Framework – Beginners Tutorial with Examples</h1>
</header><div class="entry-content" itemprop="text">