jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patwa, Priyank (Cognizant)" <PPriy...@pun.cognizant.com>
Subject CactusStrutsTestCase...testing in a loop for different actionPerforms
Date Thu, 27 Nov 2003 14:45:42 GMT
Hi all,
    I have now successfully set up the environ for cactusStrutsTestCase
i have in my dbase some ids(strGSMID) for which ther e are corresponding f/ws
so if i hardcode them with particular vlues i get the results fine 
but if i execute the tests in a while loop where in i pick up the values from a simple text
file and if i give an error value it simply throws an error for that error value 

if  i keep the actionPerform and verifyForward method in  a loop with the value for f/ws picked
up from a while...is ther eany way to show the correct tests and also the falied tests...
as for say three inputs in my i/p file of which first 2 are correct and 3rd is wrong i get
only exception for third one!

public void testActions() {

    EmployerDO employerObj = new EmployerDO();
    String strModule = IMetConstants.ER_LANDING_NAME;
    Properties properties = new Properties();
    String strGSMID = null;
    String strForwardName = null;
    FileReader fr = null;
    
    StringTokenizer st = null;
    String record = null;
    int recCount  = 0;
    try{
        fr = new FileReader("TestData.txt");
        BufferedReader br = new BufferedReader(fr);
        record = new String();

        while((record = br.readLine())!= null){
                recCount++;
                st = new StringTokenizer(record);
                if(st.hasMoreTokens())
                    strGSMID = st.nextToken();
                else
                    System.out.println("Error reading string tokens" );
                
                if(st.hasMoreTokens())
                    strForwardName = st.nextToken();
                else
                    System.out.println("Error reading string tokens" );
     
                System.out.println("the f/w name " + strForwardName);
                System.out.println("the gsmid is:"+ strGSMID);
    
               // Get employer DO from the EmployerManager
                    employerObj = EmployerManager.initializeERProfile(strGSMID,strGSMID,null);

               //Set the ER module in session database.
                    SessionHandler.setAttribute(SessionConstant.MODULE, IMetConstants.USERTYPE_EMPLOYER,
strGSMID, null);

                    System.out.println("After setting Module in session");

                    SessionHandler.setAttribute(SessionConstant.EMPLOYER_PROFILE, employerObj,
strGSMID, null);
            
                    System.out.println("After setting Employer profile in session");

   
                    this.clearRequestParameters();
                    addRequestParameter(IMetConstants.GSM_ID, strGSMID);

                setRequestPathInfo("/employer/claimsLanding");
                actionPerform();
                verifyForward(strForwardName);
                verifyNoActionErrors();
            }//WHILE ENDS HERE  
    }//TRY ENDS HERE

 }//function ends here

TestData.txt contains...

12 showIntakeGettingStarted
11 showInquiryGettingStarted
13 showInquiryGettingStarted


of these 3 record is not correct

it gives me 1 failure for only that and i want success also to be shown


i hope i have been able to explain my problem...:-)

Thanx & Regards,
Priyank Patwa.
Cognizant Technology Solutions India Pvt. Ltd.
Infotech Park,
Hinjawadi,
Pune 411027,
India.
Ph. 2931100 extn: 2476



Mime
View raw message