EaseTech/easytest

Excel data loading issues

Opened this issue · 18 comments

I have found a few more issues in excel data loading, these are real life scenarios

  1. If there are null values for any of the parameters then data is not loaded properly
  2. there is possibility that some param values are optional, so we need to allow null values
  3. ActualResult is written at wrong location, if param values are not same as first column values..which is possible in real-life sceanrios, hence flexibility is required

Anuj,

These issues are fixed in ExcelDataLoader, Param.java, GeneralUtil file. I have merged these fixes to the latest code that I have taken from master branch.
Please create dummy GeneralUtil.java file in org.easetech.easytest.util package at 'Ravi' branch. I will upload all these files.

I will create the dummy file by end of Sunday for sure. i am in the middle of a very hectic period where I am working quite a lot for my office and there are loads of relatives that have suddenly come to my place for stay :)

Just give me few days time and I will have the things for you.

Cheers!

No issues mate. take your time.

Cheers,
Ravi

On Fri, Oct 26, 2012 at 1:42 PM, Anuj Kumar notifications@github.comwrote:

I will create the dummy file by end of Sunday for sure. i am in the middle
of a very hectic period where I am working quite a lot for my office and
there are loads of relatives that have suddenly come to my place for stay :)

Just give me few days time and I will have the things for you.

Cheers!


Reply to this email directly or view it on GitHubhttps://github.com//issues/54#issuecomment-9811582.

Hi ravi. I have checked in a file by the name of CommonUtils to the util package of ravi branch. You can use this class to get your methods in. This class already exists in the master package as part of the Report generation strategy for EasyTest. Let me know if you need anything else.

Can you change the class name to GeneralUtil ?

On Mon, Oct 29, 2012 at 10:39 AM, Anuj Kumar notifications@github.comwrote:

Hi ravi. I have checked in a file by the name of CommonUtils to the util
package of ravi branch. You can use this class to get your methods in. This
class already exists in the master package as part of the Report generation
strategy for EasyTest. Let me know if you need anything else.


Reply to this email directly or view it on GitHubhttps://github.com//issues/54#issuecomment-9861998.

I can. but I was hoping if you could use this class name as otherwise there would be few changes I need to do in the master branch. Let me know if its a big issue and I can change the name to GeneralUtil.

Also i will create the class structure for code gen by end of day today for you to work on it and check in the changes.

Cheers!

I think change from your side is smaller than changes at my end. i have to
change in easytest, easytest-codegen, template etc..

On Mon, Oct 29, 2012 at 10:47 AM, Anuj Kumar notifications@github.comwrote:

I can. but I was hoping if you could use this class name as otherwise
there would be few changes I need to do in the master branch. Let me know
if its a big issue and I can change the name to GeneralUtil.

Also i will create the class structure for code gen by end of day today
for you to work on it and check in the changes.

Cheers!


Reply to this email directly or view it on GitHubhttps://github.com//issues/54#issuecomment-9862240.

Right. I have changed the name to GeneralUtil.

Cheers!

Thanks Anuj.

Now I have updated following three files in Ravi branch. please merge only those three files to Master branch.

  1. ExcelDataLoader
  2. Param -- annotation
  3. GeneralUtil

I could not pull request from Master branch yet, I will try this week-end. But above three files have been updated to your latest files, so pls merge only above three files.
Let me know if you find any issues.

Cheers,
Ravi

Great. I will merge these files after tomorrow as now I am preparing
EasyTest to be presented to the wider group of audience here in the
Netherlands. I will keep you posted.

Cheers!

On Tue, Oct 30, 2012 at 12:54 PM, ravi-polampelli
notifications@github.comwrote:

Thanks Anuj.

Now I have updated following three files in Ravi branch. please merge only
those three files to Master branch.

  1. ExcelDataLoader
  2. Param -- annotation
  3. GeneralUtil

I could not pull request from Master branch yet, I will try this week-end.
But above three files have been updated to your latest files, so pls merge
only above three files.
Let me know if you find any issues.

Cheers,
Ravi


Reply to this email directly or view it on GitHubhttps://github.com//issues/54#issuecomment-9902880.

Ok great! All the best

On Tue, Oct 30, 2012 at 12:17 PM, Anuj Kumar notifications@github.comwrote:

Great. I will merge these files after tomorrow as now I am preparing
EasyTest to be presented to the wider group of audience here in the
Netherlands. I will keep you posted.

