<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Monal shadi on Medium]]></title>
        <description><![CDATA[Stories by Monal shadi on Medium]]></description>
        <link>https://medium.com/@monalshadi?source=rss-c1cabad6cf22------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*chatewCs7_g0vAZN.jpg</url>
            <title>Stories by Monal shadi on Medium</title>
            <link>https://medium.com/@monalshadi?source=rss-c1cabad6cf22------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 18:01:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@monalshadi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[GSoC ’18 — Week 12: Final Week of GSoC]]></title>
            <link>https://medium.com/@monalshadi/gsoc-18-week-12-final-week-of-gsoc-948964898c34?source=rss-c1cabad6cf22------2</link>
            <guid isPermaLink="false">https://medium.com/p/948964898c34</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[gsoc]]></category>
            <category><![CDATA[systers]]></category>
            <category><![CDATA[google-summer-of-code]]></category>
            <category><![CDATA[code-quality]]></category>
            <dc:creator><![CDATA[Monal shadi]]></dc:creator>
            <pubDate>Mon, 06 Aug 2018 16:31:31 GMT</pubDate>
            <atom:updated>2018-08-06T16:31:31.300Z</atom:updated>
            <content:encoded><![CDATA[<p>This week our three month long journey of Google Summer of Code is going to end with our evaluations being completed on 14th August.</p><p>According to the guidelines, we have to submit and merge all our code by 14th August and any work after that won’t be accepted so there is a mounting pressure to complete all the deliverables and fulfill all the requirements from our timelines along with all the documentation.</p><p>I have 4 major issues left to complete for my GSoC :-</p><ol><li>Flake8 Integration:-<br>Part of my GSoC proposal was to setup code linting rules and enhance the code quality by making the code follow these rules and completing the necessary changes. For this a discussion with my mentors was done deciding on the rules which were to be ignored from the flake8 and configuring a common setup config for all repositories which acts as base for all of them and be modified as per their need provided the rules aren’t modified. The GitHub gist of these rules is documented here: <a href="https://gist.github.com/Monal5031/4164c99f43f52677743237d0408a2bf8">https://gist.github.com/Monal5031/4164c99f43f52677743237d0408a2bf8</a></li><li>Porting of python guidelines:-<br>The aim of Infrastructure and Automation of Python Web Projects was to have consistent guidelines for all the python repositories of Systers Open Source and maintain it throughout. So for that the infra-web team of Systers worked together and came up with a google document draft for the guidelines but it is better conveyed and improves user interaction if sphinx or some other documentation tool is used. In accordance to that there is a need to port the doc guidelines to GitHub flavored markdown files.</li><li>Use of Dictionaries for better representation of data:-<br>There are a lot of use cases where the data is better and efficiently represented using dictionaries in python but that wasn’t the case in VMS due to which there arrived this need for porting this current use of lists to dictionaries for better performance and storage. Lists are useful when the data to be stored is similar but when the data is of a model or different types dictionaries are more useful and efficient.</li><li>Line ending assurance:-<br>Editorconfig is a great way to enforce the consistent coding styles mainly line endings, etc. For linux / OSX the line endings are supposed to be LF but there were certain cases in VMS where the line endings was CRLF which is inconsistency with the editorconfig and also the rest of the code. This can be easily done with the help of pycharm and changed accordingly but being a automation student I took it as a small task and wrote a script for making these changes for me. The script was successful and the changes were done successfully and the script used is documented on a GitHub gist here: <a href="https://gist.github.com/Monal5031/85b94de036369e0676e8e5b1646cef6d">https://gist.github.com/Monal5031/85b94de036369e0676e8e5b1646cef6d</a></li></ol><p>After completing these above the programming the part of my GSoC is complete but we are still left with the important task to present our work to our organization based on which they will conclude their results. This demo will be presented on a live stream of YouTube.</p><p>This is Monal Shadi, signing off from my GSoC blogs. It was a fun and exciting journey where I got to learn a lot of things and good practice, one of which is writing blogs and it has motivated me to write more and more about the work we do. I’d really thank my mentors (Naman Maheshwari, Ayush Garg and Meha Kaushik) and admin (Prachi Manchanda) for their awesome guidance and help throughout.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=948964898c34" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GSoC ’18 — Coding Phase: Week 11]]></title>
            <link>https://medium.com/@monalshadi/gsoc-18-coding-phase-week-11-54d33ab11688?source=rss-c1cabad6cf22------2</link>
            <guid isPermaLink="false">https://medium.com/p/54d33ab11688</guid>
            <category><![CDATA[google-summer-of-code]]></category>
            <category><![CDATA[python-guidelines]]></category>
            <category><![CDATA[gsoc]]></category>
            <category><![CDATA[systers]]></category>
            <dc:creator><![CDATA[Monal shadi]]></dc:creator>
            <pubDate>Mon, 30 Jul 2018 15:44:13 GMT</pubDate>
            <atom:updated>2018-07-30T15:45:22.278Z</atom:updated>
            <content:encoded><![CDATA[<p>As the end of GSoC approaches, all the students start to write their documentation of their work and follow the guidelines according to their organizations.</p><p>Until now, I have completed the integration, execution and documentation of automated testing in Volunteer Management System. Under this task I was able to integrate and execute automated tests for ten apps in VMS which led to drastic increase of the coverage from the initial 42% to 98%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*FHcxGKsKnwt6xSonaRnovA.png" /><figcaption>Coverage Report of Automated Testing.</figcaption></figure><p>During this change the test suite have grown to have a total of 244 tests which is a great sign of a good quality product.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*r7Co4BKNAFDTiVsE4caSow.png" /><figcaption>Test suite.</figcaption></figure><p>I too have started writing my documentation, part of my documentation was completed during the end of second phase of GSoC which was to document the automated testing in VMS. The documentation which remains to be completed is the standardization of python guidelines for the Systers Open Source.<br>This is a crucial documentation as it will define a set of guidelines which have to be followed throughout the organization for python repositories. Though the python repositories usually follow the standard guidelines by pep8 but they seem to be too strict for the use and aren’t usually used as it is, thus we need to define guidelines which suit our organization best and thus an initial draft of the guidelines has been created which will soon be converted to GitHub flavored markdown files and be served using the python’s awesome documentation tool “<em>sphinx”.</em></p><p>The initial draft points out the various syntactical guidelines which are to be followed by the python repositories including common naming conventions rules, indentations rules, imports, etc along with a documentation of a standard editorconfig and flake8 config which are to be used by all the repos. These configs will help take care of small and large issues in the repos and maintain consistency across all of them.</p><p>This was all the work done till now and for the upcoming small time I’ll be spending time on increasing the quality of VMS and at the same time try to implement the guidelines as much as possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54d33ab11688" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Processes involved in Software Testing — GSoC ’18 Week 10]]></title>
            <link>https://medium.com/@monalshadi/processes-involved-in-software-testing-gsoc-18-week-10-4deb38965d55?source=rss-c1cabad6cf22------2</link>
            <guid isPermaLink="false">https://medium.com/p/4deb38965d55</guid>
            <category><![CDATA[google-summer-of-code]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[gsoc]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Monal shadi]]></dc:creator>
            <pubDate>Mon, 23 Jul 2018 15:39:47 GMT</pubDate>
            <atom:updated>2018-07-23T15:39:47.740Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog I will talk about the processes which are followed during software testing.</p><h3>About software engineering.</h3><p>Software engineering is a study of engineering for the design, development and maintenance of any software. Software engineering was introduced to address the issues of low-quality software projects. It ensures that the application is built consistently, correctly. The demand for software engineering has emerged recently to cope with the huge rate of change in user requirements.<br>Under this study, various process and areas are included which guarantee the proper working and functioning of the finished product. One of which is software testing which I’ll explain in this blog.</p><h3>About software testing.</h3><p>Software Testing is the process of executing a program or application with the view of identifying bugs. I like to define Testing as the “ <em>Validation of the software for checking its requirement fulfillment as planned for the purpose of product “</em>. Testing is the primary place to check that the built product meets its requirements.<br>There are certain processes which should be followed while software testing to ensure the best quality product is obtained which are:<br>1. Planning tests.<br>2. Designing its structure.<br>3. Termination of tests.<br>4. Documentation.</p><ol><li><strong>Planning tests :-<br></strong>Under this part, every aspect of testing a software is to be planned from the parts to be tested to termination. Basically if this planning is not done correctly the software to be tested might fall apart.<br>While planning, usually the these points are taken into discussion and followed throughout the process.<br><strong>i.</strong> Deciding on the parts of software which need be included in testing.<br><strong>ii.</strong> Theoretical grouping of the parts of test to form a test suite.<br><strong>iii.</strong> Methodology and type of testing to follow.<br><strong>iv.</strong> Tools to be used.<br><strong>v.</strong> Environment requirements.<br><strong>vi.</strong> Scheduling and termination approvals of tests.</li><li><strong>Designing its structure :-<br></strong>Under this part, we tend to use our small parts of test case which we had created and combining them bit by bit based on their relevance to become a giant test suite which covers similar test cases.<br>During the early stages of testing, people usually tend to create tests which uncover major bugs preferably in the aspects of security and user experience. We tend to focus less on the cosmetics of the software but more on intrinsic functionalities which makes it stand out to other software&#39;s.<br>Once we are done with the early stages we are confident enough to present it to the users so now we can move on to making software more user appealing and bug-free.</li><li><strong>Termination of tests :-<br></strong>After we are done with designing the structure and implementing the tests, the next task which rests in the software testing is to decide the bar for the termination of testing. The organization sets their bar based on their needs and requirements. Some may set a 100% coverage implying that each and everything has to be tested in all ways possible while some tend to set to minimum criteria of like 90–95% which implies they need the software with less bugs before release. Finally some may target the need of only the major defects be solved for release and the bugs be solved at a later stage of development.<br>Usually the minimum percentage criteria is preferred over the others.</li><li><strong>Documentation :-<br></strong>The final and the most important task is “<em>Documentation</em>”. Not everything we write in code can be communicated easily and thoroughly thus it is of crucial importance that the tests suite created be documented to as what their goal is and what the test is trying to achieve. The way documentation is done highly impacts how the testing will be carried out in future and that the structures are being followed properly.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4deb38965d55" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying django projects for development servers— GSoC ’18 Week 9]]></title>
            <link>https://medium.com/@monalshadi/deploying-django-projects-for-development-servers-gsoc-18-week-9-ea32999ab642?source=rss-c1cabad6cf22------2</link>
            <guid isPermaLink="false">https://medium.com/p/ea32999ab642</guid>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[aws-ec2]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[google-summer-of-code]]></category>
            <category><![CDATA[gsoc]]></category>
            <dc:creator><![CDATA[Monal shadi]]></dc:creator>
            <pubDate>Mon, 16 Jul 2018 16:30:33 GMT</pubDate>
            <atom:updated>2018-07-16T16:35:00.828Z</atom:updated>
            <content:encoded><![CDATA[<p>There are a lot of places where we can deploy our django projects such as pythonanywhere, Amazon Web Services (AWS), Heroku, etc.</p><p>In this blog I will talk about how to deploy your django project on AWS EC2 for development purposes only.</p><p>For deploying a django project on AWS EC2 we need to do complete two things which are launch an EC2 instance and deploy django app on that instance via ssh.</p><h3>Launch an EC2 instance.</h3><p>Launching an instance on AWS includes following steps :— <br>1. Login to EC2 dashboard for launching an instance.<br>2. Selecting Amazon Machine Image. (AMIs)<br>3. Selecting hardware configuration and image size.<br>4. Adding storage.<br>5. Adding tags. (Optional)<br>6. Configure security group.<br>7. Selecting/creating key-pair. (pem file for ssh)</p><ul><li>First step is quite clear and you just need to login to the AWS EC2 console for that.</li><li>Selecting AMI :-<br>EC2 has a lot of images including linux, windows servers. Based on our need we can select any of the image and proceed further.</li><li>Selecting hardware configuration and image size.<br> Based on our needs we can select an image size and type of the many which AWS provides. EC2 has provides T2, M5, M4 types of instances and for size it ranges from nano to 16xlarge (highest size very in different size).</li><li>Adding storage :-<br>Depending on the need and size of the project and database needs we can select storage for our instance, there are certain other things too which we can use for additional storage.</li><li>Adding tags :-<br>Often we can get confused between multiple instances we have running to simplify this we can add tags to our instances to distinguish them.</li><li>Configure security groups :-<br>This is an important step, a security group defines virtual firewall to control the traffic for our instances.</li><li>Selecting or Creating key-pair for an instance :-<br>We can access our instance using this key-pair, creating new pair will allow us to download a new pem file using which we can connect to our instance via ssh.</li></ul><h3>Deploying django project</h3><p>Following the above steps we have created our ec2 instance and now all that is left is to deploy our project on it.<br>To connect to ec2 instance via ssh use the following command :-<br>ssh -i /path/to/pem-file root@&lt;ec2-public-dns-address&gt; <br>After this step you are now connected to your instance via ssh and using the terminal you can now setup your project using the usual steps followed.</p><p>To keep the instance running you can use screen to make the process run continuously. Screen needs to be activated just before the runserver command and close the terminal directly. Also the runserver command needs to given 0.0.0.0:&lt;port&gt; this as IP argument to make it accessible on internet. After deploying the project can be accessed at the public IP provided by the ec2 instance.</p><p>Using these you can setup a deployment for development server but a lot of more things need to be defined and done when deploying for a production server.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ea32999ab642" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design Pattern for Automated testing using Selenium — GSoC ’18 Week 8]]></title>
            <link>https://medium.com/@monalshadi/design-pattern-for-automated-testing-using-selenium-gsoc-18-week-8-62471c2f0ebd?source=rss-c1cabad6cf22------2</link>
            <guid isPermaLink="false">https://medium.com/p/62471c2f0ebd</guid>
            <category><![CDATA[django-python]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[software-design-patterns]]></category>
            <category><![CDATA[page-object-model]]></category>
            <category><![CDATA[automated-testing]]></category>
            <dc:creator><![CDATA[Monal shadi]]></dc:creator>
            <pubDate>Mon, 09 Jul 2018 14:38:08 GMT</pubDate>
            <atom:updated>2018-07-09T14:38:08.757Z</atom:updated>
            <content:encoded><![CDATA[<p>I gave an introduction to Automated testing using selenium in python-django in the previous, you can check it out <a href="https://medium.com/@monalshadi/introduction-to-automated-testing-using-selenium-gsoc-18-week-7-53b856e653f1">here</a>. In this blog I’ll talk about POM design patterns and how it benefits automated testing as a whole.</p><h3>About Page Object Model (POM) objects.</h3><p>The previous blog had a hint of what this is, we will go a little deeper this time and find out what POM objects are and why should we use it.</p><p>As seen in the example of previous blog, test was just selecting elements and performing actions. Although it was a small test but as the tests will grow this will start getting ugly and it becomes hard to maintain these small chunks as for a single change all of the elements will have to be changed. Thus comes in the picture the concept of <strong>POM.<br>POM</strong> is a design pattern in using which we can make our code <strong>robust</strong> and <strong>clean</strong> while maintaining <strong>readability</strong> and <strong>re-usability</strong>.</p><p>In this design pattern, we create classes which includes <em>locators</em> and <em>action methods</em> corresponding to a template. The locators are defined <strong>uniquely</strong> for a template in order to avoid selecting elements which will give incorrect results.</p><p>POM pages will use those locators and define a generic action method for the tests to select elements, submit forms, retrieve information from templates and lots more actions.</p><h3>Creating POM locators</h3><p><em>Page Object Model locators</em> are the variables to be used by the action methods to locate elements on the template. The locators can be XPATH, class-name, id-name or any such locators available in selenium. Preference for choosing locators is:<em> class-name </em>— &gt; <em>XPATH</em> — &gt; <em>id-name</em>.<br>But we usually combine other locators with xpath to select element more easily or even add certain extra attributes to tags to make them easily accessible.<br>For example, we can add a name attribute to a div tag and thus instead of writing a long XPATH we can simply use it as &#39;//div[@name=&quot;some_valued&quot;]&#39; which is clearly an easy and simple solution that to write a locator as //div[1]//div[n]... . Another simplification which can be used is //div[@id=&quot;#idOfElement&quot;] or //div[@class=&quot;.className&quot;] which makes selecting elements more easier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UyYKom0BXmFmYdbrJrUStw.png" /><figcaption>Example POM locator implemented in VMS.</figcaption></figure><h3>Creating POM pages</h3><p><em>Page Object Model pages</em> are classes which define methods which use locators to perform actions which include selecting elements, retrieving data from templates, redirecting to different URLs via clicks, filling forms and lots more.</p><p>This class contains methods to perform actions which are used a lot in the code thereby increasing <em>re-usability</em> and reduces <em>redundancies</em>.<br>Every POM page has a method which takes it to the template for which the rest of the methods are applicable. It is a good practice to have only one of these methods to reduce confusion so if a template is accessible only after a certain series of actions then we should modify this method such that the end result takes us to our target template.<br>For e.g.,<br>def go_to_desired_page(self):<br> self.driver.get_page(&#39;url&#39;) <br>Since this method will be used by all the testcases in the suite we should include this in our POM page class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Yg-zVF7LmYVQStS9J3n2A.png" /><figcaption>Example POM page implemented in VMS.</figcaption></figure><p>As more and more POM pages are getting added, methods which are being created in the POM pages will also start to repeat thus to tackle this hurdle we can create an even generic POM object which will define these methods and thus enhancing the quality of our code.</p><p>In Volunteer Management System, this has been implemented, all the POM pages extend BasePage which is an implementation of this generic POM page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nSw3kV1h8gahtK-U7-kiXA.png" /><figcaption>Example of BasePage implemented in VMS.</figcaption></figure><p>Following these design patterns enhances our code quality by making it reusable, easily maintainable and clean.</p><p>This blog covered another aspect of automated testing using selenium, I’ll discuss more aspects in the blogs to come. :D</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=62471c2f0ebd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Automated Testing using Selenium - GSoC ’18 Week 7]]></title>
            <link>https://medium.com/@monalshadi/introduction-to-automated-testing-using-selenium-gsoc-18-week-7-53b856e653f1?source=rss-c1cabad6cf22------2</link>
            <guid isPermaLink="false">https://medium.com/p/53b856e653f1</guid>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[example]]></category>
            <category><![CDATA[google-summer-of-code]]></category>
            <category><![CDATA[automated-testing]]></category>
            <category><![CDATA[django]]></category>
            <dc:creator><![CDATA[Monal shadi]]></dc:creator>
            <pubDate>Mon, 02 Jul 2018 12:03:49 GMT</pubDate>
            <atom:updated>2018-07-02T17:11:35.868Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog is an introduction to automated testing using selenium in python-django with a small <strong>spice</strong> of example.</p><p><strong>Software testing</strong> is a part of software engineering wherein we conduct a <em>technical investigation</em> of the product under development to provide information about the quality of the product.</p><p>There are various types of testing one of them which I’ll be discussing in this blog is <strong>Automated Testing</strong>. I’ll discuss various aspects and process we follow in automated testing with a very popular software <strong>Selenium </strong>in Python-Django.</p><h3>What is Selenium?</h3><p>Selenium is an Open Source software used to <em>automate browsers. </em>Using this software we automate our web applications for testing.<br>As mentioned on <a href="https://www.seleniumhq.org/">SeleniumHQ</a>, they provides us a <a href="https://www.seleniumhq.org/projects/webdriver/">Selenium WebDriver</a>; a collection of language specific bindings to drive a browser — <em>the way it is meant to be driven.</em><br>In Automated testing, we use this WebDriver in our tests to perform a set of actions which produces a result and finally to be used against our expected conclusion.</p><h3>How to use selenium on our application?</h3><p>Before writing any test, firstly we need to identify the use case and scenario for which we want to record our test, once figured out writing test is no big task. This step is important because the flow of actions we decide, the exact simulation will have to be performed by our code. Thus having a definite flow will make task easier and even the debugging at later stage.<br>For better understanding, let’s consider this case: <em>We have to automate a search from google.com and want to check if the first result is related to what we had searched.</em><br>Now, this case can be converted to this flow which we’ll convert into code:<br>i. Go to <a href="https://www.google.com/">https://www.google.com/</a><br>ii. Input search text in the field provided. (Lets search ‘Python’)<br>iii. Hit search button.<br>iv. Retrieve first result.<br>v. Process results.<br>vi. Verify and assert results.<br>vii. Quit the browser</p><p>Like any other python package we first need to import our WebDriver.<br> from selenium import webdriver</p><p>In python-django, we use LiveServerTestCase or StaticLiveServerTestCase as base test classes for the automated tests, basic difference between these is that the first one will load the CSS of the application but won’t display it while the later will display the CSS while loading it. And used as:<br> class MySeleniumTest(LiveServerTestCase):</p><h4>Any selenium test will follow this common flow;<br>1. Initiating WebDriver</h4><p>To perform actions in our browser, first we need to create an instance of WebDriver for the actions to be performed on. This is usually done once for the whole test suite or a test class containing similar test cases. In Python Django it is done at the class level by extending the setUpClass method.</p><p>Here in this short snippet I have initiated a Firefox WebDriver, an important thing to note about Firefox WebDriver is that we need to download and explicitly <a href="https://github.com/mozilla/geckodriver/releases">geckodriver</a> in our path otherwise the tests won’t work.<br>@classmethod<br>def setUpClass(cls):<br>cls.driver = webdriver.Firefox()<br> # Do some page initiation<br>super(MySeleniumTest, cls).setUpClass()</p><h4>2. Direct to your template.</h4><p>Once the driver is initiated, the next step is to direct broswer to the page where the actions need to be performed as decided in the flow at the start.</p><p>Now, usually what we do is direct to this page using the get() method of the driver we have initiated, but this will create redundancy in your code as it starts to grow bigger. This problem of redundancy can be tackled by creating <a href="http://toolsqa.com/selenium-webdriver/page-object-model/">POM</a> i.e. <a href="http://toolsqa.com/selenium-webdriver/page-object-model/">Page Object Models</a>.<br>Now, lets start with our test and go to our page.<br>def test_selenium_working(self):<br> self.driver.get(&#39;https://www.google.com&#39;) <br>This will get us to the home page of google and ready for us to perform our search.</p><h4>3. Perform actions</h4><p>To perform any action first we need to locate the element we want to interact with and then send our requests for process.</p><p>For locating elements selenium provides various options like using class_name, xpath, etc. For our example we need to locate our search input and search button then after the search has been performed we’ll locate the heading of the first result. Here’s how:</p><p>element = self.driver.find_element_by_xpath(&#39;//input[@id=&quot;lst-ib&quot;]&#39;)<br>element.clear() # Clear value in input<br>element.send_keys(&#39;Python&#39;) # Send value to input<br>button = self.driver.find_element_by_xpath(&#39;//input[@name=&quot;btnK&quot;]&#39;)<br>button.click() # Hit search button<br>Now, we have sent our search, time to get our results.<br>top_result = self.driver.find_elements_by_css_selector(&#39;.bkWMgd&#39;)[0]<br>heading = top_result.find_element_by_xpath(&#39;//h3//a&#39;)<br># For anchor tags we have to use get_attribute(&#39;text&#39;)<br># otherwise use element.text<br>heading_text = heading.get_attribute(&#39;text&#39;)</p><h4>4. Compare results.</h4><p>Now, since we have our results now we process and compare the information we received from the browser with the information we had before that.<br>This is fairly easy step and we just need to execute certain functions already defined in our development code. For this scenarios we won’t process the result and rather just assert the compare.</p><h4>5. Verify and assert results.</h4><p>In this part we verify our results against the desired results and assert our answers which cause the tests to Pass or Fail.<br>In this example let’s assert that the word Python is present in the result search or not.<br>self.assertIn(&#39;Python&#39;, heading_text)<br> This will verify our result and thus our test ends here. But, a small thing still remains which is to quit the browser at the end of test suite.</p><h4>6. Quit the browser</h4><p>Again like initiation, this part is usually done only once at the end of class i.e. in tearDownClass() as:<br>@classmethod<br>def tearDownClass(cls):<br> cls.driver.quit()<br> super(MySeleniumTest, cls).tearDownClass()</p><p>I hope this blog was helpful to get started in automated testing using selenium in python-django.<br>In the next blog I’ll cover some good and bad practices in automated testing and what issues are generally faced while automated testing and how to tackle them.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53b856e653f1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GSoC ’18 — Coding Phase : Week 6]]></title>
            <link>https://medium.com/@monalshadi/gsoc-18-coding-phase-week-6-80dae79c95ae?source=rss-c1cabad6cf22------2</link>
            <guid isPermaLink="false">https://medium.com/p/80dae79c95ae</guid>
            <category><![CDATA[google-summer-of-code]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <category><![CDATA[automated-testing]]></category>
            <category><![CDATA[systers]]></category>
            <category><![CDATA[gsoc]]></category>
            <dc:creator><![CDATA[Monal shadi]]></dc:creator>
            <pubDate>Tue, 26 Jun 2018 06:05:45 GMT</pubDate>
            <atom:updated>2018-06-26T06:05:45.207Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog covers my work for GSoC week 6 of Coding Phase or 2nd week of Coding Phase 2.</p><p>At the start of the week, I was assigned to work on issues <a href="https://github.com/systers/vms/issues/734">#734</a> and <a href="https://github.com/systers/vms/issues/735">#735</a> which were for increasing coverage by writing tests for <em>Home</em> and <em>Volunteer</em> app of Volunteer Management System.</p><p>There was an unknown bug (<a href="https://github.com/systers/vms/issues/725">#725</a>) due to which volunteer’s were unable to log their hours in the system, the problem here was the the <em>wrapper_view</em> was supposed take more than 1 arguments so it needed to be modified to use **kwargs instead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hE-DToN7vY21c12KideP2Q.png" /><figcaption>wrapper_view method</figcaption></figure><p>Writing tests and increasing coverage for <em>Home</em> app went quite well and according to travis CI logs I was able to reach a coverage of 100% for <em>Home app</em> and an overall coverage of 80% for VMS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4e7mbVt4Ty3INSTWollAfw.png" /><figcaption>Local run of home app</figcaption></figure><p>Next up was, Volunteer app which proved quite a bit problematic due to some new found bugs and errors.<br>Recently the VMS has been ported to python3.6 and django 1.11 which proved to be a successful port, some unknown small errors were missed which were reported (<a href="https://github.com/systers/vms/issues/737">#737</a>) and also fixed in <a href="https://github.com/systers/vms/pull/736">#736</a>. The errors were basic like python2 used file to open any file which was changed to open in python3 and basic utf-8 encoding errors were also fixed by using binary encoding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i_M33A9rzNI6gTfRELZsGQ.png" /><figcaption>Fix for small errors in volunteer app</figcaption></figure><p>Volunteer app has a field for resume upload thus we needed a Dummy Resume for tests, after discussion with my mentors we decided to upload a dummy resume and use it in code. After all this the volunteer app was successfully completed locally but a few errors still persists on travis CI with uploading the resume but the coverage individually for volunteer app has reached 100% and overall coverage to 83%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_EnBz5-9V7prBp7bu5lItA.png" /><figcaption>Local run of volunteer app</figcaption></figure><p>As, the automated testing in VMS comes closer to completion I went on find new bugs and find some new cases to cover and raised a following few issues <a href="https://github.com/systers/vms/issues/741">#741</a> <a href="https://github.com/systers/vms/issues/742">#742</a> <a href="https://github.com/systers/vms/issues/743">#743</a> <a href="https://github.com/systers/vms/issues/744">#744</a> <a href="https://github.com/systers/vms/issues/745">#745</a>.</p><p>The week ahead involves completing tests with POM app and Integrating flake8 tests on travis and making VMS code follow flake8 Code Style guidelines.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80dae79c95ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GSoC ’18 — Coding Phase : Week 5]]></title>
            <link>https://medium.com/@monalshadi/gsoc-18-coding-phase-week-5-76c63f121b2f?source=rss-c1cabad6cf22------2</link>
            <guid isPermaLink="false">https://medium.com/p/76c63f121b2f</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[gsoc]]></category>
            <category><![CDATA[systers]]></category>
            <category><![CDATA[google-summer-of-code]]></category>
            <dc:creator><![CDATA[Monal shadi]]></dc:creator>
            <pubDate>Mon, 18 Jun 2018 06:24:53 GMT</pubDate>
            <atom:updated>2018-06-18T06:33:00.641Z</atom:updated>
            <content:encoded><![CDATA[<p>The end of 4th week of Coding Phase marked the end of the First Coding Phase of Google Summer of Code 2018. At the end of the each phase students are required to present their 1 month of work to their mentors and admins which helps them as a basis to evaluate us.</p><p>I presented my work in form of a presentation along with a demo run of the E2E selenium tests which I had been working on in the 1st phase, it went well and then started the wait for evaluation results. We continued to work on our projects alongside the evaluation, there was a small fear inside me somewhere about the evaluations as I had missed a few deadlines on wiki reports, submitting work within deadline also plays an important role along with the demo which we have to give of our work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*lJTt8U1zM-WjUyMVMgw-Yw.png" /><figcaption>Evaluation Result</figcaption></figure><p>I was quite happy to see that I had passed the 1st evaluation and received a great feedback from my mentors and admins. I’m really grateful to my mentors <a href="https://medium.com/@naman1901">Naman Maheshwari</a>, <a href="https://medium.com/@_pavank">Pavan Kemparaju</a> and admin <a href="https://medium.com/@prachi121096">Prachi Manchanda</a> as they played an important role in this success.<br>As I now enter the 2nd Coding Phase of GSoC I intend to follow on the feedback received and make most growth on the points which I have been weak on.</p><p>Apart from evaluations, Week 5&#39;s work included working on <strong>Registration</strong> and <strong>Shift</strong> app and thereby completing 7 of 10 apps in <strong>VMS</strong>.<br>Working on <strong>Registration</strong> app went quite smoothly but encountered a need for adding an explicit wait using selenium’s ‘<strong>WebDriverWait</strong>’.<br>This wait ignores the <strong>NoSuchElementException</strong> for the specified period of time until the condition provided in it becomes true else if the time runs out a <strong>TimeOutException</strong> is thrown. It basically sleeps for some time and then pings the server again for the element, the sleep time can be defined accoriding to our need but by default it uses <em>0.5 seconds.</em></p><p>Usage of WebDriverWait is quite simple and done as:<br><em>WebDriverWait(driver).wait.until(EC.presence_of_element_located((<br>By.XPATH, “//h1[contains(text(), ‘Volunteer Management System’)]” ) ) )</em></p><p>There are several EC, Expected Conditions available for use and since I just needed the page to be loaded I had used <em>presence_of_element_located</em></p><p><em>Similary,</em> We can use many different ways to satisfy the expected condition using class name, text inside the element, etc. But using <em>xpath</em> to check page heading did the work for me.</p><p>After the previous apps being merged the Registration app encountered a great rise in the coverage hitting the current maximum of 87% which is quite an achievement in VMS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VkpILwU5BXBi9UsJVWFgRA.png" /><figcaption>Registration App Pull Request</figcaption></figure><p>Working on <strong>Shift</strong> app was quite a problem as I encountered few bugs in the app itself and then also in some previous tests which I’ve wrote. Though I completed most of the app some issues are still there which are blocking the completion and will not take much time as soon as the bug fix is done. Currently the coverage is 85% as per the travis logs and will increase as a part of the app is yet to be tested.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iSYLQtwj9qBIBtbzSzfdgw.png" /><figcaption>Pull Request for Shift app</figcaption></figure><p>With VMS testing almost completed, I discussed my future timeline deliverables with my team and that I’ll be working on <strong>Code Standardization</strong> and enhancement of <a href="http://github.com/systers/postorius/"><strong>Postorius</strong></a> after <a href="http://github.com/systers/vms/">VMS</a> is all working and stable.</p><p>Hope to accomplish and grow even more in the Phase-2. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76c63f121b2f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GSoC ’18 — Coding Phase : Week 4]]></title>
            <link>https://medium.com/@monalshadi/gsoc-18-coding-phase-week-4-e1b720232d03?source=rss-c1cabad6cf22------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1b720232d03</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[code-style]]></category>
            <category><![CDATA[systers]]></category>
            <category><![CDATA[coala]]></category>
            <category><![CDATA[gsoc]]></category>
            <dc:creator><![CDATA[Monal shadi]]></dc:creator>
            <pubDate>Mon, 11 Jun 2018 15:28:13 GMT</pubDate>
            <atom:updated>2018-06-11T15:28:13.656Z</atom:updated>
            <content:encoded><![CDATA[<p>Following the previous two weeks, this week too was dedicated to writing tests and increasing coverage and finding possible bugs in <strong>Volunteer Management System</strong> (VMS) but as part of my proposal I have to work on <em>Code Style Standardization</em> for Systers Open Source and some initial steps were also taken towards that in this week.</p><p>This week I worked on writing tests and increasing coverage for <strong>Organization</strong> and <strong>Authentication</strong> app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sn4gUHAJSKJXkmiKN1-Tzg.png" /><figcaption>Organization appPull Request</figcaption></figure><p>Both the Organization app and Authentication app were comparatively easier task to work on than what I had done previous two weeks, I basically followed the same principal I had for the previous two week: Make existing tests pass -&gt; Write new tests -&gt; Investigate breakages -&gt; Debug and Find use cases -&gt; Fix and make PRs. As per individual travis logs, Organization Pull Request witnessed a coverage mark of 74% and while Authentication Pull Request witnessed a coverage mark of 75%.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UQhLRGb4S7z97GPrvy2GTw.png" /><figcaption>Authentication app Pull Request</figcaption></figure><p>This week while writing the tests I encountered some scenarios where good practices for writing tests in python could be used :-<br>1. <strong>Use of assert statement</strong> :-<br> To check if a statement raises an Error people usually go with <em>assertRaises </em>which is actually not good because this assert is actually lazy and should be avoided used as:<br><strong><em>self.assertRaises(FooError, statement_raising_FooError, *arg)</em></strong></p><p>A better alternative to this is <em>assertRaisesRegexp</em> which allows us to have an extra parameter for Regex match for the Error Message and used as:<br><strong><em>self.assertRaisesRegexp(<br> FooError, error_message_regex, <br> error_statement_callable, *args<br>)</em></strong></p><p>2. <strong>Model validation checks</strong> :-<br>An important thing to note about a <em>‘model.save()’</em> function is that unless there is a violation of not-null constraint it will save the object in database and won’t perform the validation checks we have coded. <br>Thus, for the validation checks to be performed we need to make an explicit call to the <em>‘model.full_clean()’</em> function, this functions execution is done automatically while form filling but not while model saving.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*LTn60NmzIuzYdATEJoABGw.png" /><figcaption>Code Style Standardization in Systers using coala</figcaption></figure><p>Lastly, the initial steps involving for the <em>Code Style Standardization</em> for <a href="http://systers.io/">Systers Open Source</a> involved making a rough sketch of the static analysis tool we are going to use i.e. <a href="http://coala.io/"><strong>coala</strong></a> and since this change would impact the community it needs to be first taken into review in front of the community and thus for this I’ll be presenting coala in the Community Open Session this coming week and get feedback and help from Systers community for this change.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1b720232d03" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GSoC ’18 — Coding Phase : Week 3]]></title>
            <link>https://medium.com/@monalshadi/gsoc-18-coding-phase-week-3-a8c06919fe73?source=rss-c1cabad6cf22------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8c06919fe73</guid>
            <category><![CDATA[systers]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[gsoc]]></category>
            <category><![CDATA[google-summer-of-code]]></category>
            <dc:creator><![CDATA[Monal shadi]]></dc:creator>
            <pubDate>Mon, 04 Jun 2018 15:09:55 GMT</pubDate>
            <atom:updated>2018-06-04T15:11:01.039Z</atom:updated>
            <content:encoded><![CDATA[<p>This 3rd week of Coding Phase turned out to be quite different than expected as it involved less typing and more <strong>debugging</strong> the code for breakages and possible bugs.</p><p>This week I had to complete writing tests for <strong>Event</strong> and <strong>Job</strong> app of the <strong>Volunteer Management System</strong> repo (VMS).<br>First task was to complete writing tests for Job app and increase the coverage for the same. It wasn’t such a hard task to write initial tests which was made easier because of the current tests repo already had. But for the new tests which I had added or yet to add, the <em>challenging</em> task was to investigate breakages and what possible cases might occur with some randomly possible scenarios.<br>The later part included hours of <strong>debugging</strong> the code to find possible cases and rather some edge cases to include in the tests. Finally after all of this writing and debugging I was able to make a PR for it. Individually as per the coverage report in <a href="https://travis-ci.org/systers/vms/builds/387461436?utm_source=github_status&amp;utm_medium=notification">travis log</a> the coverage had increased to <strong><em>73%</em></strong> by this change the actual results will become more clear after the previous PRs are complete from review process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9DQHtEITdv5xIie-K7mKhQ.png" /><figcaption>Pull Request submitted for Job app.</figcaption></figure><p>I followed a similar process for the <strong>Event</strong> app i.e.:<br><em> Use existing tests -&gt; Write new ones -&gt; Find possible bugs and edge cases -&gt; Debug those cases and write tests for the same</em> and made a Pull Request for it. According to the coverage report in <a href="https://travis-ci.org/systers/vms/builds/387454943?utm_source=github_status&amp;utm_medium=notification">travis log</a> individually this PR had increased the coverage to <strong><em>75%</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A4rD4eEEr6AD1TNBiN11NQ.png" /><figcaption>Pull Request Submitted for Event app</figcaption></figure><p>Overall this was a fun week and included more of thinking and debugging part which was a cherry on top. I’m hopeful that the next week will also bring some new surprises and includes a learning curve.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8c06919fe73" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>