Sunday, July 27, 2014

Running Selenium Tests in (Eclipse + Junit) Framework


Use the Selenium IDE for recording the tests. From the below website, Download Firefox plugin which records and plays back user interactions with the browser.

http://seleniumhq.org/download/

You can export the recorded test case into desired programming language using the option: File -> Export Test Case AS -> Java / JUnit 4 / WebDriver



Download and install the Eclipse from : http://www.eclipse.org/downloads/

Download the JUnit jars (junit.jar and hamcrest-core.jar) from http://junit.org/


Create a project in eclipse. Add JUnit jars in project's build path: Properties -> Java Build Path -> Libraries -> Add External Jars

Download the Selenium Client jars from below website. Add the jars to project's build path.

http://docs.seleniumhq.org/download/

------------------
You may test your JUnit installation by creating following two classes:

Create a class MessageDisplay in the project

public class MessageDisplay {

   private String message;

   /* Constructor
    * @param: message to be printed
    */
   public MessageDisplay(String message){
      this.message = message;
   }
   
   /* prints the message to console */
   public String displayMessage(){
      System.out.println(message);
      return message;
   }
}

Create a class TestMessageDisplay in the project

import org.junit.Test;
import static org.junit.Assert.assertEquals;

public class TestMessageDisplay {

   String message = "Hello World";
   MessageDisplay messageDisplay = new MessageDisplay(message);

   @Test
   public void testPrintMessage() {
      assertEquals(message,messageDisplay.displayMessage());
   }
}

Run the program successfully by right clicking on TestJUnit: Run As -> JUnit Test
------------------

Now add a test Case to the project by going to Project Explorer: New -> JUnit Test Case



Now, copy the code that Selenium IDE generated. You may need to fix compilation erros (such sa package name errors, class name errors, etc).

Run the test case by right clicking: Run As -> JUnit Test






Further info:

http://docs.seleniumhq.org/docs/03_webdriver.jsp#webdriver-backed-selenium-rc

- Web Driver vs. RC

Selenium-WebDriver makes direct calls to the browser using each browser’s native support for automation. How these direct calls are made, and the features they support depends on the browser you are using. Information on each ‘browser driver’ is provided later in this chapter.

For those familiar with Selenium-RC, this is quite different from what you are used to. Selenium-RC worked the same way for each supported browser. It ‘injected’ javascript functions into the browser when the browser was loaded and then used its javascript to drive the AUT within the browser. WebDriver does not use this technique. Again, it drives the browser directly using the browser’s built in support for automation.

- Do you need Selenium Server?

You may, or may not, need the Selenium Server, depending on how you intend to use Selenium-WebDriver. If you will be only using the WebDriver API you do not need the Selenium-Server. If your browser and tests will all run on the same machine, and your tests only use the WebDriver API, then you do not need to run the Selenium-Server; WebDriver will run the browser directly

- Running Standalone Selenium Server for use with RemoteDrivers

From Selenium’s Download page download selenium-server-standalone-.jar
Start the server on the command line with
java -jar /selenium-server-standalone-.jar

Thursday, January 02, 2014

travel outside of United States while Status Change is in process

Following are the responses from an Immigration Lawyer for questions related to 'Traveling outside of United States while Status Change (from H4 to F1) is in process':


Q: While the change of status is under process, can the applicant travel outside of the country? If applicant travels outside the country, what will happen?

A: Yes, applicant can leave the US while the change of status application is pending; but applicant will be abandoning this application. Applicant will need to obtain F-1 stamp at the consulate before applicant can travel back to the United States on F-1 status. Or, if applicant returns to the US on H-4 status, applicant will need to refile the (H4 to F-1) change of status application.


Q: When applicant's change of status application gets abandoned because of travel outside of United States, can the applicant come back to United States on existing H-4 visa (i.e. does applicant's existing H-4 visa stands valid after leaving United States)?

A: Yes, the visa should not be invalidated and as long as the H-4 visa stamps remains valid it can be used to travel back to the US.


Q:  Is it safe for the H4 Holder to get F1 Visa stamping when principal H1B holder has filed LC PERM for the green card?

A: The risk is whether the government would imply immigrant intent at H4 Holder's F-1 stamping -- a PERM is not a non-immigrant application so even if the PERM was filed on principal H1B holder's behalf, it should not have to be disclosed as it is not an "immigrant petition". 

Friday, June 28, 2013

Is your HDMI Cable not transferring audio from PC to TV?

HDMI cable can transfer Video and Audio in High Definition quality from one device to another device. If you are not hearing PC's audio on TV when using an HDMI cable, try changing the settings as shown below.


While the computer's display may automatically be detected by an external device, the audio feed is not picked up unless the computer's settings are changed. You can check your computer's settings by going to : Control Panel -> "Hardware and Sound" -> "Sound" -> Select "Playback" tab ->  Then Select sound default as "HDMI" device. This should solve the problem, but just remember to set the default back to the computer speakers when you are finished using it on your TV.

Monday, April 15, 2013

Garmin nüvi GPS showing "PRESS DOT" when switched-on?

