CAF 7.1 and JUnit

Hello Kollegues,
I am searching fort an ability to run JUnit tests with the CAF 7.1 projects. I use RFC external services and would like to cover the compositions of them with automatic unit tests which should run locally (not on server). Unfortunately SAP does not provide any documentation about that. All you can find about JUnit enablement is very old and not really applicable for that case. What is really needed is an ability to mock the calls for getting JCo clients.
I canu2019t imagine that CAF services cannot be tested automatically!
I appreciate your hints!
Dimitri

Hi Dimitri,
Unfortunately, not only the JCo clients need to be mocked. All mappings between the RFC function and the Application Service method are described in the model and are executed at runtime.
At the moment the easiest way to automatically test external services composition is to write JUnit tests that call the corresponding CAF services at runtime.
One more idea is to override the Application Service method that calls the external service and mock the call and the mappings. You can do this in the "*Impl" file for the service.
Please let me know if you need more information for some of the solutions above.
Bets Regards,
Tsvetan

Similar Messages

  • Netbeans and junit

    Hi,
    I am sorry if this is the wrong place to post this but I need a quick answer.
    I have developed a school project in netbeans and junit.
    How can I execute the junit tests externaly to the IDE?
    Where is the junit installed?
    thanks,
    Sebastian

    JUnit is just a java library. Take a look at
    http://www.junit.org/index.htm

  • ANT and JUnit in weblogic

    Hi.
    I see that the problem with ant and junit is discussed here, but with no absolutte solution.
    The problem:
    I create an build.xml containing the <junit>-task and want to run this from within the BEA Workshop. The standard error-message is that it cant find the junit-task. I can run the same build file from command since I got ANT set up correctly with JUnit outside Weblogic.
    It sems for me that Workshop dont care about existing installation of ANT, it uses it own version. I have included junit.jar in the same direstory as ant.jar is in BEA-install-dir also, but it wont work.
    Does anyone have a solution to this "small" problem??
    Thanks in advance.

    I haven't figured out why, but my JDeveloper automatically adds the classpath I have in my ant build.xml to the additional classpath of the project. My classpath is set like this in the build.xml:<path id="classpath">
    <fileset dir="env/lib">
          <include name="**/*.jar"/>
        </fileset>
    </path>And my compile target looks like this:<target name="compile" depends="init">
        <mkdir dir="${compile.outdir}"/>
        <!--Compile Java source files-->
        <javac destdir="${compile.outdir}" debug="on">
           <classpath refid="classpath"/>
           <src refid="srcpath"/>
        </javac>
      </target>And my Jdev project settings -> common -> ant has my build.xml file selected with default make and rebuild targets selected. I have never put a single entry in the additional classpath area but somehow I have all the libs as I set up in my build.xml file. I'm using JDev 9.0.3.2 by the way.

  • Ant 1.6.5 and JUnit 4.1

    According to ant bugs Bug-40682 and Bug-40697, Ant 1.6.5 and JUnit 4.1 have integration problems. Is there a plan for Jdeveloper 11g to upgrade to Ant 1.7?

    We are currently testing up take of Ant 1.7 for JDeveloper 11.
    --RiC                                                                                                                                                                                           

  • Error with ant build and JUnit task in IntelliJ

    Hi,
    I seem to be having a very annoying error in IntelliJ. Here are the stats:
    - IntelliJ 4.5.1, Build 2239
    - Using own version of ant (1.5.1)
    - removed junit37.jar from my ant1.5.1/lib dir, and instead added junit version 3.8.1 of junit.jar to that dir
    - Specified that same junit.jar in my project classpath (this is the only item in the classpath for my test project)
    - MyTest.java is the only class in my project, and it is specified as a JUnitTest in run/debug configurations and includes the classpath and jdk of my project module
    When I right-click on my test class, and go to "Run" then my simple test passes. I see the results in the run window.
    Here is where the issue lies (and why this is confusing me). When I try to run the same test from my build.xml file in this project, specified with the classpath as the same from my project, and with the following junit task, I get the below error (3 times in a row for whatever reason). If any of you know of a configuration issue that I may be missing, please let me know. It is very frustrating! Thanks a lot, in advance.
    <target name="run.test">
            <javac classpath="class.path" srcdir="src" destdir="src" />
            <junit haltonerror="true" printsummary="yes" haltonfailure="true" showoutput="true">
                <classpath refid="class.path" />
                <test name="MyTest" />
            </junit>
        </target>
    Test MyTest failed
         at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:568)
         at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:527)
         at org.apache.tools.ant.Task.perform(Task.java:319)
         at org.apache.tools.ant.Target.execute(Target.java:309)
         at org.apache.tools.ant.Target.performTasks(Target.java:336)
         at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
         at org.apache.tools.ant.Project.executeTargets(Project.java:1250)
         at org.apache.tools.ant.Main.runBuild(Main.java:610)
         at org.apache.tools.ant.Main.start(Main.java:196)
         at org.apache.tools.ant.Main.main(Main.java:235)
         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:324)
         at com.intellij.rt.ant.execution.AntMain2.main(AntMain2.java:13)

    I figured this out - I needed a formatter tag to see the output of the test.

  • Packages, Classpath, Ant, and JUnit (setting up a nice environment)

    Hi,
    I am seeking a little help getting up and running, creating a nice environment where I can build a Java project, including building with Ant and using JUnit - hopefully this is the right forum. I am having some trouble in getting JUnit to run my tests properly (it is installed and findable by my Java install) and I think this is due to a package/classpath issue that is currently outside my experience. Here's my setup to explain:
    I have installed the JUnit jar in my extensions folder, and it works properly (I can call it, don't get errors about JUnit), however, when I run my test I get the error:
    "Could not find class: org.xxx.powersim.ModelTest
    Time: 0
    OK (0 tests)
    Java Result: 1"
    ModelTest has been compiled properly without error, and looks like this:
    package org.xxx.powersim;
    import org.junit.*;
    import static org.junit.Assert.*;
    import java.util.*;
    public final class ModelTest {
         public static void main(String args[]) {
               org.junit.runner.JUnitCore.main("org.xxx.powersim.ModelTest");
         @Test
         public void testJunit() {
              assertTrue(true);
    }Pretty simple stuff.
    As you can see I'm trying to use the 'main' method of the test to execute the test itself... but I've tried running it via the runner from the command line also: "java org.junit.runner.JUnitCore org.xxx.powersim.ModelTest". I get the same result.
    It might be a package issue, so here's how I have things set up in the file system:
    PowerSim
         /build
              /org
                   /xxx
                        /powersim
                             - ModelTest.class
         /src
              /org
                   /xxx
                        /powersim
                             -ModelTest.javaI've tried running it within Ant, by hand using the runner, by hand calling the main method, and from within TextMate's built-in bundle - I get the same result. JUnit is installed and running fine, but it can't seem to see the test class - the more I think about it this is a package problem that I'm just not sure how to fix. I've tried running it by hand in the root /PowerSim directory, in the /build folder, and in the /powersim folder where ModelTest is. I still get the error that "Could not find class: org.xxx.powersim.ModelTest".
    My files compile just fine with my simple Ant script which is as follows:
    <?xml version="1.0"?>
    <project name="PowerSim" default="run" basedir=".">
    <property name="src" value="./src"/>
    <property name="build" value="./build"/>
    <property name="compile.debug"       value="true"/>
    <path id="compile.classpath">
       <pathelement location="${mysql.jdbc}"/>
       <pathelement location="${junit.jar}"/>
    </path>
       <target name="build" depends="init">
           <javac srcdir="${src}"
                  destdir="${build}"
                  debug="${compile.debug}"
                  source="1.5">
              <classpath refid="compile.classpath"/>
           </javac>
       </target>
    <target name="init">
       <mkdir dir="${build}"/>
    </target>
    <target name="run" depends="build">
       <java classname="org.xxx.powersim.Model"
           fork="true"
           dir="${build}"
           classpath="${build}"
           maxmemory="500m">
       </java>
       </target>
         <target name="test" depends="build">
             <java classname="org.xxx.powersim.ModelTest"
                 fork="yes"
                 dir="${build}"
                 classpath="${build}"
                 maxmemory="500m">
             </java>
             </target>
    <target name="clean" description="Removes previous build">
       <delete verbose="true">
         <fileset dir="${build}"/>
       </delete>
    </target>
    </project>As you can see, I'm not sure what to try next - any help would be much appreciated.
    I've tried adding things to my $CLASSPATH. For example I've added the root folder of the project, 'PowerSim' to my classpath, but this appears to have no effect. I am running OS X 10.5.
    Thanks again for any help you may be able to offer, it will be very much appreciated,
    - Peter

    Ok - final bump and then I'll go away.
    (Really - if anyone has any advice that would be great)

  • EJBContainer (glassfish v 3.0 impl) and JUnit, jndi lookup is impossible!!!

    Hello,
    i hope to find a solution, but i think there's something wrong:
    i did my JUnit test case and i instantiate the glassfish v3 EJBContainer in my @BeforeClass method
    running the test, deploy messages are something like this:
    INFO: Portable JNDI names for EJB PhaseHandler : [java:global/ejb-app4338883541443661181/classes/MyEJB!my.package.MyEJB, java:global/ejb-app4338883541443661181/classes/MyEJB]i would like to lookup for the ejb in my @Before methods... but... which jndi name should i use to fetch the EJB if the app name is random?
    i've tried some tries:
    java:global/classes/MyEJB (read from a tutorial)
    java:app/classes/MyEJB (thought it could work but.. no it doesn't)
    java:module/MyEJB (failed :/ )
    any suggestion? any help will be greatly appreciated
    follows my maven dependency configuration
        <repositories>
            <repository>
                <id>maven2-repository.dev.java.net</id>
                <name>Java.net Repository for Maven</name>
                <url>http://download.java.net/maven/glassfish</url>
                <layout>default</layout>
            </repository>
        </repositories>
        <dependencies>
            <dependency>
                <groupId>org.glassfish.extras</groupId>
                <artifactId>glassfish-embedded-all</artifactId>
                <version>3.0</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>javax</groupId>
                <artifactId>javaee-api</artifactId>
                <version>6.0</version>
                <type>jar</type>
                <scope>provided</scope>
            </dependency>
        </dependencies>and this is my test case:
        @BeforeClass
        public static void startContainer() {
            container = EJBContainer.createEJBContainer();
        @AfterClass
        public static void stopContainer() {
            if (container != null) {
                container.close();
         * @throws NamingException
        @Before
        public void setup() throws NamingException {
            myEjb =(MyEJB)container.getContext().lookup(
                    "which jndi should i use?");
        }

    i did my JUnit test case and i instantiate the glassfish v3 EJBContainer in my @BeforeClass methodWhat is "your jUnit test case"?
    You don't have to implement jUnit tests, and if you do, you generally benefit to have more than one.
    Moreover, you shouldn't think it as "doing jUnit test cases", but merely as "doing unit-testing using jUnit"

  • Regular Expression and jUnit in ADF Mobile

    Hi Guys,
    I tried to implement Regular Expression in ADF Mobile, but in my jUnit that I was configured to unit test purpose in my application.
    Shown error below inside jUnit plane.
    java.lang.NoClassDefFoundError: oracle/adfmf/util/regex/Pattern
    How to solve this issue for jUnit ?

    I'll start by answering your Q2 - while in theory you can use the same application for both accessing from a browser on a pc and on a phone - in reality the user experience on the phone is not going to be good because of the limitation of the screen size. Users will need to constantly zoom-in scroll around etc. This is why many people who target application for smart phones prefer to build a separate UI for the mobile device.
    Now question 4 which relates to 1 - We haven't tested the ADF Faces components on the browser of blackberry and so there is a chance that some of their functionality won't work there. We did test and certify the ADF Faces components with the safari mobile browser (iOS) - so this is why you see them work there better.
    This is why we recommend that if you are targeting a blackberry (and other mobile devices) you'll use the Trinidad set of components and in general ADF Mobile Browser project type.
    (see example here: https://blogs.oracle.com/shay/entry/building_iphone_interfaces_for_oracle ). This also means that you'll have the check box checked for mobile device when you create a JSF page.
    For question 3 - when the next ADF Mobile solution will be released you'll be able to create applications that install on the device itself.

  • Problem:JDeveveloper 11g and JUnit Extension against a JDK 5 Project

    We've got a project that requires JDK 5, and would like to run our JUnit tests using the integrated JUnit Extension in Jdeveloper 11g.
    However, we are getting the following error: java.lang.UnsupportedClassVersionError: Bad version number in .class file
    Presumabily, this is because the JUnit classes are JDK 6, since the tests work if we switch our project to use JDK 6.
    Of course, the problem is: Our project requires JDK 5. =)
    Anyone have a workaround?
    Thanks,
    - Bill

    Hi,
    JDeveloper is on JDK 1.5, How can I configure it to be 1.4??
    I had the JDeveloper 10.1.3 also and it went ahead with some updates and now even that shows me that it's version is JDK 1.5
    The latest error I get from JDeveloper(From both 11g and 10.1.3) is here,
    Invoking loadjava on connection 'HR_CapRock_DEV' with arguments:
    -order -resolve -thin
    errors : class package1/mypackage/JavaStoredProc
    ORA-29521: referenced name java/lang/StringBuilder could not be found
    The following operations failed
    class package1/mypackage/JavaStoredProc: resolution
    oracle.aurora.server.tools.loadjava.ToolsException: Failures occurred during processing
         at oracle.aurora.server.tools.loadjava.LoadJava.process(LoadJava.java:863)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:116)
         at oracle.jdeveloper.deploy.tools.OracleLoadjava.deploy(OracleLoadjava.java:46)
         at oracle.jdevimpl.deploy.OracleDeployer.deploy(OracleDeployer.java:97)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:473)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:360)
         at oracle.jdevimpl.deploy.StoredProcHandler.doDeploy(StoredProcHandler.java:284)
         at oracle.jdevimpl.deploy.StoredProcProfileDt$Action$1.run(StoredProcProfileDt.java:383)
    #### Deployment incomplete. #### Jun 18, 2007 10:17:31 AM
    *** Note ***
    One possibility for the deployment failure is that the target Database may not support JDK version 1.5. Updating your Project Properties compiler Source & Target to an earlier release could fix this problem.
    How can I either downgrade JDK on the compiler(JDeveloper) to be 1.4 or, How can I resolve the error,
    ORA-29521: referenced name java/lang/StringBuilder could not be found
    Thanks,
    Sujith

  • JBuilder and Junit help

    Hi,
    I have as part of a group produced a package for a game.
    However I need to test the source code i produced.
    I produced this in a simple java program called goJava but now wish to take this individual java file, import it into JBuilder and then use Junit to test it.
    Unfortunately I have no idea how to get Junit to work in Jbuilder and all the guides I have found online mean nothing to me.
    Can anybody explain a step by step guide allowing me to do this so I can then produce my test code?
    Many thanks

    Unfortunately I have no idea how to get Junit to
    work in Jbuilder and all the guides I have found
    online mean nothing to me.Somewhere, there's a menu like New -> JUnit -> Test Case or something. Follow the wizard and end up with a test case you just have to implement.
    You are aware that you have to write the tests yourself, are you? JUnit is no tool that magically tests your program by just telling it hwre it is.
    Can anybody explain a step by step guide allowing me
    to do this so I can then produce my test code?Maybe. Those somebodies usually reside at JBuilder support boards.

  • Ear and junit

    I have a ear file **
    and want to write junit test cases for some classes in the ear.
    the ear file has the following structure:
    ->ear
    ----> ejb.jar
    ----> utils.jar
    ----> some.jar
    ----> app-inf
    ------------> lib/third.jar
    ----> meta-inf
    ----------->application.xml
    Q1) Do i have to have the ear file running inside the container to test it?
    Q2) I just want to write test case for some standalong classes in utils.jar..but
    when i run juni ant task with classpath=ear , its gives classnot found, alghouth
    the uitls.jar is part of the ear?
    please help.
    thanks

    Hi,
    "java guy" <[email protected]> wrote in message news:[email protected]..
    I have a ear file **
    and want to write junit test cases for some classes in the ear.
    the ear file has the following structure:
    ->ear
    ----> ejb.jar
    ----> utils.jar
    ----> some.jar
    ----> app-inf
    ------------> lib/third.jar
    ----> meta-inf
    ----------->application.xml
    Q1) Do i have to have the ear file running inside the container to test it?Yes if you are going to test classes that require to run within a container.
    Such classes could be EJB and servlets.
    Q2) I just want to write test case for some standalong classes in utils.jar..but
    when i run juni ant task with classpath=ear , its gives classnot found, alghouth
    the uitls.jar is part of the ear?EAR itself is a JAR file. Java classloader does not look for classes
    in jars that are packaged in to a jar.
    To test your utility jar you should place/access it outside of the EAR.
    Regards,
    Slava Imeshev

  • JUnits and JUnit Integration

    I've been trying to run an overly simple test case that I have added to my project with no success.
    I found by searching help that JDeveloper has an extension for helping with JUnit called "JUnit Integration." I don't have this extension installed and when I "Check For Updates" it is not listed. Where can I get this extension since it's not been offered in the updates wizard?
    Also, has anyone been successful in running JUnits within their project, within JDev for 11g? If so I would love some tips and suggestions.
    Up until now our developers are relying on the external build process to run their tests or pulling the code into another IDE.
    Thanks!
    Al

    You should see the extension in the check for update if you are using the latest JDev 11 version (TP3).
    If you still don't see it, download the file from here:
    http://www.oracle.com/technology/products/jdev/101/update/center.xml#oracle.jdeveloper.junit
    Then point the check for update to this local file.

  • Workshop and Junit

    Hi
    Has anyone used JUnit with a web-app developed using Workshop ?? Is there any
    plug-in for the same or is it not possible ?
    If anyone does have any articles which say how to use Junit with workshop that
    would be fine .
    Thanks
    Kar

    Piyush,
    JUnit integration is planned for the next release. Until then you can use cactus,
    httpunit or other open source JUnit projects which you can run them via ant tasks.
    Nikhil
    "kar piyush" <[email protected]> wrote:
    >
    Hi
    Has anyone used JUnit with a web-app developed using Workshop ?? Is there
    any
    plug-in for the same or is it not possible ?
    If anyone does have any articles which say how to use Junit with workshop
    that
    would be fine .
    Thanks
    Kar

  • Implementation Business Objects in CAF and developing WDJ application

    Hi Experts,
    I've read some articles about SAP CE CAF from SDN and I'm making some exercises according those guidence. Right now I have a problem and want to get suggestion from you. 
    As you know, from CE 7.1.1, the CAF support importing the Business Object through EJB model. So when develop a WDJ application using caf, we can using these procedures:
    (Implementing business objects in CAF and developing WebDynpro application)
    1) Create business objects or application service.
    2) Generate EJB Implementation class for business objects or app service.
    3) Create a WebDynpro application
    4) Importing the EJB model using the template.
    5) Create the UI for the app.
    My problem is: In the business object or application serivice, if the operation parameter type is integer, after we generate the EJB class, the type will changed to String. After the WDJ UI is created, the application test failed. The integer field could not passed to the BO successfully.
    If all the parameters type are string in the operation, there's no problem.  But when I use Integer or Date, the EJB class will change the type and the WDJ app will failed.
    I've also test the scenario in CE enviroment including 7.3 also failed. So I'm a little confused which step was wrong. I don't know whether you've seen such problem before, if you could give any suggestion, it'll be very appreciated!

    Hi, Winters.
       I got the same program, try to parse into the type which you want in AS operation.
    BR.
    Louis Huang.

  • Web Service and CAF Application Services - How to return a table

    Hello,
    I'd like to build a CAF Application Service and expose it as a Web Service. This service should return an array or table which I'd like to display in a Visual Composer model.
    I understand that there're limitations at CAF regarding supported data types.
    Does anyone know how to get a workaround?
    Any information is very appreciated.
    Kind regards
    Stefan

    Hi,
    You can return a list.
    The standard way to do this is you have to create a complex data type for response.
    Configure the cardinality of this data type to 1..n so as to accomodate a list.
    In your implementation add your list to this response message and return the list.
    This waly you can return collections.
    Hope it helps.
    Regards,
    Srinivasan Subbiah

Maybe you are looking for