tag:blogger.com,1999:blog-7340410965371279242024-03-05T19:02:46.895+05:45Bibek Adhikari's BlogUnknownnoreply@blogger.comBlogger5125tag:blogger.com,1999:blog-734041096537127924.post-80434026890147938022020-02-23T16:37:00.005+05:452023-05-27T15:13:48.249+05:45Generate simple HTML report for your test/automation scripts in Python<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<b><a href="https://pypi.org/project/automation-report/" target="_blank">automation-report </a></b>is PyPI package that generates the <a href="https://blog.bibekadhikari.com.np/search/label/HTML?&max-results=10" target="_blank">HTML </a>report for your <a href="https://blog.bibekadhikari.com.np/search/label/Python?&max-results=10" target="_blank">Python </a>automation script with valid status of overall test case and its steps.<br />
<br />
<h3 style="text-align: left;">
<b>Installation: </b></h3>
</div>
<div style="text-align: left;">
<pre><span id="pip-command">pip install automation-report</span></pre>
<h4 style="text-align: left;">
<u><span id="pip-command"><b>Sample Code: </b></span></u></h4>
</div>
<b>Importing package
</b><br />
<pre>from automation_report.report import AutomationReport
</pre>
<br />
<b>Passing optional 'options' dictionary as parament with following keys</b><br />
<ul style="text-align: left;">
<li>LogoImage : Provide URL of the image </li>
<li>MainHeader: When header text is to be used instead of logo </li>
<li>FooterContent: Provide HTML content to add on the footer section
</li>
</ul>
<pre>options = {}
#options["LogoImage"] = "logo.png"
options["MainHeader"] = "Automation Report"
options["FooterContent"] = "<a href='#'>Link</a>"
</pre>
<br />
<b>Create new object for your first test with Report name and optional "options" dictionary
</b><br />
<pre>new_report = AutomationReport("Login Test", options)</pre>
<br />
<b>Use starttest() method to start a new case with its name given as parameter
</b><br />
<pre>new_report.starttest("CASE 0001: Login to the system")</pre>
<br />
<b>Populate the various steps status with info(), success(), fail() methods for particular case
</b><br />
<pre>new_report.info("Entered email in email field")
new_report.success("Login Successfully:")
</pre>
<br />
<b>End above started case
</b><br />
<pre>new_report.endtest()
</pre>
<br />
<b>Create yet another case as following
</b><br />
<pre>new_report.starttest("CASE 0002: Logout User")
new_report.info("User is logged in")
new_report.success("Logout link is present")
new_report.fail("User not logged out")
new_report.endtest()
</pre>
<br />
<b>Use close method to finally complete the whole report generation
</b><br />
<pre>new_report.close()
</pre>
<br />
<b>Screenshots: </b><br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://user-images.githubusercontent.com/12621555/78378665-06362000-75f1-11ea-86aa-7f3ff063cfcf.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="385" data-original-width="800" height="308" src="https://user-images.githubusercontent.com/12621555/78378665-06362000-75f1-11ea-86aa-7f3ff063cfcf.png" width="640" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://user-images.githubusercontent.com/12621555/78378679-0b936a80-75f1-11ea-84ee-8d5c490a46b9.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="400" data-original-width="800" height="320" src="https://user-images.githubusercontent.com/12621555/78378679-0b936a80-75f1-11ea-84ee-8d5c490a46b9.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
<b>Find the source code: <a href="https://github.com/bibekad123/automation-report" target="_blank">Github</a> </b></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-734041096537127924.post-50215038581515292252020-02-22T19:00:00.002+05:452023-05-27T15:12:20.604+05:45Python Decorators : Simple Python program with decorators<div dir="ltr" style="text-align: left;" trbidi="on"><a href="https://blog.bibekadhikari.com.np/search/label/Python?&max-results=10" target="_blank">Python</a> Decorator functions help to add new functionality to existing function without modifying the structure of existing one.
<pre class="prettyprint lang-python"># Defining decorator function welcome_to_school
def welcome_to_school(func):
def welcome_message_school(*args):
print("\n##################### Welcome to School #####################")
func(*args)
return welcome_message_school;
@welcome_to_school
def welcome_message_chemistry(name):
print("Welcome to Chemistry class," , name)
@welcome_to_school
def welcome_message_biology(name):
print("Welcome to Biology class," , name)
welcome_message_chemistry("Chemistry Boy")
welcome_message_biology("Biology Girl")
</pre>
<br />
Output:
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOFwy4Gon34BBZ6TMoAZivwP3JP54OL_6DkPaSN0J89B8AajlTCi5URWY3KmcBxAvUGPcD1cifTMijwZ-mdDPBnXx6ip05R21pDKEHQCrThfAeeg2XDriN5m4-514AgMkgX5lPKR2sSA/s1600/Output.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="102" data-original-width="523" height="124" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOFwy4Gon34BBZ6TMoAZivwP3JP54OL_6DkPaSN0J89B8AajlTCi5URWY3KmcBxAvUGPcD1cifTMijwZ-mdDPBnXx6ip05R21pDKEHQCrThfAeeg2XDriN5m4-514AgMkgX5lPKR2sSA/s640/Output.png" width="640" /></a></div>
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-734041096537127924.post-14354099346271872082018-10-16T12:23:00.002+05:452023-05-27T15:12:43.466+05:45Change extension of files under a folder at once in Windows<div dir="ltr" style="text-align: left;" trbidi="on">
Open Command Prompt under folder where you have files to change the extension and Enter following and Enter<br />
<blockquote class="tr_bq">
ren *.* *.jpg* </blockquote>
Change "jpg" to any of your choice </div>
Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-734041096537127924.post-11411679147870326192018-10-16T12:17:00.001+05:452023-05-27T15:13:00.679+05:45Unhide all files under any folder at once in Windows<div dir="ltr" style="text-align: left;" trbidi="on">
Open Command prompt under the folder when all the hidden files are located. And type following command and Enter.<br />
<blockquote class="tr_bq">
<div class="separator" style="clear: both; text-align: center;">
</div>
attrib -s -h -r /s /d *.*</blockquote>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCTTip8swVm4gz8HiMfpy96xMWfNGgd00j27_YvLM-enyx1EGiwu5SW5k7vV7kZcEe-h7JspxpFBYu3k00TtXTH7_Vj0Z2_Za3VhWdAJ8omjRygj8IfUhPfWODPqEnIsBkczUQXhfNcg/s1600/Screenshot_1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="185" data-original-width="606" height="194" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCTTip8swVm4gz8HiMfpy96xMWfNGgd00j27_YvLM-enyx1EGiwu5SW5k7vV7kZcEe-h7JspxpFBYu3k00TtXTH7_Vj0Z2_Za3VhWdAJ8omjRygj8IfUhPfWODPqEnIsBkczUQXhfNcg/s640/Screenshot_1.png" width="640" /></a></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-734041096537127924.post-44555184064116321362016-07-27T22:19:00.003+05:452023-05-27T15:24:09.108+05:45Search Input box with search icon attached ( HTML,CSS ,bootstrap )<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Want to have search input box along with the bootstrap search icon attached to it for any webpage , blogger? Use the following code to get that.
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrxTyiGhLhDLVgQau9GuDVhDrjtX91JuCZRmrU6_UJGquH9xKIvCLwuQ61N_jIIPGwVE9S7FEqtOhv6oDUqhE-i-KOu_FJiKYa4gAGqyKBaDWa1vBWGz1lpcQNsbBgYLV4ERWlp91VLg/s1600/Screenshot_1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrxTyiGhLhDLVgQau9GuDVhDrjtX91JuCZRmrU6_UJGquH9xKIvCLwuQ61N_jIIPGwVE9S7FEqtOhv6oDUqhE-i-KOu_FJiKYa4gAGqyKBaDWa1vBWGz1lpcQNsbBgYLV4ERWlp91VLg/s1600/Screenshot_1.png" /></a></div>
<br /></div>
HTML code to get the HTML input box and search icon
<br />
<pre class="prettyprint lang-html"><xmp>
<form action="/search" class="navbar-form search-form" id="searchform" method="get" role="search">
<div class="add-on input-group">
<input class="search-field form-control" id="search" name="q" placeholder="Search this blog.." type="search" value="" />
<br />
<div class="input-group-btn">
<button class="btn btn-default" type="submit"><i class="glyphicon glyphicon-search"></i></button>
</div>
</div>
</form>
</xmp>
</pre>
CSS Code
<br />
<pre class="prettyprint lang-html">.add-on{
width:230px;
margin-top:10px;
}
.add-on .input-group-btn > .btn {
border-left-width:0;left:2px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
height:42px;
}
</pre>
</div>
Unknownnoreply@blogger.com1