I suggest, first you go outside so that your nüvi can find satellite, and then see if you can actually press the dot using a pen or pencil (with the plastic tip, if possible). You should be asked to do this a number of times (5 times usually) until the screen is calibrated. Be as accurate as you can. 

If you still get no response then try a hard reset.


Monday, January 21, 2013

Questions about H1B Visa Transfer Petition


We got following responses from Immigration Lawyer for our questions related to 'H1B Transfer Petition: Travel outside of U.S. after petition is approved?'


Q: I will continue working with my current employer for around a month after petition is approved. Please let me know if I can travel outside U.S. during that duration.

A: You may travel as long as you have a valid visa stamp in your passport and you may work for your old employer as long as you have a valid H-1B with them and they do not withdraw your H-1B.

We wish to remind you that traveling outside of the U.S. while your H-1B petition is in progress could affect your petition. If you have plans to travel abroad prior to the approval of your petition, please contact your immigration lawyer.


We got following responses from Immigration Lawyer for our questions related to 'H1B Transfer Petition: How long employee can continue working with old employer?'

Q: I'm currently working for Company 'X' on H-1B Visa. I have decided to join another Company 'Y' and Visa Transfer Petition is already approved.

I recently came across the statement : "The law states that employee must join the petitioning employer within 60 days of the start of validity of the H-1B petition that was approved".

This means that I should resign the Company X and join Company Y within 60 days of transfer petition approval. Is it true? Please let me know.

A: Yes, that is correct.

Q: Is there any way to extend that duration beyond 60 days? Please let me know. Due to unavoidable reasons, I would not be able to join Company 'Y' within 60 days of visa transfer petition approval.

A: No one will know when you start, so it's not the type of rule that is inflexible. Talk to the company to set a start date.

Friday, October 28, 2011

Procedure to purchase Other State Vehicle in India

Vendee needs to sumbit the following documents in RTO under whose jurisdiction Vehicle is going to be used:

  • RC (Registration Certificate).
  • NOC (i.e. Form 28) - Two copies - NOC should mention the RTO under whose jurisdiction Vendee will be registering the Vehicle.
  • Form 29 - Two copies - Needs to be signed by the Vendor [Here, signature should match with one on RC].
  • Form 30 - Needs to be signed by the Vendor [Here, signature should match with one on RC].
  • Insurance.
  • PUC (Pollution Under Control) receipt.
  • Xerox of ID Proof of Vendor.
  • Purchase Invoice.

If the Vendor has taken loan for the Vehicle, you may require Consent of Financier also (i.e. Form 35).

Form 29 and Form 30 can downloaded from: http://www.registrationdelhionline.com/Online/downloadable_forms.asp

Once the Vehicle is registered in the destination State, you can apply for refund of tax in the source state. RTO department returns the balance amount (after deducting the tax for the years which you stayed in the Source State) via cheque within a month. While applying for refund, you need to carry the following documents:






Procedure for Transfer/Closure of EPF (Employee Provident Fund) Account in India

Procedure for Closure of EPF Account in case of leaving service/retirement/termination:

After 60 days of separation, you need to submit the following to your previous employer for withdrawal.


Then previous employer will place a request with the RPF (Regional Provident Fund) office. Once the forms are submitted in RPF office, it is between you and RPF office. In general, RPF office takes around 4 months to process your claim and credits the amount to the bank account mentioned in the Cancelled Cheque. Usually, RPF office sends a Account Payee Cheque to the banker and then banker deposits the cheque in your account.

RPF office won't deduct any taxes, since they will not know in which tax slab you fall. If you withdraw PF before 5 years, you are supposed to declare it during IT Returns filing and pay tax for the same.


If the PF account is dormant, you will not receive any interest from 3rd year onward. Till 3 years, you usually get 8% PA interest. Note that you can keep your PF account as long as you want.
Note that PF is for retirement purposes, not a very good idea withdrawing the same prematurely.


Procedure for transfer  of EPF Account in case of leaving service:


You need to submit the following to your current employer for transfer. You need to submit 3 copies.


When you submit the Form 13 to current employer, he will send it to the RPF office where your current EPF account is held. Then your current RPF office will send it to RPF office of your previous employer. Now, Previous Employer's RPF Office will initiate the transfer after confirming with Previous Employer. Here, if you submit Form 3A, RPF is not required to confirm with your previous employer, thus speeding-up the process.


If the transfer do not happen even after 6 months, you may want to file an online grievance with: http://epfigms.gov.in/

Thursday, June 17, 2010

Psychiatrist vs. Psychologist

The difference between the two mental health professional is in nature of treatment. Psychologist primarily aids the depressed patient by counseling and psychotherapy. A psychiatrist may also perform psychotherapy; but, in addition, can prescribe medications and perform ECT (electroconvulsive therapy).

Because psychiatrists are trained medical doctors, they can prescribe medications, and they spend much of their time with patients on medication management as a course of treatment. A psychiatrist is a Medical Doctor (M. D.). Psychologists are mental health professionals who hold a doctorate (Ph.D. or Psy.D.) and be called "doctor"; but, are not medical doctors (M. D.). 

