If you do a personality test in a job interview, what are they testing for?

One recent survey showed nearly 40% of companies in the U.S use personality tests in recruitment. The figure is smaller in Australia, but growing. So when you are being tested at work; which qualities are valued most highly? And are the tests legit?