Need to write international Unit Test.

Hello All. I�d like to write a 16-bit charset unit test and view the results in eclipse. Can anyone tell me how to do so?
I�m writing an application that needs to support international characters. The app will someday support Japanese, Hindi, Hebrew, Chinese, etc. No one in the office has written code in these languages.
I�d like to write a JUnit test to ensure that my persistence layer can save �Hello World� in one of these languages and retrieve the exact String. I found a site showing me how to write Hello World in Japanese http://unix.org.ua/orelly/java-ent/servlet/ch12_03.htm, but System.out.println("\u4eca\u65e5\u306f\u4e16\u754c"); displays �?????�. I�d like to be able to preview the unit test from Eclipse and run it from ANT. What do I need to do to accomplish this?
Thanks in advance,
Steven

Hi,
  Steps to be followed for UTP.
UTP : Unit Test Plan. Testing the program by the developer who developed the program is termed as Unit Test Plan.
Two aspects are to be considered in UTP.
1. Black Box Testing
2. White Box Testing.
1. Black Box Testing : The program is executed to view the output.
2. White Box Testing : The code is checked for performance tuning and syntax errors.
Follow below mentioned steps.
<b>Black Box Testing</b>
1. Cover all the test scenarios in the test plan. Test plan is usually prepared at the time of Techincal Spec preparation, by the testing team. Make sure that all the scenarios mentioned in the test plan are coverd in UTP.
2. Execute your code for positive and negative test. Postive tests - to execute the code and check if the program works as per expected. Negative Test - Execute code to know if the code is working in scenarios in which it is not supposed to work. The code should work only in the mentioned scenarios and not in all cases.
<b>White Box Testing.</b>
1. Check the Select statments in your code. Check if any redundant fields are being fetched by the select statements.
2. Check If there is any redundant code in the program.
3. Check whether the code adheres to the Coding standards of your client or your company.
4. Check if all the variables are cleared appropriately.
5. Optimize the code by following the performance tuning procedures.
<b>Using tools provided by SAP</b>
1. Check your program using <b>EXTENDED PROGRAM CHECK</b>.
2. Use SQL Trace to estimate the performace and the response of the each statement in the code. If changes are required, mention the same in UTP.
3. Use Runtime Analyser and Code Inspector to test your code.
4. Paste the screen shots of all the tests in the UTP document. This gives a clear picture of the tests conducted on the program.
All the above steps are to be mentioned in UTP.
Regards,
Vara