Psychologist's training and education includes graduate study for at least six years in human behavior, therapeutic treatment of emotional problems,  theories of  personality, psychological test construction and administration, experimental research,  statistical analysis of data, as well as a clinical internship. Psychologists focus extensively on psychotherapy and treating emotional and mental suffering in patients with behavioral intervention. Psychologists are also qualified to conduct psychological testing, which is critical in assessing a person's mental state and determining the most effective course of treatment.

Income Tax India: Do we need to pay tax on Shares or Mutual Funds?

Summary:

If you hold Shares or Mutual Funds for more than one year, no tax is payable. This is assuming STT(Securities Transaction Tax) is applied on all your stock market transactions.
If you did not hold Shares or Mutual Funds for one year, profit becomes part of gross total income and normal tax rate applicable. If you have purchased stocks through ESOP (Employee Stock Exchange Program), you are liable to pay tax on profit because don't pay STT while purchasing stocks.


What if you have received loss in sale of shares?

Capital loss (short-term or long-term) can be set off against ONLY capital gains (short-term or long-term). You can ensure carrying forward of loss on sale of shares by filing tax return in time. The loss left over after set-off, can be carried forward for eight years in the case of short term assets and for four years in the case of long term assets, for similar set-off.

Do we need to pay tax on Dividend received from MFs or Shares?

Dividend income (as referred u/s 115-O of the I.Tax Act) paid by Companies and Mutual Funds are exempt from tax. A 15% dividend distribution tax and surcharge of 3% is paid by companies before distribution. Equity mutual funds (with more than 65% of assets invested in equities) do not pay a dividend distribution tax, though other funds do. Liquid and Money Market funds pay 25% dividend distribution tax.01123

Details:

Definition of capital asset :

Capital Asset means all moveable or immovable property except trading goods, personal effects, agricultural land other than within municipal areas or within 8 kilometers from it wherever notified and gold bonds. Jewelry and ornament are not personal effects and their sale will attract capital gains.

Distinction between short term and long-term asset:

Capital Assets are of two types i.e., long term and short term. Long-term capital assets are assets held for more than 36 months before they are sold or transferred. In case of shares, debentures and mutual fund units the period of holding required is only 12 months.  Different rates of tax apply for gains on transfer of the long term and short-term capital assets. Gains on short-term capital asset are taxed as regular income.

Computation of Capital Gains :

Capital gains are to be computed by deducting the following three amounts from the consideration money received on transfer of the asset.

i)     The actual cost of the asset or its estimated market value as on 1.4.81, if acquired earlier;
ii)    The cost of improvement, if any, for the asset;
iii)   Expenses incurred on transfer of the asset; and In case of a long-term capital asset, the costs are increased as per a Cost inflation index for the year.

Shares and Mutual Funds becomes 'long term capital assets' after one year of holding. Sale of such long term assets gives rise to 'long term capital gains'. As per 'Section 10(38) of Income Tax Act, 1961', long term capital gains on shares or securities or mutual funds on which Securities Transaction Tax (STT) has been deducted and paid, no tax is payable. STT has been applied on all stock market transactions since October 2004 but does not apply to off-market transactions and company buybacks; therefore, the higher capital gains taxes will apply to such transactions where STT is not paid.


For companies abroad, the tax liability is 20% of such gains suitably indexed (since STT is not paid).

All capital gains that are not long term are short term capital gains, which are taxed as such:

- Under section 111A, for shares or mutual funds where STT is paid, tax rate is 10% From Asst Yr 2005-06 as per Finance Act 2004. For Asst Yr 2009-10 the tax rate is 15%.
- In all other cases, it is part of gross total income and normal tax rate is applicable.

Exemptions from Capital Gains (such as sale of residential house) :
In case of Individuals and HUF, long-term capital gains are exempt if the sale proceeds are reinvested in certain assets.
Some examples:
A)        Profits on sale of residential house is reinvested in a new residential house.
B)         Long term capital gains are invested in notified bonds
These exemptions are subject to certain conditions and the reinvestment has to be made within the prescribed time.


FAQs from www.incometaxindia.gov.in about 'What if you have received loss in sale of shares?' :

WAT IS THE LAW ON SET OFF OF LOSS ON SALE OF SHARES?
    Capital loss - short-term or long-term, can be set off only against capital gains - again, short-term or long-term. Obviously would first offset capital loss against short-term gains as these are taxed at higher rates. Remember, capital loss cannot be set off against other income.

WHAT IS THE LAW ON CARRY FORWARD OF LOSS ON SALE OF SHARES?
    The loss left over after set-off, can be carried forward for eight years in the case of short term assets and for four years in the case of long term assets, for similar set-off.

HOW TO ENSURE CARRYING FORWARD OF LOSS ON SALE OF SHARES?
   By filing your tax return in time.



Further Information and References:
-----------------------------------------
http://en.wikipedia.org/wiki/Income_tax_in_India
http://www.incometaxindia.gov.in/general/computation.asp#c3
http://www.incometaxindia.gov.in/publications/1_Compute_Your_Salary_Income/3_Income_from_capital_gains.asp