Results 1 to 9 of 9
  1. #1
    frendmansi is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default Junit with input as xml

    Hello All,

    I am stuck with a testing issue!
    I have a class to perform unit testing for.The input to the methods in the class is string.This string is made by flattening one of my own XML.Now, to perform the tests,I want the aggregates of my XML to be configured for different inputs.

    Is there any way in Junits framework to perform such type of testing?Or is there any other framework which can make my this happen?

    Thanks in Advance,
    Mansi

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,798
    Rep Power
    7

    Default

    Duplicate post

    Junit with input as xml

  3. #3
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    What is the question here?
    Are you asking
    how to join together xml files using Java
    or
    how to read xml files in a JUnit test?

  4. #4
    frendmansi is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default

    Hi! thnaks for ur reply! My quest is that how do i change aggregate values in the xml,during the execution of each test cases?

  5. #5
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Still not clear. Maybe if you post some relevant code explaining where the problem is.

  6. #6
    frendmansi is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default

    I am in the R&D phase of this requirement and yet to decide and start with the approach.
    Here's detailed explanation of the requirement:

    I am to test a class which has two two methods which need parameter values as String xml = myInputXML.toString();

    method call in the test case will be like:
    myTestCase(){
    .... {1}
    .... {2}
    myService.myMethod(xml);
    }

    Now I want the values of the aggregates in the xml file to be changed at lines {1} and {2} in myTest()

    Hope this makes it clear.Please ask if you need more details.

    Also,U can suggest any other framework if u this that will be better.

    Thanks

  7. #7
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    Why not start with multiple input xml files with known values?

  8. #8
    frendmansi is offline Member
    Join Date
    Apr 2011
    Posts
    4
    Rep Power
    0

    Default

    Thanks!Thats one option I have put as last thing to do ! Was just expolring things to make my test lighter as thr can be approx 20 cases and hence 20 xmls.

  9. #9
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    8

    Default

    If you autogenerate your testcases' input, you'd need test cases for those cases.
    Test cases usually start with known values as inputs and known expectations as outputs.

Similar Threads

  1. JUnit issues
    By aca10mpr in forum New To Java
    Replies: 0
    Last Post: 03-05-2011, 11:48 AM
  2. JUnit
    By cka in forum Eclipse
    Replies: 3
    Last Post: 07-27-2010, 04:14 PM
  3. Input technique for unknown lines of input
    By ducreative in forum New To Java
    Replies: 16
    Last Post: 09-23-2009, 09:26 AM
  4. Junit
    By Azndaddy in forum New To Java
    Replies: 6
    Last Post: 06-15-2008, 06:47 AM
  5. how to take input and verify input in Java programs
    By bilal_ali_java in forum Advanced Java
    Replies: 0
    Last Post: 07-21-2007, 08:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •