1
                                                                     Exhibit 5.1

                                 April 25, 1995

Megatest Corporation
1321 Ridder Park Drive
San Jose, California 95131

         RE:  REGISTRATION STATEMENT OF FORM S-8

Ladies and Gentlemen:

         We have examined the Registration Statement on Form S-8 to be filed by
you with the Securities and Exchange Commission on or about April 25, 1995 (the
"Registration Statement") in connection with the registration under the
Securities Act of 1933, as amended, of an aggregate of 1,800,000 shares of your
Common Stock (the "Shares") reserved for issuance under the 1990 Stock Option
Plan, the Employee Stock Purchase Plan, and the Director Stock Option Plan
(collectively, the "Plans"). As your legal counsel, we have examined the
proceedings taken and are familiar with the proceedings proposed to be taken by
you in connection with the sale and issuance of the Shares under the Plans.

         It is our opinion that, when issued and sold in the manner referred to
in the Plans and pursuant to the respective agreements which accompany each
grant under the Plans, the Shares will be legally and validly issued, fully paid
and nonassessable.

         We consent to the use of this opinion as an exhibit to the Registration
Statement and further consent to the use of our name wherever it appears in the
Registration Statement and any amendment thereto.

                                  Very truly yours,

                                  WILSON, SONSINI, GOODRICH & ROSATI
                                  Professional Corporation

                                  /s/ Wilson, Sonsini, Goodrich & Rosati, P.C.