摘要 |
An approach for unit testing an Enterprise JavaBeans® (EJB®) bean is presented. A test case for unit testing the EJB® bean is initiated. An indication of a JUnit or an in-container testing mode is received. The unit testing of the EJB® bean in the indicated mode is initiated by injecting the EJB® bean by an injection functionality included in a test framework if the JUnit testing mode is indicated, or by an EJB® container if the in-container testing mode is indicated. A test object in the injected EJB® bean operates business logic on business data by inserting, updating or deleting business data, or by selecting business data to send to a client, thereby generating a set of resulting business data. An assertion operation on the set of resulting business data against expected data determines whether the test case succeeds or fails. |