Cheers!

On Tue, Oct 30, 2012 at 12:54 PM, ravi-polampelli
notifications@github.comwrote:

Thanks Anuj.

Now I have updated following three files in Ravi branch. please merge
only
those three files to Master branch.

  1. ExcelDataLoader
  2. Param -- annotation
  3. GeneralUtil

I could not pull request from Master branch yet, I will try this
week-end.
But above three files have been updated to your latest files, so pls
merge
only above three files.
Let me know if you find any issues.

Cheers,
Ravi


Reply to this email directly or view it on GitHub<
https://github.com/EaseTech/easytest/issues/54#issuecomment-9902880>.


Reply to this email directly or view it on GitHubhttps://github.com//issues/54#issuecomment-9903473.

I am about to test the changes you have specified for merging. I have couple of questions:

  1. I see no change in Prama.java class between master and Ravi branches. Did I miss anything?
  2. How shall I test the scenarios you have fixed?

Thanks,
Anuj

  1. In Ravi branch, you can see that in private method convert() there are
    calls to GeneralUtil methods.
  2. You can run your existing tests whether they are working fine or not.
    and in XL-sheets,
    i) Also, you can change the type of cell from General to any other type
    like Time, Number, Custom etc.. and test to see the conversion is happening
    fine.
    ii) TestExcelDataLoader.java file, change the parameter types from
    Long/Double to other types like java.sql.Timestamp etc.. and test.
    iii) similarly, you can the type of the parameters in other test
    classes of XML, CSV and test.

On Sun, Nov 4, 2012 at 2:29 PM, Anuj Kumar notifications@github.com wrote:

I am about to test the changes you have specified for merging. I have
couple of questions:

  1. I see no change in Prama.java class between master and Ravi branches.
    Did I miss anything?
  2. How shall I test the scenarios you have fixed?

Thanks,
Anuj


Reply to this email directly or view it on GitHubhttps://github.com//issues/54#issuecomment-10051008.

Hi Ravi,
I tried the implementation for handling Object values and I am getting incorrect values returned atleast for Java.util.Date type objects.

Heres what I did:

  1. I created a Date object in my Excel file by clicking on Formulas tab and selecting Date and Time to insert a date in a column like this:
    itemDate
    23-12-2007
    24-11-2012

  2. I then changed my test method to have this itemDate as parameter:
    public Item getExcelTestDataWithDouble(@param(name = "libraryId")
    Double libraryId, @param(name = "itemId")
    Double itemId, @param(name="itemDate")java.util.Date itemCreationDate) {

  3. When I ran the test case, the value that was provided to the itemCreationDate was incorrect. The values that were provided to the test method for the Dates values mentioned in 1) above are:

Thu Jan 01 01:00:39 CET 1970
Sat Nov 24 00:00:00 CET 2012

Clearly the first one is wrong but the second one is correct.

I suspect the following.
Excel is returning a Long Number instead of Date and the General Util is somehow not able to process the value correctly.
Did you have a look at the following class to handle Excel Dates : http://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/DateUtil.html
We already have this class available with us and may be we can somehow make use of it?

Cheers!
Anuj

Just found out one more thing. If I create date using Excel functions then it is interpretted incorrectly, but if it is passed as normal String, then the value is converted properly.

Is this the intended behavior?

In the mean time I have also made one small change to the Param. java class.
I have replaced the statements like : if("java.sql.Timestamp".equals(idClassName))
with statements like : if(Timestamp.class.isAssignableFrom(idClass))

I feel this is more clear and cleaner. What do you think?
I couldn't find any other option except checking in your branch. Let me know if it is all right.

Cheers!

Anuj,
Your changes 'isAssignableFrom ' is working fine.
The issue raised by you regarding incorrect dates is interesting, actual issue there is the difference between excel date value(no.fof days since 1/1/1900) and java Date value (no.of milliseconds from 1/1/1970 GMT).
As you suggested we should use POI DateUtil and convert the value correctly to generic format in Loader file it self. I think this is applicable for CSV and XML formats too. Isn't it?
I will check ExcelLoader for this now.

Hi Ravi,
I have made quite a few changes more to classes like Param and GeneralUtil to support Collections as parameter type.
I will be checking in the changes hopefully by tomorrow and then may be you can do a complete code review for me and suggest the changes, if any. what do you think?

Cheers!