Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: how to make sure backend code is working when it doesn't have UI

  1. #1
    Junior Member
    Join Date
    Nov 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how to make sure backend code is working when it doesn't have UI

    Hi,

    I am new to jave and I have one qoestion. I am asked to code DAO layer only,

    I can write the code like in DAO layer we write to post some field to the database. I can write the method but I dont know if it really works or not.

    As I dont know how to trigger the method in the first place as it doesn''t have a UI.

    How do we trigger to run a DAO method only when there are no other flow which triggers this method to run.

    In short how to test or debug if this and only this method is working. I need this immediately for my work so please reply as soon as possible.

    Thank you.


  2. #2
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    609
    My Mood
    Sleepy
    Thanks
    10
    Thanked 93 Times in 86 Posts

    Default Re: how to make sure backend code is working when it doesn't have UI

    Hi,
    you can setup a JUnit test, or you simply instanciate your DAO class and invoce the method from a small driver class.

  3. #3
    Forum VIP
    Join Date
    Jul 2010
    Posts
    1,676
    Thanks
    25
    Thanked 329 Times in 305 Posts

    Default Re: how to make sure backend code is working when it doesn't have UI

    Creating a JUnit test would be the best way to approach this if your backend code is complex, since unit testing will allow you to easily test each individual scenario in one go. If you need any help on how to set up a unit test, feel free to ask and I can walk you through it.
    NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:

    When asking for help, please follow these guidelines to receive better and more prompt help:
    1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
    2. Give full details of errors and provide us with as much information about the situation as possible.
    3. Give us an example of what the output should look like when done correctly.

    Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/

Similar Threads

  1. Replies: 7
    Last Post: May 8th, 2013, 02:33 PM
  2. Replies: 3
    Last Post: October 4th, 2011, 09:03 PM
  3. The program working fine but the "NO" button doesn't work
    By ahcenpg in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 1st, 2011, 07:32 PM
  4. How to make a program into a working .jar? (eclipse)
    By ynnad95 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: September 16th, 2011, 08:29 PM
  5. Code is working in Eclipse but when exported to Runnable Jar doesn't work
    By jjain.jitendra@gmail.com in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 24th, 2011, 07:12 AM