Similar Messages

  • How to write utp(unit test plan)

    how to write utp(unit test plan)

    Hi,
      Steps to be followed for UTP.
    UTP : Unit Test Plan. Testing the program by the developer who developed the program is termed as Unit Test Plan.
    Two aspects are to be considered in UTP.
    1. Black Box Testing
    2. White Box Testing.
    1. Black Box Testing : The program is executed to view the output.
    2. White Box Testing : The code is checked for performance tuning and syntax errors.
    Follow below mentioned steps.
    <b>Black Box Testing</b>
    1. Cover all the test scenarios in the test plan. Test plan is usually prepared at the time of Techincal Spec preparation, by the testing team. Make sure that all the scenarios mentioned in the test plan are coverd in UTP.
    2. Execute your code for positive and negative test. Postive tests - to execute the code and check if the program works as per expected. Negative Test - Execute code to know if the code is working in scenarios in which it is not supposed to work. The code should work only in the mentioned scenarios and not in all cases.
    <b>White Box Testing.</b>
    1. Check the Select statments in your code. Check if any redundant fields are being fetched by the select statements.
    2. Check If there is any redundant code in the program.
    3. Check whether the code adheres to the Coding standards of your client or your company.
    4. Check if all the variables are cleared appropriately.
    5. Optimize the code by following the performance tuning procedures.
    <b>Using tools provided by SAP</b>
    1. Check your program using <b>EXTENDED PROGRAM CHECK</b>.
    2. Use SQL Trace to estimate the performace and the response of the each statement in the code. If changes are required, mention the same in UTP.
    3. Use Runtime Analyser and Code Inspector to test your code.
    4. Paste the screen shots of all the tests in the UTP document. This gives a clear picture of the tests conducted on the program.
    All the above steps are to be mentioned in UTP.
    Regards,
    Vara

  • Need Sample Unit Test Plan templates for SD

    Hi Experts,
    I am in need of some SD unit test plan templates used in any of your implementations.
    Pls Help.

    Dear Preethi
    As already expressed, you are asking the confidential document which nobody would like to share.
    However, AS-IS will be prepared by Core team people and your duty is to go through the process in depth.
    May be the AS-IS from SD purview, I can list as an example as how it should be
    The excel sheet of AS-IS header tabs will have to contain the following header tabs
    -  Scenario like Exports, Domestic etc,
    -  Under this scenario, Groups like OE, Aftermarket, Stock Transfer etc.,
    -  Under this Groups, Process like Business Plan, Scheduling, Preshipment activities, Post shipment activities etc.,
    -  Finally this process has to be break down into a detailed list of activities.
    So you have to go through these process in detail.
    As for as testing is concerned, there is no need to check the customer master.
    All you have to do is to carry out all standard T.Codes like order creation, create delivery, PGI, Billing and Excise Invoice.  Again try to cancel all documents from billing to sale order and ensure that you are able to cancel those documents.  Check for the FI implication on the COGS and material cost.
    Also while testing, you can also check whether you are able to create one delivery against multiple sale orders and one invoice against multiple deliveries.  If not successful, analyse the reason for split, maintain the required datas in masters and retry the process.
    thanks
    G. Lakshmipathi

  • TDD: Using Test-Data Containers(eCATT) in Unit-test

    Recently I learned about TDD, and learn how to write unit-test for some class. But When I write a report(with DB, post account doc) , I come across some problem.
    1. I  have some method just select some data form table , but I don't know how to write this unit-test? I know I can create a TDC though eCATT, but my method is select form table ,how do I finish this ?
    2. Also I have some method just handle data, such as check the data or move to another internal table, do I need to write unit-test for this kind method?
    Further more , I search the SCN many times , I didn't find a suitable program as TDD program (include SQL, input , output, data handle ). Is there anyone can share your example in TDD for us , thank you so much.
    Best Regards!

    Glad that you have interest in TDD. I write on ABAP unit at my site zevolving.com 
    TDD should not dependent on the data selection from the DB as the DB data could be changed and your test would fail without you being changing the logic.
    To avoid the dependency on the data, you need to prepare the dummy test data. You need to than also prepare the expected output from the dummy test data. Once you have the dummy test data, you can pass the data to the method (or subroutine or FM) and get the actual output. You compare the expected output with the actual output to verify it works as expected.
    For your example, you should modularize the program - method for GET_DATA, method for PREPARE_OUTPUT, method for GENERATE_OUTPUT. From these methods, you should be able to write unit test on PREPARE_OUTPUT.
    In your unit test, you need to declare local variables in your test class if you use the subroutine. if you use the class and methods, you can instantiate the object and you get all the variable access. Thats the reason it would be more easier and less confusing when using the objects with unit test.
    Fill up these tables. Say LT_VBRK, LT_VBFA, LT_VBAK. Make sure your subroutine PREPARE_OUTPUT has importing parameters. Pass these to them. Also, prepare the LT_OUTPUT_EXP with the expected results. Declare the table which would hold the actual values LT_OUTPUT_ACT and receive the results from the subroutine PREPARE_OUTPUT. Use the method  cl_aunit_assert=>assert_equals to check the values in the LT_OUTPUT_EXP and LT_OUTPUT_ACT.
    Regards,
    Naimesh Patel

  • Unit test for J2EE application

    I am writting a Unit test for One J2EE application. The Application is built in such a way that makes unit testing extremely difficult.
    There are 2 things that contribute to the mess.
    1. Sping integration means all the config files are specified in web.xml independently, even though their beans rely on each other across files. End result is in a unit, I cannot try to load a bean because some of its dependencies are missing (ie. they are in a config file that the first file does not include). For this I tried to use AbstractDependencyInjectionSpringContextTests class to set the Spring Application Context when you are not in the flow but didn't success ed.If any one has use this please post the example.
    2. The application is using Errors interface of package org.springframework.validation. To write a test for any validator class you have to pass the object of Error in the validate method with the command object. Now my question is how you can set this Error object when you are not in the flow. For this I tried to use Mock object e.g Errors error;
    Mockery context = new Mockery();
    final Errors errorMock =context.mock(Errors.class);
    //call the validate object with mock object
    classObject.doValidate(cmdObject, errorMock)
    This thing doesn't work. It gives me below error message.
    unexpected invocation: errors.pushNestedPath("")
    no expectations specified: did you...
    - forget to start an expectation with a cardinality clause?
    - call a mocked method to specify the parameter of an expectation?
    Is there any way to get around these hiccups programmatically in unit tests?
    thanks...

    If you are doing unit testing, try to use straight JUnit4 without involving the Spring framework. Given that you do unit testing, you might not need Spring configuration in your unit test at all. You can programmatically instantiate the instance of the class under testing and either programmatically instantiate collaborating objects, or create mock objects for that purpose. If you are doing functional testing, you might need a Spring context after all. Understand that your tests are running in the different context than the complete application, so you would have to create separate application context for your test(s). You might have to go through the existing Spring configuration modules that you created for your application and re-jiggle them a bit so that they can be included both in your application context and your unit test context.
    Hope this helps.

  • Unit Tests with Jemmy

    I currently write some Unit Tests with jemmy. But i did not find a solution to run it headless. The test should run on a hudson build server and there is no X installed. Are there any solutions?
    cheers
    Andy

    Not presently, we have the same issue internally. I have a half-finished "Headless Glass" implementation would allow exactly this, but due to other (crucial and exciting) FX work I am doing at the moment, I haven't been able to finish this.

  • Writing a unit test around a stubbed NSArrayController

    Using XCode 3.2.1 64 bit:
    I am at a loss with this one. I am trying to write a unit test for a method that interfaces with an NSArrayController. This is for a Mac application (not iPhone although I'm not sure it makes much of a difference). During the method's run the "Add:(id)sender" method is called to add a new entity to a managed object context. The method is similar to this below:
    @interface MyClass : NSObject
    NSArrayController *myArrayController;
    @property (retain) IBOutlet NSArrayController *myArrayController;
    -(IBAction)addNewEntity;
    @end
    @implementation MyClass
    @synthesize myArrayController;
    -(IBAction)addNewEntity:(id)sender{
    [myArrayController add:self];
    @end
    The wire-ups are through IB. The Array Controller has its ManagedObjectContext connected to an NSManagedObjectContext in the +File's Owner+, its mode set to "Entity" and its Entity Name set to the name of the entity to use. I have built this in a project and it works but when I attempt to stub these components for use in the test the "add" method doesn't do anything. With some more troubleshooting I have been able to determine that the "add" method is not doing anything. The managed object context is not adding a new object. I figure I've overlooked something but I can't find it.
    Here is an example of my test code that examines the add method of the NSArrayController class. A quick note, this setUp constructs a mocStub and is used in other test cases and it works fine. I figure the problem is somewhere the NSArrayController configuring part.
    @interface MyTestCases : SenTestCase
    NSManagedObjectContext *mocStub;
    NSArrayController *testArrayController;
    @end
    @implementation MyTestCases
    -(void)setUp{
    // Create URL to MOM file. Already ran MOMC to create MOM from from xcdatamodel
    NSString *pathString = [NSString stringWithCString:kPathToMomFile
    encoding:NSUTF8StringEncoding];
    NSURL *url = [NSURL fileURLWithPath:pathString];
    // Create the Managed Object Context
    NSManagedObjectModel *mom = [[NSManagedObjectModel alloc]initWithContentsOfURL:url];
    NSPersistentStoreCoordinator *psc = [[NSPersistentStoreCoordinator alloc]initWithManagedObjectModel:mom];
    mocStub = [[NSManagedObjectContext alloc]init];
    [mocStub setPersistentStoreCoordinator:psc];
    // Create and configure NSArrayController
    testArrayController = [[NSArrayController alloc]init];
    [testArrayController setManagedObjectContext:mocStub];
    [testArrayController setSelectsInsertedObjects:YES];
    [testArrayController setAutomaticallyPreparesContent:YES];
    [testArrayController setEntityName:@"MyEntity"];
    -(void)tearDown{
    [mocStub release];
    [testArrayController release];
    -(void)testAddNewEntity{
    [testArrayController add:self];
    int expected = 1;
    int actual = [[testArrayController arrangedObjects]count];
    STAssertEquals(expected, actual, @"add did not add a new entity expected %i actual %i", expected, actual);
    @end
    I have not added the model, but any model will do; just need to get the name correct in code. Does anyone see what I am overlooking in the test code? Any thoughts are welcome.
    Thanks,
    Rob

    I got this working.

  • Questions on async and sync's unit tests

    Hi All
    I write a API project and that have sync and async method.  
    Then I also write a unit tests for them.
    What I want to ask is how to write them is better ?
    public abstract class ApiProxyBase
            protected async Task<T>
    GetDataAsync<T>(IRestRequest restRequest, bool ignoreSslCertificateValidation
    = true) where T
    : ApiResponse, new()
            protected T
    GetData<T>(IRestRequest restRequest, bool ignoreSslCertificateValidation
    = true  where T
    : ApiResponse, new();
       public class GameServerApiProxy : ApiProxyBase, IGameServerApiProxy
    async Task<GetGameRedirectResponse>
    GetGameRedirectAsync(GetGameRedirectRequest request) ;
        public GetGameRedirectResponse GetGameRedirect(GetGameRedirectRequest request)
        public class GameServerApiProxyTest : TestsBase
            [Test]
            public async void Can_Get_Game_RedirectUrl_Async()
                await LogIn();
                var response
    = await _gameServerApiProxy.GetGameRedirectAsync(new GetGameRedirectRequest());
                response.Url.Should().NotBeNull();
                LogOut();
            [Test]
            public void Can_Get_Game_RedirectUrl()
                LogInSync();
                var response
    = _gameServerApiProxy.GetGameRedirect(new GetGameRedirectRequest());
                response.Url.Should().NotBeNull();
                LogOut();

    I have an
    article on asynchronous unit testing. I'd say your async unit test method should be async Task and not async void. Other than that, it looks good. In particular, since your interface has both synchronous and asynchronous APIs, you should have tests for
    both of them.
    Home page: <a href="http://stephencleary.com/">http://stephencleary.com/</a><br/> Programming blog: <a href="http://blog.stephencleary.com/">http://blog.stephencleary.com/</a><br/> <br/> <a
    href="http://www.landmarkbaptist.com/salvation">How to get to Heaven according to the Bible</a><br/>

  • Object performance,need detail of Oracle's internal performance testing

    hi Geoff,
    from your previous answer:
    From an Oracle's comprehensive internal performance testing,
    object implementation of an application consistently matches
    those of relational implementation.
    For some operations, using objects performed better. can you tell more about the result of the testing ?
    we need to get the comparison between the two implementation,
    in order to know in which case should use object implementation
    and in which case should not.
    thanks
    Ray

    Ray,
    Before I name some cases that objects perform better, I still
    want to emphasize that your application object model comes
    first. Here are the cases:
    1. If you have nested objects (e.g., customer with address
    attribute), querying the nested objects would work faster than
    relational access.
    2. If you have containment objects (e.g., customer with VARRAY
    of phone numbers), querying these contained objects would also
    work faster than relational.
    What is your application? What does your object model look like?
    The more specific your question is, the better I can answer it.
    Regards,
    Geoff
    hi Geoff,
    from your previous answer:
    From an Oracle's comprehensive internal performance testing,
    object implementation of an application consistently matches
    those of relational implementation.
    For some operations, using objects performed better. can you tell more about the result of the testing ?
    we need to get the comparison between the two implementation,
    in order to know in which case should use object implementation
    and in which case should not.
    thanks
    Ray

  • How can I write unit tests for BizTalk Maps with multipe inputs?

    I want to bring all my maps under unit test coverage, but can't seem to find a way to test maps with multiple inputs. Maps with multiple inputs are first merged into a single schema by biztalk and then the map actually uses that inline schema as source.
    What I tried is- produced a generated instance of source schema by clicking "Test Map", and then modified the skeletal instance by stitching together the multiple input files into it. There are two problems I am facing going forward that way- 1#
    It takes a lot of time to craft a mock input of inline schema and 2# the mock input fails input validation although the input works just fine in the orchestration.
    So is there a better or standard way to test such Maps?

    For testing maps with multiple inputs, follow the below steps-
    Lets assume you have a map with two input schemas A and B and output as C.
    1) To create the required schema just reverse the inputs i.e. make a map with C as input and A & B as output. Later do a test map. This will generate an XML File with schemas A & B. 
    2) Now you just to need to replace OutputMessagePart_0 to InputMessagePart_0
    and OutputMessagePart_1 to InputMessagePart_1
    Later you can use this xml for testing your original map.
    Refer the below article
    Developing and Testing Maps which have Multiple Source and Destination Schemas
    Thanks,
    Prashant
    Please mark this post accordingly if it answers your query or is helpful.

  • Hi Experts, need an example for abap unit test(ABAP OO)?

    Hi Experts,
    I want to do abap unit test for the developed programs, could anyone please give me an example program of development(a simple is ok, just use it to test)? and an abap unit test example for the program, what I want is to use object oriented abap, thanks in advance!
    Merry Christmas to you all.
    Kind regards
    Dawson

    Hi
    Below documents will give you more information,
    http://help.sap.com/saphelp_nw04/helpdata/en/a2/8a1b602e858645b8aac1559b638ea4/content.htm
    ABAP Testing and Troubleshooting [original link is broken]
    http://bi.offis.de/publicProject/g16cglafhqva.htm
    regards
    Nagaraju

  • [svn:osmf:] 13351: Adding a new TimeUtil class and corresponding unit tests .

    Revision: 13351
    Revision: 13351
    Author:   [email protected]
    Date:     2010-01-07 16:19:20 -0800 (Thu, 07 Jan 2010)
    Log Message:
    Adding a new TimeUtil class and corresponding unit tests.
    Modified Paths:
        osmf/trunk/framework/MediaFrameworkFlexTest/org/osmf/MediaFrameworkTests.as
    Added Paths:
        osmf/trunk/framework/MediaFramework/org/osmf/utils/TimeUtil.as
        osmf/trunk/framework/MediaFrameworkFlexTest/org/osmf/utils/TestTimeUtil.as

    HI
    add that fileds in the all locations where you need it like
    in internal table declaration , write statement , select statement
    these are the main areas where you have to add that 2 fileds

  • Unit Testing / Integration Testing

    Hi all
    Can somebody provide links to SAP testing....
    Can anybody define & write down the step by step details on carrying out unit testing, integration testing and user acceptance testing...How it is done..which systems..tools..test scripts / test cases etc

    hi,
    For all kinds of testing the first thing is to enumerate the scenarions i.e preparing a list of scenarions that need to be tsted. this wud include the test data and also the desired results. templates are provided by the consultants to the end users. thse templates have a description of the scenarios, the data used, the transacion codes,  the docs generated and if the desired results were obtained. thse need to be certified by the concerned.
    integration and unit tsting can be done on the same or different clients depanding on system landscape. user accptance testing is generally after the interfration tests have been satisfactorily conducted. different knds of users are asked to do the tests once their id roles and profiles are created. this phase shud be handled as if live production envirionment.
    saurabh

  • Unit testing in J2EE environment

    Hi All:
    We have been trying to use Junit for creating unit test scripts, and have been bit successful in unit testing DAOs and Value objects - but problem is testing of components like EJBs and Servlets or even classes like Actions or Commands. Since these components run under application server environment, I am not sure how to unit test them without either deploying them on the actual server or simulating app server and rest of the system.
    I was wondering if people could share their experience in writing unit test scripts especially for J2EE components - like Servlets, JSPs and EJBs. On the similar note, is there any similar tool or API for creating integration test scripts?
    Thanks,

    Well - we already have couple of other servers but that's for beta, QA and Integration testing. Problem is with the unit testing. In unit testing, some piece of code is tested by itself. And I am not sure how I can unit test some of the classes like Servlets, EJBs, JSPs or even dependent classes like Commands or Actions. For example, consider following Action class from Java Pet Store:
    public final class CartHTMLAction extends HTMLActionSupport {
    public Event perform(HttpServletRequest request)
    throws HTMLActionException {
    // Extract attributes we will need
    String actionType= (String)request.getParameter("action");
    HttpSession session = request.getSession();
    // get the shopping cart helper
    CartEvent event = null;
    if (actionType == null) return null;
    if (actionType.equals("purchase")) {
    String itemId = request.getParameter("itemId");
    event = new CartEvent(CartEvent.ADD_ITEM, itemId);
    else if (actionType.equals("remove")) {
    String itemId = request.getParameter("itemId");
    event = new CartEvent(CartEvent.DELETE_ITEM, itemId);
    else if (actionType.equals("update")) {
    Map quantities = new HashMap();
    Map parameters = request.getParameterMap();
    for (Iterator it = parameters.keySet().iterator();
    it.hasNext(); ) {
    String name = (String) it.next();
    String value = ((String[]) parameters.get(name))[0];
    final String ITEM_QTY = "itemQuantity_";
    if (name.startsWith(ITEM_QTY)) {
    String itemID = name.substring(ITEM_QTY.length());
    Integer quantity = null;
    try {
    quantity = new Integer(value);
    catch (NumberFormatException nfe) {
    quantity = new Integer(0);
    quantities.put(itemID, quantity);
    event = CartEvent.createUpdateItemEvent(quantities);
    return event;
    In order to unit test above class from say, JUnit test script class, I will have to pass HttpServletRequest object to its method - I will also have to store corresponding command params and store them in the request object - how will you write unit test script for the above class?

  • Unit Testing and APEX Global Variables

    We've recently started to unit test our database level PL/SQL business logic.
    As such we have a need to be able to simulate or provide output from PL/SQL APEX components in order to facilitate testing of these components.
    Some of the most obvious portions that need simulation are:
    1. The existence of a session
    2. The current application ID
    3. The current page ID.
    We currently handle requirement #1 by using apex_040100.wwv_flow_session.create_new
    We handle 2 and 3 using the apex_application.g_flow_id and g_flow_step_id global variables.
    I'm just wondering, how safe is it for us to use wwv_flow_session.create_new to simulate the creation of a session at testing time for those things which need a session?
    I've also noticed that there are apex_application.get_application_id and apex_application.get_page_id functions whose output is not tied to the global variables (at least in our current version).
    Is it safe for us to expect that we can set these global variables for use in testing or is apex moving to get_application_id and get_page_id functions away from global variables?
    Will there be corresponding set_application_id and set_page_id functions in the future?
    Sorry for the question bomb. Thanks for any help.

    My first question would be why do you need to establish a session to test your PL/SQL?
    wwv_flow_session is a package internal to APEX, and you should probably leave it be.
    The get_application_id procedure you refer to is in apex_application_install, which is used for scripting installation of applications - not get/set of page ID like you're describing.
    If you're uncomfortable using apex_application.g_flow_id, you can use v('APP_ID') or preferably pass the app_id/page_id as parameters to your procedures.
    Your question seems to have a few unknowns, so that's the best I can describe.
    Scott

Maybe you are looking for