How to write test case for ViewController project using JUnit ?

Hi All,
JDev ver : 11.1.1.5
JUnit : 1.9 jar added.
I am writing test cases for my ViewController project. View project contains beans and other business logic files.
So, for that I want to write test cases.
In lot of codes I have FacesContext instance, there I am getting null pointer error.
ex:
public static String getFromHeader(String key) {
FacesContext ctx = getFacesContext();
ExternalContext ectx = ctx.getExternalContext();
return ectx.getRequestHeaderMap().get(key);
How to write cases for this scenario ?
I came to know to use mockito, But I dont know how to mock the FacesContext.
Anyone please help.
Thanks,
Gopinath

Gopinath,
Although I've not used it and cannot therefore say anything about whether it's useful or not - have you looked at JSFUnit?
John

Similar Messages

  • How to copy test cases from one project to another?

    Currently we have several projects withing the oracle test manager suite with test cases in each of them. I need to be able to copy some of the test cases to other projects or atleast select them to run under a new project instead of retyping them everytime. Is there a way to do this? I see that I can copy within a project and paste but have not be able to find way to do it outside of a project. Maybe there is a way to export and then import? Any ideas would be helpful?
    Thanks

    Hi
    You can always export a test Summary table Report in XLS and import it in the new project, however that will not give you results or test steps but at least is a start.
    Also there is something called Data Links have a look at the help file you may be able to use that when creating test cases, you could create the test case in CSV first and then upload it to multiple projects using the data link.
    Hope this helps
    Alex

  • How to write Test Script for Rossettanet PIP message to test in RSTK tool.

    Hi All,
    I am new to RSTK i came to know that we need to prepare a test script and place in a Tomcat Server folder, to test any PIP message. Please let me know how we can prepare this Test Script.
    Thanks alot in advance.
    Srinivas.
    Edited by: sri_rambo on Oct 27, 2009 8:08 AM
    Edited by: sri_rambo on Oct 27, 2009 11:34 AM

    Hi,
       Did you check this blog?
    http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417300)ID1594031950DB00395255272980057387End?blog=/pub/wlg/3826
    and this:
    /people/shabarish.vijayakumar/blog/2008/04/28/the-rosettanet-stk-and-how-to-use-it-to-your-advantage
    Regards,
    ravi

  • How can I test Workflow for Leaves without using ESS

    Hi Gurus,
         Please help me..I need to test my wokflow for leaves but I don't have ESS....How do I do it?
        Thanks in advance for all your help.

    Welcome to the Apple Support Communities
    You didn't install Boot Camp drivers. It looks like you downloaded these drivers > http://support.apple.com/kb/TS3173
    Those drivers are only for the graphic card and Bluetooth, not anything else, so you have to download the Boot Camp drivers on OS X and install them in Windows

  • High Availability Test Cases for ECC6.0, PI 7.0, BI 7.0???

    Dear All
    I am in a pretty difficult situation here. I have to write test cases for the components in the High Availability environment. We are running AIX 5L with HACMP/XD clusters ACTIVE/PASSIVE setting. The following components are in the landscape, ECC6.0, PI 7.0 BI 7.0 cFolders 4.0 Portal 7.0 SLD 2004s and Solman 4.0. I have to write test cases for the above components especially ECC, PI BI and cFolders in the HA environment as to
       1.<b>WHAT WILL BE THE EFFECT ON OTHER COMPONENTS IF ECC</b> <b>FAILOVER  and so on for PI and BI</b>,
       2. How do I check the consistency of the system after a failover, since the time for a failover will be anywhere between 3 - 4 mins.
    Can anyone pls give me a 5 or 6  checks like
    Checking RFC connections
    ABAP dumps
    Consistency check (txn: SICK)   and so on
    In the test cases I have to make sure that after a failover the system is up and ready to perform the activities that it was able to before the Failover......
    Will appreciate any suggestions and will definitely reward points for any helpful answers....Thanks in advance.

    Hi Shailesh,
    If you want you can activate SCM_SNC_GEN_1 depending upon business needs or configuration.
    As per my understanding there is no need to activate any business function but if you need additional feature of SNC to be used then refer below help link for more details:
    http://help.sap.com/saphelp_SNC700_ehp01/helpdata/en/a2/6d67d9b60149cb887acf72ae0b90ac/frameset.htm
    In ECC you are going for EPh5 which means no need to activate any additional business function(Normally SNC needs EPh4 only for some the latest feature to be use like in workorder collaboration ManufacturingWorkOrderInformation and ManufacturingWorkOrderProductionProgressNotification XML are used if ECC is with EPh4)
    Regards,
    Nikhil

  • How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column

    Please Help!!!
    How to write a case statement for the totals column of two different years (2013 and 2014) of the same month so that I can get a +/- column.
                                      January 2014         January
    2013                            +/-
                    Region   Entry   Exit  Total    Entry   Exit   Total   (Total of Jan2014-Total of Jan2013)
                    A               2         3      
    40        5       7        30                    40-30= 10

    What is a table structure? Sorry cannot test it right now..
    SELECT <columns>,(SELECT Total FROM tbl WHERE Y=2014)-(SELECT Total FROM tbl WHERE Y=2013)
    FROM tbl
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • How to select test cases efficiently for a test package?

    Dear experts,
    I would like to ask you if you have found a way administer how to assign test cases to test packages and test packages to testers. For regression tests this assignment remains relatively stable (often the key users).
    Do you know a way to administer this within the solution manager - or do you recommend the old excel table.

    Hello Ragu!
    Thank you for your answer! My question was regarding the organisational side, I didn't get this clear.
    I know how to generate a test package and how to assign a tester to a test package but where do I get the information which test packages I need and which tester to assign to which package.
    Maybe a good option is to assign the tester as a team member on the process step level. Thus the assignments can be listed with SOLAR_EVAL using "Assignments / Test Cases" with option "Display Team Members". This list would help to generate the test packages. The selection of the test cases for the test package has do be done manually because there seems to be no filter for team members.
    Regards,
    Martin

  • How to run multiple CodedUI Ordered Tests over multiple Test Agents for parallel execution using Test Controller

    we are using VS 2013, I need to run multiple Coded UI Ordered Tests in parallel on different agents.
    My requirement :
    Example:   I have 40 Coded UI Test scripts in single solution/project. i want to run in different OS environments(example 5 OS ).  I have created 5 Ordered tests with the same 40 test cases. 
    I have one Controller machine and 5 test agent machines. Now I want my tests to be distributed in a way that every agent gets 1 Ordered test to execute. 
    Machine_C = Controller (Controls Machine_1,2,3,4,5)
    Machine_1 = Test Agent 1 (Should execute Ordered Test 1 (ex: OS - WIN 7) )
    Machine_2 = Test Agent 2 (Should execute Ordered Test 2 (ex:
    OS - WIN 8) )
    Machine_3 = Test Agent 3 (Should execute Ordered Test 3
    (ex: OS - WIN 2008 server)  )
    Machine_4 = Test Agent 4 (Should execute Ordered Test 4 (ex:
    OS - WIN 2012 server) )
    Machine_5 = Test Agent 5 (Should execute Ordered Test 5 (ex:
    OS - WIN 2003 server) )
    I have changed the  “MinimumTestsPerAgent” app setting value
    as '1' in controller’s configuration file (QTController.exe.config).
    When I run the Ordered tests from the test explorer all Test agent running with each Ordered test and showing the status as running. but with in the 5 Test Agents only 2 Agents executing the test cases remaining all 3 agents not executing the test cases but
    status showing as 'running' still for long time (exp: More then 3 hr) after that all so  its not responding. 
    I need to know how I can configure my controller or how I can tell it to execute these tests in parallel on different test agents. This will help me reducing the script execution time. 
     I am not sure what steps I am missing. 
    It will be of great help if someone can guide me how this can be achieved.
    -- > One more thing Can I Run one Coded UI Ordered Test on One Specific Test Agent?
    ex: Need to run ordered Test 1 in Win 7 OS (Test Agent 1) only.
    Thanks in Advance.

    Hi Divakar,
    Thank you for posting in MSDN forum.
    As far as I know, we cannot specify coded UI ordered test run on specific test agent. And it is mainly that test controller determine which coded UI ordered test assign to which test agent.
    Generally, I know that if we want to run multiple CodedUI Ordered Tests over multiple Test Agents for parallel execution using Test Controller.
    We will need to change the MinimumTestsPerAgent property to 1 in the test controller configuration file (QTControllerConfig.exe.config) as you said.
    And then we will need to change the bucketSize number of tests/number of machines in the test settings.
    For more information about how to set this bucketSize value, please refer the following blog.
    http://blogs.msdn.com/b/aseemb/archive/2010/08/11/how-to-run-automated-tests-on-different-machines-in-parallel.aspx
    You can refer this Jack's suggestion to run your coded UI ordered test in lab Environment or load test.
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/661e73da-5a08-4c9b-8e5a-fc08c5962783/run-different-codedui-tests-simultaneously-on-different-test-agents-from-a-single-test-controller?forum=vstest
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to Extract Test Cases from TFS 2013 to Excel

    How to extract test cases from 2013 Team Foundation Server to excel.
    Yuvaraj G

    Hi Yuvaraj,
    To export test cases in TFS 2013 to an Excel file, you can follow the steps as below:
    Create a query for the test cases that you want to export in Team Explorer
    Open an empty Excel file, click the tab of "Team"
    Click "New List" and then select the TFS server and the detailed team project
    In query list, select the query you created before, then click OK to export the test cases
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How to write conversion routine for key figure?

    Our customer has this requirment:
    we need to know the last time of some TV program in BEx report, If a TV program last 500 seconds, we need show the key figure like this:  00:08:20, If a TV program last 100000 seconds, we need show the key figure like 27:46:40 (27 hours and 46 minitues and 27 seconds), If we define a key figure as time,  BW system will report a error that say it is not acceptable time.  If we want to define a integer, but we need display it like hhmmss format.  We know we can write conversion routine for char.  but I don't how to write conversion routine for key figure.   Please give me any hint if any other solutions?
    Edited by: SY DONG on Dec 2, 2010 3:36 AM

    If you want to do in Transformation Layer :
    You can use routine ...break up the seconds into minute hour and seconds
    you will have to handle few cases in this:
    let say your variable lv_seconds holds the number of seconds you want to convert to hour min and seconds
    DATA: lv_seconds type i,
               lv_hrs  type  i,
              lv_sec type i,
              lv_min type i.
    lv_hrs = lv_seconds / 3600
    if lv_hrs >= 1.
    lv_min = (lv_hrs - trunc(lv_hrs))*60
    here again handle seconds if min >60.
    else.
    lv_hrs = '00'.
    lv_min = lv_hrs*60
    It is just hint ..how you can manipulate the seconds to get it...you will have to think about the complete algorithm
    Regards,
    RK

  • How to write a code for  open new txt file in swing

    hai all,
    now i do one project in java.that project's GUI is Swing. But i don't known swing (basic).So how to write a code for open new txt file and "Open window " in menu item on swing.that means when i click the "New" on menu that time open a new txt file. open also like that type.
    plz give me that code ! very urgent
    Advance Thanks !
    RSK

    Swing Tutorial:
    http://java.sun.com/docs/books/tutorial/uiswing/index.html
    Since you don't know the basic of swing read the tutorial, it is for your own good because it is useless if we provide you with a code you don't even understand and how it works.
    If you want a menu read the tutorial about using menus and for opening a file read using JFileChooser.
    note: don't use the word urgent because it implies that your problem is more important than others.

  • Writing test case for One-way messaging returns fault

    Hi All,
         We are using latest 11.1.1.7 version of SOA Suite. There is a SOA composite which gets data feed from external party using the one-way message exchange pattern to store the feed into the database.
    i.e. from (Web Service component ----> Mediator ----> DBAdapter). The composite uses one way returns fault pattern. This basically returns only the faults when they occur and seems to work as expected. I can see any runtime errors (like database not available returned to the Mediator and the caller of the web service). However, I am unable to write a test case for the fault returned in case of database adapter unable to connect to database as the 'Emulates' tab is disabled.
    Happy to provide more details if required.
    Thanks

    Hi,
    By looking at the error what you have got it indicates that you are not catching the specific fault which is thrown by bpel1 in bpel2.
    Regards,
    Santosh Hemashekar

  • How to export test cases into oracle test manager

    hi
    present i am learning this tool help plz
    how to export test cases into oracle test manager
    Edited by: 799636 on Oct 5, 2010 7:11 AM

    Create a script in openScript and save it to a workspace (a shared directory on the OTM server). To add an Oracle OpenScript test to OTM:
    1.Select the Tests tab.
    2.Click the Add button.
    3.Enter a name for the test.
    4.Select Oracle OpenScript in the Type field.
    5.Click Find to display the Select Script dialog box.
    6.Select the Repository and Workspace.
    7.Select the Oracle OpenScript script that you want to add.
    8.Click OK.
    9.Select the owner and priority and enter any descriptive information in the Functionality and Description fields.
    10.Click Save.
    Regards,
    Jamie

  • How to write sql query for counting pairs from below table??

    Below is my SQL table structure.
    user_id | Name | join_side | left_leg | right_leg | Parent_id
    100001 Tinku Left 100002 100003 0
    100002 Harish Left 100004 100005 100001
    100003 Gorav Right 100006 100007 100001
    100004 Prince Left 100008 NULL 100002
    100005 Ajay Right NULL NULL 100002
    100006 Simran Left NULL NULL 100003
    100007 Raman Right NULL NULL 100003
    100008 Vijay Left NULL NULL 100004
    It is a binary table structure.. Every user has to add two per id under him, one is left_leg and second is right_leg... Parent_id is under which user current user is added.. Hope you will be understand..
    I have to write sql query for counting pairs under id "100001". i know there will be important role of parent_id for counting pairs. * what is pair( suppose if any user contains  both left_leg and right_leg id, then it is called pair.)
    I know there are three pairs under id "100001" :-
    1.  100002 and 100003
    2.  100004 and 100005
    3.  100006 and 100007
        100008 will not be counted as pair because it does not have right leg..
     But i dont know how to write sql query for this... Any help will be appreciated... This is my college project... And tommorow is the last date of submission.... Hope anyone will help me...
    Suppose i have to count pair for id '100002'. Then there is only one pair under id '100002'. i.e 100004 and 100005

    Sounds like this to me
    DECLARE @ID int
    SET @ID = 100001--your passed value
    SELECT left_leg,right_leg
    FROM table
    WHERE (user_id = @ID
    OR parent_id = @ID)
    AND left_leg IS NOT NULL
    AND right_leg IS NOT NULL
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Can any one please tell me how to write labview program for data logging in electric motor bike.

    Can any one please tell me how to write labview program for data logging in electric motor bike. I am going to use CompactRIO for getting wide range of data from various sensors in bike. I need to write labview program for data logging of temperature, voltage and speed of the bike. Can any one help me?

    Yes, we can.   
    I think the best place for you to start for this is the NI Developer Zone.  I recommend beginning with these tutorials I found by searching on "data log rio".  There were more than just these few that might be relevant to your project but I'll leave that for you to decide.
    NI Compact RIO Setup and Services ->  http://zone.ni.com/devzone/cda/tut/p/id/11394
    Getting Started with CompactRIO - Logging Data to Disk  ->  http://zone.ni.com/devzone/cda/tut/p/id/11198
    Getting Started with CompactRIO - Performing Basic Control ->  http://zone.ni.com/devzone/cda/tut/p/id/11197
    These will probably give you links to more topics/tutorials/examples that can help you design and implement your target system.
    Jason
    Wire Warrior
    Behold the power of LabVIEW as my army of Roomba minions streaks across the floor!

Maybe you are looking for