From: Dakre, Y. M [I. C. f. Sprint] <Yog...@sp...> - 2008-10-15 15:13:49
|
Hi Team, Hope everybody is fine and doing well at your end. I have one query regarding setting up a data for ArrayList. I had some what done but not sure this is the way to follow. The sample class is this which have arraylist and the mapping is done in attached xls file. Following example works fine. The call is C newc=new C(); C cc=newc; for(int row=6;row<=9;row++){ cc = (C)dataloader.loadData((junit.framework.TestCase)newc, "request", ""+row); } ArrayList ts=(ArrayList)cc.getMe(); for(int i=0;i<ts.size();i++) System.out.println(ts.get(i)); The Actual class. import java.util.ArrayList; import org.ddsteps.DDStepsTestCase; import org.ddsteps.data.DataLoader; import org.ddsteps.data.excel.CachingExcelDataLoader; public class C extends DDStepsTestCase implements java.io.Serializable{ ArrayList me; public DataLoader createDataLoader() { // TODO Auto-generated method stub return CachingExcelDataLoader.getInstance(); } public Object getMe() { return me; } public void setMe(Object me) { this.me.add(me); } public C() { super(); me=new ArrayList(); // TODO Auto-generated constructor stub } } How can I represent the ArrayList or Object[] in one cell of xls file is there any way or example ? Thanks & Regards, Yogesh Dakre IBM Global Services Mailstop KSOPHC0206 - 2B618 6240 Sprint Pkwy, Overland Park, KS 66251 (913) 762-9353 (Off.) (913) 486-5771 - PCS Paging yog...@sp... "Do it Solution Ahead" -----Original Message----- From: Dakre, Yogesh M [IBM Contractor for Sprint] Sent: Tuesday, September 02, 2008 1:58 PM To: 'Adam Skogman' Subject: RE: help regarding DDSteps.. Hi Adam, Thanks...I was able to resolve the issue with your suggestion. I have one more question...I am using RAD7 for development purpose with eclipse3.4.0 I am able to see all the test case result but with RAD it do not show all the result row wise. Are you aware about any plugin or changes I need to do in order to get excel row result in RAD7. I had checked in RAD7 excel version is Version: 1.0.3.v20070202-1200-gW3quizrSB1Fxqp Thanks & Regards, Yogesh Dakre IBM Global Services Mailstop KSOPHC0206 - 2B618 6240 Sprint Pkwy, Overland Park, KS 66251 (913) 762-9353 (Off.) (913) 486-5771 - PCS Paging APP SUPPROT - QAS/IIS/IIN yog...@sp... "Do it Solution Ahead" -----Original Message----- From: Adam Skogman [mailto:ada...@gm...] Sent: Wednesday, August 20, 2008 11:32 AM To: Dakre, Yogesh M [IBM Contractor for Sprint] Subject: Re: help regarding DDSteps.. Hi! This here is your clue: Failed to convert property value of type [java.lang.String] to required type [com.testdata.TierInfo] for property 'tierInfo' Spring (which handles conversion) is saying that is has no propertyeditor to do the conversion. You need to code such a converter yourself, using PropertyEditorSuppport for a superclass. Then register it from a static initializer into PropertyEditorManager.registerEditor(...) In the next version of DDSteps there will be a way to register these from the testcase itself... Have a look at the PropertyEditor docs in the spring framework docs for some input on writing these. Cheers /Adam On 20 aug 2008, at 16.53, Dakre, Yogesh M [IBM Contractor for Sprint] wrote: > Thanks Adam, > > I am stuck in the place where class RateCard have member variable as > Object of class TierInfo. > > In excel file not sure how to set the values for TierInfo. If I put > string there then I get following exception. If we are able to > address this then we will be able to move forward. Please let me > know if there is a way to it. > > 469 [main] DEBUG org.ddsteps.junit.behaviour.DdRowBehaviour - > [populate] Data: Name 'tierInfo' = Value 'sss' > 20 Aug 2008 09:31:56.691 [DEBUG] [main] > [org.ddsteps.dataset.transform.PropertyPlaceholderTransformer] - > [transform] No expressions found in string 'sss'. > 469 [main] DEBUG > org.ddsteps.dataset.transform.PropertyPlaceholderTransformer - > [transform] No expressions found in string 'sss'. > 20 Aug 2008 09:31:56.691 [DEBUG] [main] > [org.springframework.beans.TypeConverterDelegate] - Field [sss] > isn't an enum value > java.lang.NoSuchFieldException: sss > at java.lang.Class.getField(Class.java:919) > at > org > .springframework > .beans > .TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java: > 200) > at > org > .springframework > .beans > .TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java: > 127) > at > org > .springframework > .beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:770) > at > org > .springframework > .beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:606) > at > org > .ddsteps > .junit.behaviour.DdRowBehaviour.setUpData(DdRowBehaviour.java:190) > at > org.ddsteps.junit.behaviour.DdRowBehaviour.setUp(DdRowBehaviour.java: > 110) > at com.testdata.UsageDataLoader.loadData(UsageDataLoader.java: > 82) > at com.testdata.UsageDataLoader.main(UsageDataLoader.java:127) > 469 [main] DEBUG org.springframework.beans.TypeConverterDelegate - > Field [sss] isn't an enum value > java.lang.NoSuchFieldException: sss > at java.lang.Class.getField(Class.java:919) > at > org > .springframework > .beans > .TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java: > 200) > at > org > .springframework > .beans > .TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java: > 127) > at > org > .springframework > .beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:770) > at > org > .springframework > .beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:606) > at > org > .ddsteps > .junit.behaviour.DdRowBehaviour.setUpData(DdRowBehaviour.java:190) > at > org.ddsteps.junit.behaviour.DdRowBehaviour.setUp(DdRowBehaviour.java: > 110) > at com.testdata.UsageDataLoader.loadData(UsageDataLoader.java: > 82) > at com.testdata.UsageDataLoader.main(UsageDataLoader.java:127) > org.springframework.beans.TypeMismatchException: Failed to convert > property value of type [java.lang.String] to required type > [com.testdata.TierInfo] for property 'tierInfo'; nested exception is > java.lang.IllegalArgumentException: No matching editors or > conversion strategy found > Caused by: java.lang.IllegalArgumentException: No matching editors > or conversion strategy found > at > org > .springframework > .beans > .TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java: > 212) > at > org > .springframework > .beans > .TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java: > 127) > at > org > .springframework > .beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:770) > at > org > .springframework > .beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:606) > at > org > .ddsteps > .junit.behaviour.DdRowBehaviour.setUpData(DdRowBehaviour.java:190) > at > org.ddsteps.junit.behaviour.DdRowBehaviour.setUp(DdRowBehaviour.java: > 110) > at com.testdata.UsageDataLoader.loadData(UsageDataLoader.java: > 82) > at com.testdata.UsageDataLoader.main(UsageDataLoader.java:127) > > > Thanks & Regards, > Yogesh Dakre > IBM Global Services > Mailstop KSOPHC0206 - 2B618 > 6240 Sprint Pkwy, Overland Park, KS 66251 > (913) 762-9353 (Off.) > (913) 486-5771 - PCS Paging > APP SUPPROT - QAS/IIS/IIN > yog...@sp... > > "Do it Solution Ahead" > > From: Adam Skogman [mailto:ada...@gm...] > Sent: Tuesday, August 19, 2008 2:32 PM > To: Dakre, Yogesh M [IBM Contractor for Sprint] > Subject: Re: help regarding DDSteps.. > > Hi, just want to let you know I got your mail, and will read and > answer. > > Cheers > /Adam, project lead > > On 18 aug 2008, at 21.46, Dakre, Yogesh M [IBM Contractor for > Sprint] wrote: > > > Hi Team, > > I am newbie to DDSteps. In our project I want to use DDStesps. > The scenario is > 1. We get response object from the backend layer. > 2. We will be creating the stub data for this response object. > (can we create stub data using DDSteps?) > 3. We will execute our test against the stub data. > a. This test data will be read from excel file as explained in > the documentation. > b. The stub data XML / XSL not yet finalized. > 4. Is there any way in ddSteps so that data will > automatically get loaded in to the object used by the class which we > are testing? > c. For example > Class A have few variables and one class B > Class A{ > String str1; > String str2; > B b > } > > And > > Class B{ > String str3; > String Str4; > int I; > ArrayList al; > ... > .... > ... > } > > When we will create excel sheet in order to test class A I will have > to declare call B in the excel sheet. How can we do that using > DDSteps? I don't want to create excel sheet for Class B separately. > > Hoping positive response from your side, Thanks and regards. > > > > Thanks & Regards, > Yogesh Dakre > IBM Global Services > Mailstop KSOPHC0206 - 2B618 > 6240 Sprint Pkwy, Overland Park, KS 66251 > (913) 762-9353 (Off.) > (913) 486-5771 - PCS Paging > APP SUPPROT - QAS/IIS/IIN > yog...@sp... > > "Do it Solution Ahead" > > > > > <RateCard.xls> |