Saturday, January 20, 2018

How to Install Python on Windows

Python is fast becoming de facto choice for data analytics projects. Setting up Python on your system can turn up out be a little trick though and below steps would help you quickly installing it.

1. Download and install Anaconda : Browse to Anaconda site, Link, and download the appropriate version for your OS.

                              

2. Run the installer and choose default options : A small tip here, ensure there are no spaces in anaconda installation directory path, this would save tonnes of errors later.

3. Once installed you can quick test installation, go to start menu and search for Anaconda Prompt.

                    

4. Launch Anaconda Prompt and execute below command
    python --version

5. Its time to add it back to system path, so you can use python from other softwares like Windows command prompt, gitbash etc.

6. You can either do it through Control Panel, system variable way or you can change system path via windows command prompt.

7. Use command SETX PATH %PATH%;D:\ProgramFiles\Anaconda;D:\ProgramFiles\Anaconda\SCRIPTS"

8. If you are not sure of Python installation path, go back to Anaconda prompt and run command where python.

That's it, Python should now be installed on your system.

Wednesday, January 10, 2018

Handling Assertions in Automation related tools (TestNG)

As a developer assertions are used to red flag critical errors, errors from which programs can not recover. Its pretty convenient and lays out clearly the assumptions a developer has made on the flow of the program. On the flows which are in critical path of logic flow developers tend to use Assertions.

Assertions are equally popular in Testing community, specially with Automation developers. Automation developers use assertions to verify is system responded to a test case in the way it was expected to. Failure on system's part to respond in expected way causes an Assertion Exception.

Unlike in development, in Automation a tester may not want the entire testing module to be skipped if one of the test cases failed or led to Assertion Exception. At the same time he would still want to flag this error to underlying framework like TestNG. Welcome to the world of Soft Assertions which were introduced exactly to handle situation like above.

Its a developer's prerogative when to use Assertion and when to use SoftAssert classes. Typically at places where you do not want rest of test case to be executed on failure of a core module, for example login, since rest of the test cases would fail, you are more likely to use normal Assertion classes. However for testcases failure of which does not negatively impact other code in a test case, you can leverage SoftAssert classes.

 Example

import org.testng.asserts.SoftAssert;

public class TestCases { 
   
    @Test
    public void sampleFailure() {
      private SoftAssert softAssert = new SoftAssert();
      softAssert.assertTrue(false); 
      System.out.println("program still continues");
      softAssert.assertAll(); 
    }
}

Monday, January 1, 2018

Protected PDF Files, How to unprotect password protected pdf files.

Its that time of the year when you have to file your taxes. Most of the tax saving instruments/proofs in form of pdf unfortunately are password protected.


                                       


While there are ways of removing the passwords by uploading them to random sites, those can not be recommended without hesitation, specially since all these documents do contain private financial information.

You still do need to upload the unprotected documents to your organization portal to claim all tax benefits, so is there a simpler way out ?

Yes there is, just follow below easy steps.


1. Upload to Google Drive
2. Open the document, enter your password when prompted for.
3. Once document is open, click on print option.
4. From the print tab, either choose a local print software like Cutepdf or directly save the pdf to you local disk.

Merging and Splitting PDF files

We all use and rely on PDF's. There are occasions though when you want to edit certain portions of a pdf and merge the edited version ba...