How to structure your junit test folder ?

Hi,
I just would like to ask the forum community about the pro and cons of test folder structure. Some developers would argue that it is okay to put your test source code inside your application code source code. Example:
src
|--com
.....|----xyz
............|----SomeClass.java
............|----SomeClassTest.java     
But some developers prefer to put their test code outside the source folder:
src
|----com
.......|------xyz
.................|---SomeClass.java
test
|-----com
.......|----xyz
..............|-----SomeClassTest.java     
I usually roll with the second approach, because I do not want to clutter my source code with the test code. This will also make deployment easier. But I would like to know what other people think about it. What are the pro and cons of these 2 different approach.
Thank you. Your feed back is grea
Edited by: inoel131081 on Jul 4, 2008 5:14 PM

I also use the separate src-test folder
so i can clearly see what the coverage is of my source only without the coverage from my tests
so i can do an export from my source only
so in general because the tests are not really part of the project

Similar Messages

  • How to run a junit test?

    Hi,
    i have compliled a junit test class (MsgQueueTest extends TestCase). When i try to run it, i get:
    kostas@home:~/programming/java/SwarmTests/src$ java MsgQueueTest
    Exception in thread "main" java.lang.NoClassDefFoundError: junit/framework/TestCase
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
            at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)I have tried some parameters, but no luck so far. Any ideas?

    Append junit.jar to your CLASSPATH.

  • How to structure your SharePoint portal?

    I am working for a customer that have all their documents on a shared disk. We are about to implement SharePoint for them, and need to organize the content, and in this regards I have som questions. 
    I wanted to oganize the data in a hierarchical structure, so it would be easy  to build menus and easy for the users to understand.  The problem is that we have more than 2 TB of data, and one content database can not be bigger than 100 GB.
    Any ideas/experiences with such systems, and any advice for me on how we should implement\structure this. 
    We are using SharePoint 2013 on premise. 
    Best regards.

    Hi,
    In my opinion, you may check if you can categorize data from 2TB into mutiple small data parts(e.g. smaller than 100GB), then check if it can be used multiple content databases for each web appliction(administrate sites via
    PowerShell), and then use one or several sites to store different categories of data within each content database, also limit each content dabase size less than 200GB.
    Here is an article aobut the content database limits you can take a look.
    http://technet.microsoft.com/en-us/library/cc262787%28v=office.15%29.aspx#ContentDB
    Thanks
    Daniel Yang
    TechNet Community Support

  • Problems Debugging JUnit Tests

    Hi,
    I have been trying a TDD approach to my new development and until my latest test everythings been working well. Im using Eclipse by the way with JUnit incoporated into my project
    Now I have the following problem..
    I ran my latest test and my CPU usage shot up to 100%. In an attempt to work out why I selected Debug as JUnit Project, the following was displayed
    Class File Editor
    The Source attachment does not contain the source for the file Assert.class
    You can change the source attachment by clicking change attached source below.
    Unfortunately I don't know what this means, can anyone help me out here?
    Thanks

    I don't have access to any other IDE's apart from Eclipse, so I can't check if they run outside.You don't need an IDE to run outside Eclipse. Just run JUnit from a command shell, just like any other Java program that you'd run if you didn't have ANY IDE.
    Whats Ant? I presume i'm not using it.Ant is an XML and Java-based make tool that's a standard for Java these days:
    http://ant.apache.org
    It can run all your JUnit tests as part of your build process. It'll even work with Eclipse.
    Its my last test thats causing it not to work however
    it never even returns a failure it hangs the system
    before the failure is reported. If I remove this test
    and debug the other tests however the same error
    described in the first post occurs.Can you step through that JUnit test in the Eclipse debugger to see where it's hanging up? If you're going to use an IDE, might as well put it to work.

  • Use JUnit test EJB bean class

    I'm using Junit test EJB 3.0 session bean class by initialize :
    SessionBeanClass sbc = new SessionBeanClass()
    so the object I got is just a normal object, it's not remote or local interface.
    however, when I start JUnit within Jdeveloper, looks like the embed OC4J start.
    this behivor is strange to me, I thought I 'm not calling EJB in this case,why the OC4J start?
    this is different than running JUnit outside of JDeveloper?

    Yes, this is the way JDev works -- JDeveloper notices that this class happens to be a Session bean, and when you 'run' it, it assumes you want to 'run' it in the embedded OC4J server -- though clearly it is not what you want in this case.
    One way you can override this behavior is by creating a wrapper (POJO) class to be your JUnit test class, and have that class instantiate your Session bean.

  • How to import photos from a folder that contains hundreds of folders to Photos keeping the same folder structure?

    How to import photos from a folder that contains hundreds of folders to Photos keeping the same folder structure?

    You'll have to do that manually, i.e. export each album of photos to a folder with the same name located on your hard drive via  the File ➙ Export ➙ File Export menu option.
    OT

  • How to test servlet using Junit test????

    Hello everybody
    Does anybody know how to test an servlet class using Junit without using Cactus test . Is it possible to test a servlet using Junit without cactus test.Plz tell me the process how to test a servlet using Junit test .
    Regards
    srikant

    1) Do yoiu mean how to "run" your servlet code with sample parameter? This call manual testing with a sample run of you code. You need a web server(eg Tomcat), create a webapp with your servlet then deploy it there in order to run it.
    2) httpunit and junit are framework to write test case code that can be automated and repeatable. Plz read their doc.
    3) Your sample code me a very wrong way to retrieve and convert servlet parameters.
    Get a java toturial and servlet tutorial book and read it over the weekend. You need to get at least the basic.

  • JUnit Tests (How To) - Websphere/Eclipse

    I'm about to start looking into using JUnit to test some db resultset timings. As I haven't really dived into this before, I'm looking for some guidance.
    Can someone post an example of how I would use JUnit to test the timing of a resultset or the timing of a procedure.
    I could just do a simple timed test, but I want to start using JUnit.
    Where:
    <start timing>
    do a bunch of really wild stuff
    <end timing>
    Thanks.

    JUnit isn't meant for performance timing. There's nothing to stop you from doing it, of course.
    JUnit might be pertinent if you had a metric that would define success or failure of your "really wild stuff".
    But timing would be more the province of JMeter or another performance measurement tool.
    With that said, Eclipse handles JUnit tests easily. Just have the JUnit JAR in your project's build path. Open the debug view and you can run any JUnit test in your project.
    I have an Ant build.xml that runs all the tests in my projects automatically and generates reports for viewing in a Web browser. That's a great way to go, IMO.

  • Ask The Experts How to Improve Your PC's Performanc​e on June 1st at 3:30 pm PDT

    Learn how to improve your PC 's performance on June 1st from 3:30 -4:30 pm PDT. We'll have a team of experts available to answer your questions.   
    When it comes to performance, your PC is similar to your car. Both need to be cared for to keep them running run well. But unlike your car, you don’t need to bring your PC into a shop for a tune up. You can easily do it yourself if you know the right steps to take.  Our experts will answer your questions and provide tips on how to make your PC run better.  Topics that may be covered in this real-time chat event include the following:
    How to customize your PC to increase performance; 
    How to prolong your notebook’s battery life;
    How to choose the right video card, power supply, or add the right amount of memory; or
    How to use the tools built into your PC that can make it run better and fix common problems. 
    While you can attend this real-time chat event without signing up in advance, you must be a member of the HP Support Forums to ask questions. Signing up is easy and only takes a few moments, plus it will allow you to post questions or give answers on the Forums.
    And it is all free!
    So, come and learn how to get the most out of your PC. Please be sure to come on time as space is limited!
    Message Edited by timhsu on 05-12-2009 05:33 PM
    I work for HP, supporting the HP Experts who volunteer their time and technical knowledge to help others.
    This question was solved.
    View Solution.

    Here is the transcript of the chat event on improving PC performance. 
    Please note that I have altered the transcript so that follow up questions are included in the logical order.
    I am in the process of planning the next chat event. I would love to hear what topics would interest you, what day of the week and time is best for you, and if you think an hour is too long.
    So, if you get a minute, please let me know.
    I work for HP, supporting the HP Experts who volunteer their time and technical knowledge to help others.

  • How do you change the text color in your junk mail folder

    How do you change the text color in your junk mail folder?

    Try Mail Preferences/Junk tab and under " When Junk Mail Arrives" click Performe Custom Action then advanced
    you will see the option for colors.
    Hope this helps

  • How to find files in your iTunes Library & NOT in Your iTunes Music folder AND visa versa.

    Finding Files in iTunes Music folder that are not Listed in iTunes
    Make  2 Smart Play Lists and 1 Static Playlist as follows:
    1. Make a smart playlist called “All Files” with this rule: “Artist” is not “123456789″ (or any nonsense name that won’t be in your library).
    2. Make a static playlist called “All Live Files”.
    3. Make a smart playlist called “Missing Files” with these rules: Match all of the following rules, Playlist is “All Files”, Playlist is not “All Live Files”
    Preform the following operations:
    4. Select all the files from “All Files” and drag them into “All Live Files”. The dead files marked  ! will not copy over.
    5. “Missing Files” will contain all of your dead files. Select all and delete (Option+Delete). Voila, a nice clean iTunes library.
    I keep these three playlists in their own folder. Whenever I gather more than a couple dead tracks for whatever reason, I delete all the tracks in “All Live Files” and repeat steps 4 and 5.
    Finding Files in iTunes Library Are Not Present in iTunes Music Folder
    Search on ‘Net for an Applescript called “Music Folder Files Not Added.” This will be at a site called Doug’s Applescripts and costs a mere $1.99. Install and follow instructions. This script also happens of clean up gremlins such as Podcasts that won’t go away, etc.
    <Edited by Host>

    From the top of the page where the scripts live...
    The general method of use is to download the script to a folder of your choice, e.g. your Desktop, Downloads folder or create a folder at ...\iTunes\Scripts. Select a playlist or highlight some tracks in iTunes and then double-click on the script to execute it. If no specific tracks are selected the script will try to work with all tracks in the current playlist. Some scripts offer a choice of track by track confirmation of changes or fully automatic processing of the selection. Many of the scripts can optionally display a progress bar while running.
    You are strongly advised to backup your entire library, or at the very least the iTunes Library.itl file, before use. Test the behaviour of your chosen script on a small group of files first to make sure it does what you want before applying it to large numbers of files.
    Most builds of Windows will execute *.vbs scripts when you double-click them. If that doesn't happen then you might need to visit the Add/Remove Programs or Programs & Features control panel to enable the Windows Scripting Host. I can track down details if you have issues.
    Backing up and restoring data is an area that is often glossed over. Most people don't try to learn much about it until they've lost something important. (Me too )
    If your iTunes library was in the usual layout then normally copying the whole iTunes folder from the User's Music folder in the old computer to the User's Music folder in the new one will usually work fine. Ideally this is done before iTunes is installed so that there is no empty library to replace, and all settings are picked up from the old library. This post contains more details.
    tt2

  • How do you debug your unit tests?

    Hey folks,
    I'm obviously doing something wrong that I can't figure out. I've tried following Chris Hanson's instructions that he put on LJ. No matter what I do, I can't get the debugger to breakpoint in a unit test, no matter whether I put the breakpoint in the test code or the worker code. I can get it to breakpoint just fine in the worker code when I run the real app.
    How do you do this on your unit test code?
    Thanks,
    Pat

    Tried that. No joy so far. That's why I asked here; I hoped that someone here had done it successfully.
    Pat

  • How many devices do you test before releasing your iphone app

    Hi,
    Just want to get an idea about how many devices do you test before releasing your iphone app. I am currently developing on iphone 2.5G. Do I need to test my app on iphone 3G and ipod touch? Are there any difference? My app does not depends on network speed.
    thanks,
    ff

    It's not a bad idea to test on whatever you can but it's not necessarily required. You do have to make sure you're not doing anything that can't be done on all devices. (i.e. access camera in Touch, assume GPS, etc)

  • How do you access application solution folder without hardcoding?

    Working in C# in Visual Community 2013, coding for Desktop only.
    In WinForms and WFP, you can open a stream to write to a file without any directory (Streamwriter ("test.txt")) and the file would get saved in the directory the executable is in, generally the \bin\debug folder under wherever you saved
    your solution.
    Working with Store Apps, how do you mimic that behavior without using hard coded paths or manually navigating to the directory via a FolderPicker or FilePicker?  I can find ways (e.g. KnownFolders) to create an IStorageFile reference to the Pictures
    Library, or the Video Library... or if I really want to drive myself nuts, I can go with ApplicationData.Current.LocalFolder and it's Roaming variant, which point to an \User\Name\AppData\Local\Package\DJHAH-JHFDS-FDSFS-FDSFD\...\LocalState directory structure around
    10 levels deep... not my preference either.  Oh and I understand you used to be able to use the Documents Library (not that I want to, but it'd be better than any of the other options I've found) but even that isn't easily accessible anymore,
    despite still being found under KnownFolders, if I've understand what I've been reading correctly.
    I can't seem to pass anything like "." or ".\text.txt" to CreateFileAsync(), for the record.  And I've hunted randomly around the .NET classes, but nothing is being helpful.
    Short version:  what namespace.class.property stores a usable IStorageFolder reference to the folder where the currently running executable is located?
    An example bit of code that would open up a write stream to a file wherever the solution executable is, and how to capture the path to a string so it could be later passed to OpenAsync() again, would be fantastic.
    Thanks for any help.

    Thank you kindly, that is indeed very helpful, and yes, it confirms what I'd read earlier that as an indie developer I can't use the Documents folder.  I do have a bit of a follow up question, though... probably no one will see it as I've marked this
    question as answered, so I may start a new thread for it if I don't see a reply in a few days.
    I get the Sandbox concept, it just seems overrestrictive here.  A simple example is, I make a game which generates save game files.  As anyone who's played Steam games can tell you, one can generally uninstall the game *without* blowing away
    your saved games.  I'm not sure how one could employ this concept as an indie game developer however, without using something completely unintuitive like saving save game files to the Video, Pictures or Music libraries, or without forcing the user to
    use FolderPickers or FilePickers every save.   If I use the Local data folder, per your source "The folder will be completely erased if the app is uninstalled." Is there any workaround for this situation? What's the conventional method
    most people use? FolderPickers and FilePickers every save?  Save games in Video?
    Yes, this can be done.  There are 2 options you have.
    Options:
    (1) First time your user runs your game, you can ask the user to choose a folder to store the saved games, data, and whatever else.  Then you would save this location that the user chooses in the futureaccesslist.
    (2) Save the data in the roaming folder of the app.  The data in this folder gets synced to the cloud and stays there for future use.  So, even if the user uninstalls the game and then later reinstalls the game, the data from this folder would
    still be there because it was saved in the cloud.
    I highly recommend you use option 1.  I can think of several situations where option 2 would pose a problem. 
    Regarding the windows sandbox, trust me I was annoyed by the limitations at first, too.  But once you get used to it, it's actually quite nice.  There are always ways to get around certain limitations.  You just need to spend time looking
    for them.  For example, one of my apps is a word processor.  My users really wanted the ability to export their documents to pdf.  This was easy to do in wpf and there were plenty of libraries for it.  But in metro, certain limitations
    made the old methods impossible.  It took me 3 months to finally get it working.  Once it worked, the sky is the limit. 
    The limitations are there for everyone's benefits whether they know it or not.

  • Custom KM UI Command -- ClassNotFoundException. How to structure project?

    Hi,
    I'm tired of trying around, so I'm coming here, in hopes that someone can help me (I'm sure there is) :). I'm trying to create two commands (Archive and Push to topnews). The first command will put a resource to a predefined location, whils the second will take an existing document from one folder and replace it with the currently selected resource. The code for doing this is ok, but I cannot display the commands on the context menu!
    I've created a separate layout set with a custom ResourceRenderer with a custom resource command group where my commands are defined in addition to several other, standard ones. The commands have been defined as:
    <package>.<classname> for both "Java class" and "Bundle file" attributes of the UICommand in addition to the properties file with my label and tooltip.
    I'm getting a ClassDefNotFound error no matter what I do. Even if I put it in the src.api or src.core folder I get this error in the trace. I was wondering if anyone could tell me how to structure the PAR file as I think I maybe missing something here...
    In advance, thanks
    Hans Petter

    Hi Hans,
       In order to isolate this problem, you can use this example: "Implementing Flexible UI One-Step-Screenflow".
    from:
    Guide to examples:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/kmc/Knowledge%20Management%20and%20Collaboration%20Developers%20Guide.html
    You can download this project, deploy and test this command. I have created commands using this example.
    Patricio.

Maybe you are looking for

  • 'Itunes has stopped working' keeps popping up whenever connected to itunes store

    So whenever I try to connect to the iTunes store, or if ITunes is trying to automatically update from the store, 'iTunes has stopped working' pops up.  Tried EVERYTHING suggested in the community forums, from adding/moving dll files, reloading iTunes

  • How do I define a set of files as Trusted?

    I'm using InDesign CS5 to create an interactive pdf containing hundreds of hyperlinks to htm files. When its done, both the pdf and the linked files will be supplied on a CD. With CS3, I had to create the pdf in InDesign and then add the hyperlinks u

  • Line Time Series Chart not working

    Hi All, I have one Line Time Series chart where on the X Axis i have taken one date and on Y axis one Sales Figure.Now on the Measure Lables i have taken on dimension as Customer. So the chart will give me something like trend which customer has how

  • Media list required for PI 7.1 including EHP1 for AIX, DB2.

    I am in the process of downloading software for PI7.1 including EHP1. But I identified below two links in service market place. Which is one is the correct link for getting combined pack of PI 7.1 including EHP1 for fresh installation? https://websmp

  • Old mouse broke, How do I pair a new magic mouse?

    The magic mouse that came with the desktop broke, so I bought a new 1, but now I have now idea how to pair it with the computer. I checked the page that explains how to do it but I got no other mouse to click here and there like it says, so what do I