Junit test with debugging

Hi All,
I have my project souce with adding System.out.println statement and bundle it into jar file.
When i running junit test . I cant see project source's println statement.
Any properties file need to be modify to see println statement?
Thanks,
Nil

How are you running JUnit? Logging to System.out will appear on the standard output stream, which is the console unless you explicitly redirect it.

Similar Messages

  • Unit test with JUnit

    Hi all,
    I use Eclipse IDE: Eclipse Java EE IDE for Web Developers. Version: Indigo Release
    I use JUnit 4. For project properties> Java Build Path> Libraries: I have JUnit4 added. Also under the same tab: Maven Dependencies> I have junit-4.8.2.jar
    In pom.xml I have:
    <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.8.2</version>
          <scope>test</scope>
        </dependency>Basically, I’m writing unit tests using JUnit in the past few months! All I needed to do was to create a test class, add a test method like below:
    @Test
    public void testMethod(){
              // Some test code
    }Right click on method, Run As> JUnit Test
    That’s all I needed to do to either run my unit test or do Debug As> Junit Test to debug my unit test.
    All was fine with the world! Starting yesterday, when I add a new test method in a test class, and then do: Right click on method, Run As> JUnit Test
    Nothing happens! I cannot run or debug any test anymore! Meaning I cannot add any new unit test!
    Let me also add that after I add my test method, I do a clean build thru Eclipse and Eclipse sees the newly complied class which contains my new test method.
    Since none of my configurations changed, I have no idea what went wrong!
    Does anybody has any idea? Any help would be greatly appreciated.

    aksarben wrote:
    Yes, I have an idea: Post your code. I for one am not going to my waste my time speculating and guessing.Could also just be IDE crud. I've had similar problems with older versions of Eclipse. Never with current ones though.
    OP: eclipse creates run/debug configurations for each class. If you search around a little you should find the dialog, I don't know the exact name. I think you can reach it from the "run as" menu options. You should try clearing the settings of your test suite to see if that changes anything.

  • Cannot get to debugger when Debug As - Junit Test in OEPE

    In Oracle Enterprise Pack for Eclipse, I created a JUnit (3 or 4) test case. When I attempted to Debug As -> Junit Test, I would get NullPointerException and cannot get to the debugger at all. However, there is no such problem in Ganymede (not OEPE). Is this a known problem for OEPE?
    The stack trace is:
    junit.framework.AssertionFailedError: Exception in constructor: testMapCustomer (org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException))
         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
         at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
         at org.springframework.test.ConditionalTestCase.<init>(ConditionalTestCase.java:50)
         at org.springframework.test.AbstractSpringContextTests.<init>(AbstractSpringContextTests.java:73)
         at org.springframework.test.AbstractSingleSpringContextTests.<init>(AbstractSingleSpringContextTests.java:80)
         at org.springframework.test.AbstractDependencyInjectionSpringContextTests.<init>(AbstractDependencyInjectionSpringContextTests.java:98)
         at com.cibc.wmfxr.pricing.processor.test.Junit38SybaseDaoTest.<init>(Junit38SybaseDaoTest.java:6)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         at junit.framework.TestSuite.createTest(TestSuite.java:54)
         at junit.framework.TestSuite.addTestMethod(TestSuite.java:280)
         at junit.framework.TestSuite.<init>(TestSuite.java:140)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException)
         at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
         ... 21 more
    Caused by: java.lang.NullPointerException
         at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374)
         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
         at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
         at org.springframework.test.ConditionalTestCase.<init>(ConditionalTestCase.java:50)
         at org.springframework.test.AbstractSpringContextTests.<init>(AbstractSpringContextTests.java:74)
         at org.springframework.test.AbstractSingleSpringContextTests.<init>(AbstractSingleSpringContextTests.java:80)
         at org.springframework.test.AbstractDependencyInjectionSpringContextTests.<init>(AbstractDependencyInjectionSpringContextTests.java:98)
         at com.cibc.wmfxr.pricing.processor.test.Junit38SybaseDaoTest.<init>(Junit38SybaseDaoTest.java:6)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         at junit.framework.TestSuite.createTest(TestSuite.java:54)
         at junit.framework.TestSuite.addTestMethod(TestSuite.java:280)
         at junit.framework.TestSuite.<init>(TestSuite.java:140)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.getTest(JUnit3TestLoader.java:102)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestLoader.loadTests(JUnit3TestLoader.java:59)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:674)
         ... 2 more
         at junit.framework.Assert.fail(Assert.java:47)
         at junit.framework.TestSuite$1.runTest(TestSuite.java:90)
         at junit.framework.TestCase.runBare(TestCase.java:130)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:120)
         at junit.framework.TestSuite.runTest(TestSuite.java:230)
         at junit.framework.TestSuite.run(TestSuite.java:225)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

    Thanks. I tried it with the downloaded junit-4.6.jar and got the following stack trace. Now I wonder I should try it with the Junit bundle in the SpringSource Enterprise Bundle Repository since OEPE integrates the Spring OSGi Bundle. If this is the right idea, could you let me know how to install the Junit bundle in OEPE? Do I just add it to bundles.info? There are already a few lines for org.junit in bundles.info. What should I do with them? Thanks a lot.
    java.lang.ExceptionInInitializerError
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
         at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
         at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
         at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
         at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
         at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:28)
         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:24)
         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:40)
         at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:30)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException) (Caused by org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException))
         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
         at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
         at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
         at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.<clinit>(SpringJUnit4ClassRunner.java:63)
         ... 18 more
    Caused by: org.apache.commons.logging.LogConfigurationException: java.lang.NullPointerException (Caused by java.lang.NullPointerException)
         at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:397)
         at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
         ... 22 more
    Caused by: java.lang.NullPointerException
         at org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFactoryImpl.java:374)
         ... 23 more

  • 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.

  • Unable to run ADFBC JUNIT Test Classes with JDEV11G 11.1.1.6

    Dear All,
    I upgraded my project to the latest release JDEV 11G 11.1.1.6
    Previously we are on JDEV 11G 11.1.1.5
    I have a JUNIT class that I am running which test my ADFBC components.
    public class MyTestClass {
      @Test
      public void testVOAccess()
        //assertions
    }Unfortunately, I am hitting an error like this from the messages.
    Mar 9, 2012 1:28:07 PM oracle.adf.share.ADFContext getCurrent
    WARNING: Automatically initializing a DefaultContext for getCurrent.
    Caller should ensure that a DefaultContext is proper for this use.
    Memory leaks and/or unexpected behaviour may occur if the automatic initialization is performed improperly.
    This message may be avoided by performing initADFContext before using getCurrent().
    For more information please enable logging for oracle.adf.share.ADFContext at FINEST level.
    Mar 9, 2012 1:28:08 PM oracle.security.jps.internal.config.xml.XmlConfigurationFactory initDefaultConfiguration
    SEVERE: org.xml.sax.SAXParseException: Invalid encoding name "Cp1252".
    Mar 9, 2012 1:28:10 PM oracle.mds
    NOTIFICATION: PManager instance is created without multitenancy support as JVM flag "oracle.multitenant.enabled" is not set to enable multitenancy support.
    Mar 9, 2012 1:28:12 PM oracle.security.jps.internal.config.xml.XmlConfigurationFactory initDefaultConfiguration
    SEVERE: org.xml.sax.SAXParseException: Invalid encoding name "Cp1252".
    Mar 9, 2012 1:28:12 PM oracle.adf.share.jndi.ReferenceStoreHelper getReferencesMapEx
    WARNING: Incomplete connection reference object for connection:MYDATASOURCEAt the JUNIT Test Runner, I see this.
    java.lang.ExceptionInInitializerError: null
         java.lang.reflect.Constructor.newInstance(Constructor.java:513)
         org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:171)
         org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:216)
    Caused by: oracle.jbo.DMLException: JBO-26061: Error while opening JDBC connection.
         oracle.jbo.server.ConnectionPool.createConnection(ConnectionPool.java:207)
         oracle.jbo.server.ConnectionPool.instantiateResource(ConnectionPool.java:166)To validate the issue, I tried to run my same project using the older release which is JDEV 11G 11.1.1.5
    and I see that I am not hitting any error. All my test classes runs fine.
    Has anybody replicated this?
    Thanks

    Didier Laurent wrote:
    I logged the following bug for this issue:
    bug 14030895 - REGR: JDEVELOPER 11.1.1.6.0 JUNIT JBO-26061 ERROR WHILE OPENING JDBC CONNECTION
    Regards,
    Didier.So its really a bug..
    I abandon this already since I cannot find any solution to look up for this.
    On the other hand, I am maintaining two jdeveloper version just to get around this problem.
    When testing ADFBC, I used the 11.1.1.5 while for non-junit test I used the 11.1.1.6
    Hopefully this gets fixed on the next release as I am having a hard time swithcing between two JDev version.
    Thanks
    Edited by: Neliel on May 3, 2012 11:42 PM

  • JUNIT test failure-Configuration file bc4j.xcfg not found in the classpath

    Hi All,
    As part of an ESS project,Im having a model project containing a VO(parameters VO).This VO is configured to have Read-only access through SQL query and have only one transient attribute each.For the model projects containing the VO for pre merge checker compliance I had to create JUNIT Test projects containing new AMs for testing the parametersVO. While running the JUNIT tests I got an exception like
    “oracle.jbo.JboException: JBO-29000: Unexpected exception caught: oracle.jbo.ConfigException, msg=JBO-33001: Configuration file /oracle/apps/hcm/goals/core/dataMigration/publicEssModel/test/applicationModule/common/bc4j.xcfg is not found in the classpath.”.—even though this file is contained in both the src/classes folder of the project.
    When i try to run the TestAM I'm getting an exception like 'configuration tester.xcfg not found in the calsspath.
    While debugging this error, we found that we are able to successfully run the JUNIT tests if we make some changes in the adf-config.xml file of the Application. The change required is to comment out the mdsC:adf-mds-config tag in the xml file.
    After doing this change Im also able to run my AM without any exception.
    Is this a known issue?.
    Since modifying the adf-config.xml is not a recommended practice is there any workaround that we can get rid of this exception.
    Regards,
    Ajin.

    Just checked but could only find this thread Unable to run ADFBC JUNIT Test Classes with JDEV11G 11.1.1.6
    As it's also dealing with junit and 11.1.1.6.0 you might want to read it.
    Timo

  • Exception while running a test file as JUNIT test case

    Hi,
    I am trying to build a code using Eclipse to generate an "ear" file that can be used for deployment. The ear file is generated successfully but the build is not successful as the following exception is thrown while debugging a junit test case:
    javax.naming.CommunicationException: tdk.dk:389 [Root exception is java.net.SocketTimeoutException: connect timed out]
         at com.sun.jndi.ldap.Connection.<init>(Connection.java:197)
         at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:118)
         at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1580)
         at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2616)
         at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:287)
         at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:175)
         at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:193)
         at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:136)
         at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:66)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:597)
         at junit.framework.TestCase.runTest(TestCase.java:154)
         at junit.framework.TestCase.runBare(TestCase.java:127)
         at junit.framework.TestResult$1.protect(TestResult.java:106)
         at junit.framework.TestResult.runProtected(TestResult.java:124)
         at junit.framework.TestResult.run(TestResult.java:109)
         at junit.framework.TestCase.run(TestCase.java:118)
         at junit.framework.TestSuite.runTest(TestSuite.java:208)
         at junit.framework.TestSuite.run(TestSuite.java:203)
         at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
         at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
         at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    Kindly suggest a solution.
    P.S. : All test cases are running fine except for one test case, whose error details are given.

    No it is not. The Oracle JDeveloper and ADF forum is for development questions around development with Oracle JDeveloper and ADF.
    If you use Eclipse through OEPE, you could post the question here
    Enterprise Pack for Eclipse
    If you don't use OEPE but Eclipse, then this forum may be a great source of help: http://stackoverflow.com/
    Frank

  • Unit tests with ant (FB4 beta)?

    Since flexunit is integrated with FB4, I was wondering how to run unit tests with ant on FB4 (using 3.4 sdk). In my current ant build file, the <mxmlc> and <compc> tags both work but the tag <flexunit> does not seem to work anymore (it worked on FB3 with flexunit download). So is there anyway currently to run unit tests on FB4 using ant?

    Hi,
    Let us take your requirements as separate two requriements.
    1. Using the flexunit ant task - I think for this you needed a separate ant library to support this. So this may be missing in the ant available with FB. May be you can analyse this and add on your own and try out.
    2. Debuggin the results.
    Now FlexBuilder has the feature inbuilt as part of the IDE which provides more featuers like , source naviagation, rerunnig , saving results loading results etc.FlexBuilder uses its own set up to show the results details in IDE.
    Currently other than using the feature in FB, there is no way to debug the results of the tests. However if you would like to get the tests to be run by ant task, and analyse the results, the following can be used.
    Option 1 : Run outside FB, show and analyse results in FB
    a. Use the FB, create some sample testCases in FB.
    b. Use 'Execute FlexUnit tests' from the run,  or debug launcher
    c. Use the option Save configuration. This will get the configuration as xml or mxml file. You can use this file template and generate your test cases (may be you will configure your tests in a testSuite class and always use that as the input to the application, so that application syntax never changes). If you run the mxml created swf  (whch you can do by the simple ant tasks which does not use the flexunit task ) out side FlexBuilder and if the FlexBuilder is open, you can still see the results in the FB and analyse the results. (You need the library which is used by the FB to use the classes. You can get the location of swc file by inspecting the library path of a project in which you have added the testCase or testSuite class using the FB IDE)
    Option2:Run outside FB and  Analyse the results in FB.
    If you have the project for which you have run the tests, and you have the XML results of the run, you can still analyse the results in the FlexBuilder.
    a. Ensure that the report is in the required syntax of FB. (we have tried to use the similar syntax as that of the JUnit resutl report)
    b. Use FB, load your project, open the FlexUnit result view, use the open result option in the FB. This should load the XML in FB (we have only ensured to open the result files which were created using FB ,back in the result view. So if you are facing some issue in opening your XML, you can refer the required syntax by saving a sample run result from FB)
    Option 3: Run and analyse the results in FB.
    a. Have the input setup mentioned to FB. (If you would like to integrate changes, have a suite class which will take care of this and mention in the Execute FlexUnit tests to use this suite class. But there is no way to specify to run the FB commands outside FB.)
    b. So whenever you would like to anlyse the tests, you need to run your test in FB and then analyse the results shown in result view.
    Please let me know whether this is what you are looking for.
    Thanks,
    Rani

  • 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.

  • Performance Issues with Debugging even in Display Mode

    Hi not certain if this would sit in Security, ABAP or Basis, but lets start here as it is security related.
    S_DEVELOP with any activity on DEBUG on a production system is a concern, but what are the performance related issues when a super user has to go into debug in display only on a production system because of a really complex issue?
    I've heard in the past of a scenario where system performance was impacted, and we have notes around the allocation of S_DEVELOP display DEBUG access to this point. (I've summarised these below)
    The risk with debug is associated with the length of time that the actual debugging process is being performed.
    u2022     Work processes are dedicated solely to the users for the duration of the debug. If these are being performed for a long time, these can cause issues with not enough work processes being available.
    u2022     It can cause DB2 locks. If the debug session last awhile, DB2 locks are not released. This impacts the availability of tablespaces, thus, affecting various transactions running across the system.
    Even with these concerns, security will often get asked for debug display access.
    As security is about risk identification, assessment and then controlled access what do other organisations do?
    Options (not exhaustive) are "No Debug ever" or "Debug display only via a fire fight or super user on a time limited basis".
    We are currently in the "debug display only via fire fight" camp, but would like to canvas opinion on this.
    As one of the concepts of security is Availability of data (and to an extent ensuring the systems are up and running) do the performance risks push the security function to the "No Debug Ever" stance.

    If you need to debug in production, then 9 times out of 10 you need to do root-cause analysis: The developer is the problem.
    Writing sloppy code and not testing properly should not be an excuse for debugging in production.
    But of course, there are exceptions even when you do try to keep them to a minimum.
    To add to Jurjen's comments, also note that the debugger only has a limited capability of doing a rollback. So you can quite easily and unintentionally create inconsistencies in the system - also in display mode - which is an integrity problem, and typically more critical than availability problems or even potential confidentiality concerns.
    Cheers,
    Julius
    Edited by: Julius Bussche on May 15, 2009 10:50 AM

  • Re: junit test for entity beans ... ejb 3.0

    I'm confused. I'm trying to test my entity bean.
    I have:
    - an entity bean
    - a stateless session bean for accessing the entity bean (facade)
    - an interface for accessing the the stateless bean
    And I'm trying to write a JUnit test class to test this bean. However, I am uncertain as to how to test this (I'm new to EJB 3.0, JBoss and Eclipse).
    What would the JUnit test look like? I'm confused as to whether or not I should be injecting the interface/bean/what???
    I've tried several variations. I either get "NameNotFound" - not bound exceptions or Null pointer exceptions.
    What would the @EJB syntax look like or how would I do it through the context?
    For Example:
    @EJB private TestFacade myTest; //interface to stateless bean ?
    OR
    InitialContext ctx = new InitialContext();
    TestResultFacadeBean myTest = (TestResultFacadeBean) ctx.lookup("localTest");
    I'm confused at to which method I should be using and what object I should be accessing. If I could get either one to work, I'd be happy. :)
    How do I ensure my bean is deployed to the container? What do I need to do?
    If anyone has a simple example or explanation as to which method I should use and how to use it, I'd be very grateful.
    Thanks very much,
    LisaD

    OK, you need to have several layers of testing.
    Layer 0. Test the entity beans are deployable (more on this later). Basically, you need to know that all your annotations work. Things to watch out for are multiple @Id fields in one class or @EmbeddedID or @IdClass in conjuction with @ManyToOne, @ManyToMany, @OneToMany, @OneToOne and fun with @JoinTable, @JoinColumn and @JoinColumns. Once you know how these are supposed to work with the spec, it's not too bad to write it correctly each time. But there are some gotchas that will break things later on.
    Layer 1. Do the functions in the classes that don't depend on annotations work as expected. Typically, this is just going to be the getters and setters in your entity classes. Of course JUnit best practice says we don't bother testing functions that look like:
    public T getX() {
    return this.x;
    or
    public void setX(T x) {
    this.x = x;
    as there is nothing that can go wrong with them. So in that case, your level 1 tests will just be initial values specified from constructors and verifying that the non-get/set pairs work, and that the getters you have tagged @Transient work (because you've likely put some logic in them)
    Layer 2. Test the session bean methods that don't require injection to work.
    Layer 3. Test the session bean methods that require injection (Mock Objects). Simulate the injection for yourself, injecting Mock Objects for the entity manager. Then you can confirm that the correct methods are being called in the correct sequences, etc.
    [Note this may require some skill in designing the mock.  I'm working on developing my own entitymanager mock, and if it looks usefull I'll release it to the world.
    Layer 4. Test the session bean methods that require injection (Real entity manager) (See Layer 0)
    For this you will need an out of container persistence implementation.  Currently Hibernate and Glassfish provide beta versions.  You will need a different persistence.xml file that lists all the entities.  You will have to use reflection to inject the entity manager(s) that you create from an entity manager factory unless you provide a constructor that takes an EntityManager as a parameter.  You may need to use reflection to call any @PostConstruct method if you made it private.
    Layer 5. Navigate the relationships in the objects returned from Layer 4 using a database that has been loaded with test data.
    I am currently using Layers 0, 1, 2 & 4 to test my session beans and entity beans.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Exceptions trying to run Junit test thro Jdev. Test uses Application module

    Hi,
    my junit test works through the OraTst frame work. But I want to debug the code and If I try to run the same test through Jdev I am running into a following exception. Can somebody tell me how to fix this issue.
    I am a consumer of the Application module, I have not created it. I am using it by referencing it through the jar file provided by the owner.
    oracle.jbo.DMLException: JBO-27200: JNDI failure. Unable to lookup Data Source at context jdbc/EMReposDS
    at oracle.jbo.server.DBTransactionImpl.lookupDataSource(DBTransactionImpl.java:1414)
    at oracle.jbo.server.DBTransactionImpl2.connectToDataSource(DBTransactionImpl2.java:309)
    at oracle.jbo.common.ampool.DefaultConnectionStrategy.connect(DefaultConnectionStrategy.java:203)
    at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolConnect(ApplicationPoolMessageHandler.java:553)
    at oracle.jbo.server.ApplicationPoolMessageHandler.doPoolMessage(ApplicationPoolMessageHandler.java:409)
    at oracle.jbo.server.ApplicationModuleImpl.doPoolMessage(ApplicationModuleImpl.java:8534)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.sendPoolMessage(ApplicationPoolImpl.java:4392)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareApplicationModule(ApplicationPoolImpl.java:2388)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.prepareResource(ApplicationPoolImpl.java:3621)
    at oracle.jbo.pool.ResourcePool.useResource(ResourcePool.java:344)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.doCheckout(ApplicationPoolImpl.java:2200)
    at oracle.jbo.common.ampool.ApplicationPoolImpl.useApplicationModule(ApplicationPoolImpl.java:3088)
    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:460)
    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:431)
    at oracle.jbo.common.ampool.SessionCookieImpl.useApplicationModule(SessionCookieImpl.java:426)
    at oracle.jbo.client.Configuration.getApplicationModule(Configuration.java:1494)
    at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1399)
    at oracle.jbo.client.Configuration.createRootApplicationModule(Configuration.java:1370)
    -Sidd

    Sidd,
    No idea what OraTst is, but based upon the name of your data source, I'd guess you are an Oracle employee using an internal framework. I understand that there are some internal Oracle forums that you can use.
    John

  • 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.

  • Trying, failing to build qt5 with debugging symbols

    As per this article, I modified my PKGBUILD like so (-developer-build):
    build() {
    cd ${_pkgfqn}
    export QTDIR="${srcdir}"/${_pkgfqn}
    export LD_LIBRARY_PATH="${QTDIR}"/qtbase/lib:"${QTDIR}"/qttools/lib:"${LD_LIBRARY_PATH}"
    export QT_PLUGIN_PATH="${QTDIR}"/qtbase/plugins
    export PATH="${srcdir}/python2-path:$PATH"
    [[ "${CARCH}" = "i686" ]] && SSE2="-no-sse2"
    PYTHON=/usr/bin/python2 ./configure -confirm-license -opensource -developer-build \
    Don't know if I put the option in the wrong place, though, or if that information is outdated for qt5 - but it's not building for me. Here's where makepkg stops:
    ln -s libQt5Widgets.so.5.4.0 libQt5Widgets.so
    ln -s libQt5Widgets.so.5.4.0 libQt5Widgets.so.5
    ln -s libQt5Widgets.so.5.4.0 libQt5Widgets.so.5.4
    rm -f ../../lib/libQt5Widgets.so.5.4.0
    mv -f libQt5Widgets.so.5.4.0 ../../lib/
    rm -f ../../lib/libQt5Widgets.so
    rm -f ../../lib/libQt5Widgets.so.5
    rm -f ../../lib/libQt5Widgets.so.5.4
    mv -f libQt5Widgets.so ../../lib/
    mv -f libQt5Widgets.so.5 ../../lib/
    mv -f libQt5Widgets.so.5.4 ../../lib/
    make[3]: Leaving directory '/home/chris/Software/qt5/src/qt-everywhere-opensource-src-5.4.0/qtbase/src/widgets'
    make[2]: Leaving directory '/home/chris/Software/qt5/src/qt-everywhere-opensource-src-5.4.0/qtbase/src'
    Makefile:45: recipe for target 'sub-src-make_first' failed
    make[1]: *** [sub-src-make_first] Error 2
    make[1]: Leaving directory '/home/chris/Software/qt5/src/qt-everywhere-opensource-src-5.4.0/qtbase'
    Makefile:70: recipe for target 'module-qtbase-make_first' failed
    make: *** [module-qtbase-make_first] Error 2
    ==> ERROR: A failure occurred in build().
    Aborting...
    Not sure what happened. How do I get more information?
    I need qt5-base with debugging symbols so I can get helpful traces for plasma-desktop crashes. So I should also ask: is it possible to modify the PKGBUILD to just compile qt5-base (and perhaps qt5-webkit and qt5-webengine)? qt5 is huge...
    EDIT: and yes I had qtwebkit uninstalled at the time
    Last edited by YAOMTC (2015-01-03 06:12:49)

    I hate it when the only result for a problem is an unanswered question...
    Anyway, invoking make manually uncovers what is the problem - there's a bunch of errors similar to this:
    ../gui/text/qfontengine_ft.cpp:1146:39: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
    for (int x = 0; x < slot->bitmap.width; x++) {
    ^
    cc1plus: all warnings being treated as errors
    So the -Werror is the culprit. Looking at the ./configure -help output it turns out that the -developer-build enables -Werror. But there's -no-warnings-are-errors. So yeah, passing -no-warnings-are-errors in addition to -developer-build should fix the compilation.
    I have updated the wiki accordingly.
    EDIT: the compilation gets a bit further, but it now fails because of tests.
    EDIT2: it pays off to read configure rather than rely on some random suggestion from the wiki. There's a "-debug" option, which should just enable debugging. It hasn't finished compiling here yet, but it got a lot further than before.
    Last edited by 6xx (2015-02-03 21:13:49)

  • Persist does not throw any exception in a JUnit test

    I am implementing a JUnit test using Toplink as JPA provider. I must be missing something because I try to persist two times the same entity and no exception is thrown. Neither PersistenceException nor any other type of exception. The code cannot be easier:
    @Test
    public void testAddExistingTeam() throws Exception {
    Team team = new Team("team2");
    try{     
    EntityManagerFactory emf =
    Persistence.createEntityManagerFactory("fofo");
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();
    em.persist(team);
    em.persist(team);
    em.getTransaction().commit();
    em.close();
    catch(Exception e){
    e.printStackTrace();
    Notice the two em.persist(team).
    This code does not seem to either enter the catch block or produce any sort of exception. On the other hand, I have checked that after the first
    em.persist(team); the team is really managed.
    The relevant parts of the Team class definition follow:
    @Entity
    @Table (name ="TEAM")
    public class Team implements Serializable {
    @Id
    @Column (name="NAME")
    private String name;
    @ManyToOne
    @JoinColumn (name="CLUB_NAME", referencedColumnName="NAME")
    private Club club;
    private Category category;
    private String email;
    @ManyToMany(mappedBy="teams")
    private List<Competition> competitions;
    public Team (String name){
    this.name = name;
    this.club = null;
    this.competitions = new ArrayList<Competition>();
    ....getters/setters....and more constructors.
    I am really puzzled by this issue. Somebody could help??? I would be really grateful!!!
    Josepma

    This is expected behavior as persist is a no-op if called on a managed entity (other than to cascade over relationships marked with cascade.Persist), and the first persist call makes the passed in team entity managed.
    Try calling em.flush(); and em.clear(); between the persist calls to get an exception.
    The first flush will ensure the team is inserted in the database, while clear will detach it so that the second persist call will try to insert the team. JPA providers are not required to throw the entityExistsException on persist - it can be delayed until the transaction is flushed or committed, so you are likely to get a PersistenceException from the commit instead of EntityExistsException from persist.
    Best Regards,
    Chris

Maybe you are looking for

  • Can you have an email account from a personal domain on mobile me?

    I want to be able to answer emails that come in from my personal domain website (www.writenow-communications.ca) with an email address [email protected] (I want mobile me email to reply from that name.) Is this possible, and if it is, how do I do it?

  • Transfer to External Hard drive gone wrong. Help!!!

    I improperly transferred my Itunes, with all my music, to my external hard drive. Not knowing that I had to consolidate my library before hand, I just moved the Itunes application and my Music folder (which contained all of my current music plus a pa

  • My settings and my icloud don't match.

    I have a 4s and the settings says that I have 2.2 GB of pictures but when I got into my Icloud it says that I have 4.7 GB of pictures. How can I fix that? I would love to be able to back up my iphone again without having to buy more storage.

  • Private Browsing keeps turning itself off

    Is Private Browsing supposed to only be temporary? Every time I restart Safari 6, Private Browsing turns it self back off again. I wouldnt even care really if it didnt broadcast my current browsing activites to my family-used iPad! Talk about securit

  • Where can I find a place for complains (Apple Support is helpless/hopeless)?

    I have quite a lot problems with Apple hardware and software. After spending several hours to find solutions on the Apple site and also from external sources, my effort gave 0 results. Can anybody tell to the Apple folks, sitting on the Olympus, that