Version 19

                                                                                     

    Step 8 of 8 - Previous

     

    Step 8 - Server-less Testing using Eclipse and TestNG

     

    If you have skipped any steps, Steps 1-6 are required before proceeding.

     

    Begin, by opening up eclipse. We're going to have to install the TestNG plugin. Go to "Find and Install".

     

     

    Choose the "Search for new features to install" radio button, then "Next".

     

     

    Now, we need to add a "New Remote Site...". The remote site for TestNG eclipse plugins is: "http://beust.com/eclipse".

     

     

    Then click "Finish".

     

     

    Click the TestNG checkbox and then "Next".

     

     

    The next 2 screens will prompt you to Accept the license agreement, verify the install by clicking "Install All". By now, you've already been through this with the Callisto plugins, so the screenshots are omitted. After the TestNG plugin is installed, you must restart eclipse.

     

    Now, here comes the hard part. It turns out that the project build path for successfully running TestNG must be tweaked. Begin by adding embedded-ejb to the build path.

     

     

    Click "Add Class Folder". Then select the "/sample/embedded-ejb/conf" folder.

     

     

     

    Before you click "OK", go ahead and "Remove" "JBOSS 4.0". That library will screw up containerless testing.

     

     

    Don't click "OK" just yet. We still have some work to do. Click on the "Source" tab. Then click "Link Source". You need to add "EarContent" folder then click "Finish".

     

     

    You will do the same for "WebContent".

     

     

    Now, you can click "OK". We only have one more change to do, then we will be ready to test. This last change is to edit "sampleEJB/WebContent/WEB-INF/components.xml". You will make two changes to this file. First, change:

     

         <property name="jndiPattern">sample/#{ejbName}/local</property>
    
         to
    
         <property name="jndiPattern">#{ejbName}/local</property>
    

     

    Then, change:

     

         <component class="org.jboss.seam.core.Ejb" installed="false"></component>
    
         to
    
         <component class="org.jboss.seam.core.Ejb" installed="true"></component>
    

     

     

    Save components.xml and right click on "sampleEJB/ejbModule/org.jboss.seam.example.test/example-testng.xml", "Run As", "TestNG Suite".

     

     

    With any luck, you'll see all green and now you're good to go, once you learn howto write your own TestNG scripts. go to http://testng.org/doc/ for more info on this great alternative to JUnit.

     

                                                                                    Step 8 of 8 - Previous