Unit Testing in DAC

Hi,
I am facing a problem in unit testing in DAC. I am able to run full loads and incremental but i am unable to do unit testing in DAC. It shows an error that my Integration Services are not up when i run an individual task . Are there any setups for unit testing in DAC. I had followed http://docs.oracle.com/cd/E15586_01/fusionapps.1111/e14849/dacquickstart.htm#BABCIIIH topic : To unit test an execution plan task. If any one would help me in running a unit test that would be a great help.
Thanks,
Ram

I'm struggling with the idea of testing View/Controller classes which depend on "container things" like bindings. Since there are many ways to interact with the 'container things' I guess it depends on exactly how you're using those bindings in your View/Controller classes. I've had success using Mockito along with my own fixture classes that do things like set up a mock ADFContext and RequestContext. Within my test setUp and tearDown, I set up and tear down these fixture classes, which results in a safe, mocked-out environment in which the test can execute. It's often tricky because many of the these objects are static and singleton-like, but so far I've always found a back door by which to inject a mock object. We also have our own utility classes that look-up 'container things', so we of course make sure we have a way to provide mock 'container things' through those utility classes.
If you haven't come across the concept of 'mock objects' before, then it may be best to do a bit of background reading first:
[http://www.mockobjects.com/2009/09/brief-history-of-mock-objects.html]
[http://en.wikipedia.org/wiki/Mock_object]
There are many mocking libraries about (EasyMock, jMock, rMock) but IMO Mockito is the one to choose right now.
Of course, the alternative is to apply some [Inversion of Control|http://martinfowler.com/articles/injection.html] and make sure that the code you right is always ignorant of exactly where the 'container things' have come from. This makes mocking much easier, but I've not yet investigated use of a D.I. container (e.g. Spring) along with ADF - I suspect your options in 10g would be limited.

Similar Messages

  • Unit Testing, Null, and Warnings

    I have a Unit Test that includes the following lines:
    Dim nullarray As Integer()()
    Assert.AreEqual(nullarray.ToString(False), "Nothing")
    The variable "nullarray" will obviously be null when ToString is called (ToString is an extension method, which is the one I am testing). This is by design, because the purpose of this specific unit test is to make sure that my ToString extension
    method handles null values the way I expect. The test runs fine, but Visual Studio 2013 gives includes the following warning:
    Variable 'nullarray' is used before it has been assigned a value. A null reference exception could result at runtime.
    This warning is to be expected, and I don't want to stop Visual Studio 2013 from showing this warning or any other warnings, just this specific case (and several others that involve similar scenarios). Is there any way to mark a line or segment
    of code so that it is not checked for warnings? Otherwise, I will end up with lots of warnings for things that I am perfectly aware of and don't plan on changing.
    Nathan Sokalski [email protected] http://www.nathansokalski.com/

    Hi Nathan Sokalski,
    Variable 'nullarray' is used before it has been assigned a value. A null reference exception could result at runtime.
    Whether the warning above was thrown when you built the test project but the test run successfully? I assume Yes.
    Is there any way to mark a line or segment of code so that it is not checked for warnings?
    There is no built-in way to make some code snippet or a code line not be checked during compiling, but we can configure some specific warnings not to be warned during compiling in Visual Basic through project Properties->Compile
    tab->warning configurations box.
    For detailed information, please see: Configuring Warnings in Visual Basic
    Another way is to correct your code logic and make sure the code will not generate warning at runtime.
    If I misunderstood you, please tell us what code you want it not to be checked for warnings with a sample so that we can further look at your issue.
    Thanks,
    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.

  • Unit testing with TLF

    While unit testing complex formating, I hit several problems. Below are simple tests that fail with an error. Does anybody know what is wrong with these tests?
    Thanks for any hints,
    Marc
        public function test_apply_Link():void
            var init:XML = <TextFlow xmlns="http://ns.adobe.com/textLayout/2008"><p><span>aaa</span></p></TextFlow>
            var textFlow:TextFlow = TextConverter.importToFlow(init, TextConverter.TEXT_LAYOUT_FORMAT)
            var editManager:IEditManager = new EditManager()
            textFlow.interactionManager = editManager
            editManager.selectRange(1,2)
            editManager.applyLink("http://livedocs.adobe.com/", "_self", true) // throws error:
            RangeError: Error #2006: The supplied index is out of bounds.
                at flash.text.engine::GroupElement/replaceElements()
                at flashx.textLayout.elements::ParagraphElement/http://ns.adobe.com/textLayout/internal/2008::insertBlockElement()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_core\src\flashx\textLayout\elements\ParagraphElement.as:277]
                at flashx.textLayout.elements::FlowLeafElement/http://ns.adobe.com/textLayout/internal/2008::createContentElement()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_core\src\flashx\textLayout\elements\FlowLeafElement.as:95]
                at flashx.textLayout.elements::SpanElement/http://ns.adobe.com/textLayout/internal/2008::createContentElement()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_core\src\flashx\textLayout\elements\SpanElement.as:77]
                at flashx.textLayout.elements::ParagraphElement/http://ns.adobe.com/textLayout/internal/2008::createTextBlock()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_core\src\flashx\textLayout\elements\ParagraphElement.as:100]
                at flashx.textLayout.elements::ParagraphElement/http://ns.adobe.com/textLayout/internal/2008::createContentElement()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_core\src\flashx\textLayout\elements\ParagraphElement.as:241]
                at flashx.textLayout.elements::SubParagraphGroupElement/http://ns.adobe.com/textLayout/internal/2008::setParentAndRelativeStart()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_core\src\flashx\textLayout\elements\SubParagraphGroupElement.as:178]
                at flashx.textLayout.elements::LinkElement/http://ns.adobe.com/textLayout/internal/2008::setParentAndRelativeStart()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_core\src\flashx\textLayout\elements\LinkElement.as:495]
                at flashx.textLayout.elements::FlowGroupElement/replaceChildren()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_core\src\flashx\textLayout\elements\FlowGroupElement.as:764]
                at Function/http://adobe.com/AS3/2006/builtin::apply()
                at flashx.textLayout.elements::ParagraphElement/replaceChildren()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_core\src\flashx\textLayout\elements\ParagraphElement.as:302]
                at flashx.textLayout.edit::TextFlowEdit$/insertNewSPBlock()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_edit\src\flashx\textLayout\edit\TextFlowEdit.as:655]
                at flashx.textLayout.edit::TextFlowEdit$/makeLink()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_edit\src\flashx\textLayout\edit\TextFlowEdit.as:503]
                at flashx.textLayout.operations::ApplyLinkOperation/doOperation()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_edit\src\flashx\textLayout\operations\ApplyLinkOperation.as:146]
                at flashx.textLayout.edit::EditManager/doInternal()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_edit\src\flashx\textLayout\edit\EditManager.as:418]
                at flashx.textLayout.edit::EditManager/doOperation()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_edit\src\flashx\textLayout\edit\EditManager.as:321]
                at flashx.textLayout.edit::EditManager/applyLink()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_edit\src\flashx\textLayout\edit\EditManager.as:1137]
        public function test_undo():void
            var init:XML = <TextFlow xmlns="http://ns.adobe.com/textLayout/2008"><p><span>aaa</span></p></TextFlow>
            var textFlow:TextFlow = TextConverter.importToFlow(init, TextConverter.TEXT_LAYOUT_FORMAT)
            var undoManager:IUndoManager = new UndoManager()
            var editManager:IEditManager = new EditManager(undoManager)
            textFlow.interactionManager = editManager
            editManager.selectRange(1,2)
             var format:TextLayoutFormat = new TextLayoutFormat()
            format.fontWeight = FontWeight.BOLD
            editManager.applyLeafFormat(format)
            undoManager.undo() // throws error:
            TypeError: Error #1009: Cannot access a property or method of a null object reference
                at flashx.textLayout.edit::EditManager/performUndo()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_edit\src\flashx\textLayout\edit\EditManager.as:540]
                at flashx.textLayout.operations::FlowOperation/performUndo()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_edit\src\flashx\textLayout\operations\FlowOperation.as:181]
                at flashx.undo::UndoManager/undo()[E:\dev\trunk\frameworks\projects\textLayout\textLayout_edit\src\flashx\undo\UndoManager.as:197]            

    For your second issue, you didn't display TextFlow before you selected the Text.  I also changed the FontWeight.BOLD to "bold" in order to pass compilation.  The code below should work:
    var  
    var controllerOne:ContainerController = new ContainerController(container, 500, 500); 
    var undoManager:IUndoManager = new UndoManager() 
    var init:XML = <TextFlow xmlns="http://ns.adobe.com/textLayout/2008"><p><span>aaa</span></p></TextFlow>  
    var textFlow:TextFlow = TextConverter.importToFlow(init, TextConverter.TEXT_LAYOUT_FORMAT) 
    addChild(container);
    textFlow.flowComposer.addController(controllerOne);
    textFlow.flowComposer.updateAllControllers();
    var editManager:IEditManager = new EditManager();textFlow.interactionManager = editManager;
    editManager.selectRange(1,2)
    var format:TextLayoutFormat = new TextLayoutFormat();format.fontWeight ="bold";container:Sprite = new Sprite(); 
    editManager.applyLeafFormat(format);
    undoManager.undo();
    textFlow.flowComposer.updateAllControllers();

  • Unit Testing  - Results greater than 0

    I am unit testing a PL/SQL function. The function has no inputs and one output (Interval Day to Second) . The output is the time it takes to run a query therefore a valid value for the output would be greater than 0.
    When I setup the test the result only takes a Interval Day to Second value. I want to be able to say any result greater than 0 is a success.
    How can I do this?
    tom

    I am unit testing a PL/SQL function. The function has no inputs and one output (Interval Day to Second) . The output is the time it takes to run a query therefore a valid value for the output would be greater than 0.
    When I setup the test the result only takes a Interval Day to Second value. I want to be able to say any result greater than 0 is a success.
    How can I do this?
    tom

  • 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

    Hi All,
    I would like to inform to all, can any one explain to me the concept of Unit testing in FICO and how it should be drawn? If possible send any dcoumentation for this focus to my mail id: [email protected]
    Thanks with regards,
    Bala

    Hi
    refer below reward if helps
    Unit testing is done in bit and pieces. Like e.g. in SD standard order cycle; we do have 1-create order, then 2-delivery, then 3-transfer order, then 4-PGI and then 5-Invoice.  So we will be testing 1,2,3,4 and 5 seperately alone one by one using test cases and test data. We will not be looking and checking/testing any integration between order and delivery; delivery and TO; TO and PGI and then invoice.
    Whrereas System testing you will be testing the full cycle with it's integration, and you will be testing using test cases which give a full cyclic test from order to invoice.
    Security testing you will be testing different roles and functionalities and will check and signoff.
    Performance testing is refered to as how much time / second will take to perform some actions, like e.g. PGI.  If BPP defination says 5 seconds for PGI then it should be 5 and not 6 second.  Usually it is done using software.
    Regression testing is reffered to a test which verfies that some new configuration doesnot adversly impact existing functionality.  This will be done on each phase of testing.
    User Acceptance Testing:  Refers to Customer testing. The UAT will be performed through the execution of predefined business scenarios, which combine various business processes. The user test model is comprised of a sub-set of system integration test cases.
    We use different software during testing. Most commonly use are
    Test Director:  which is used to record requirement, preparing test plan and then recording the progress.  We will be incorporating defects that are coming during these testings using different test cases.
    Mercury Load Runner:  is used for performance testing.  This is an automatic tool.
    What does the following terms means :
    - Technical Unit Testing
    - Functional Unit Testing
    - IntegrationTesting
    - Volume Testing
    - Parallel Testing?
    Technical Unit Testing= Test of some technical development such as a user exit, custom program, or interface. the test usually consists of a test data set that is processed according to the new program.  A successful test only proves the developed code works and that it performed the process as as designed.
    Functional Unit Testing= Test of configuration, system settings or a custom development (it may follow the technical unit testing) These usually use actual data or data that is masked but essentially the same as a real data set. A successful test shows that the development or configuration works as designed and the data is accurate as a result.
    IntegrationTesting= Testing a process, development or configuration within the context of any other functions that the process, development or functionality will touch or integrate . The test should examine all data involved across all modules and any data indirectly affected. A successful test indicates that the processes work as designed and integrate with other functions without causing any problems in any integrated areas.
    Volume Testing= testing a full data set that is either actual or masked to insure that the entire volume does cause system problems such as network transmission problems, system resources issues, or any systemic problem, A successful test indicates that the processes will not slow or crash the system due to a full data set being utilized.
    Parallel Testing= Testing the new system or processes with a complete data set while running the same processes in the legacy system. A successful test will show identical results when both the legacy system and new system results are compared.
    I would also note that when a new implementation is being done you will want to conduct at least one cut over test from the old system to the new and you should probably do several.
    What kind of testings that are carried out in testing server?
    1. Individual Testing ( Individually which we've created)
    2. Regressive Testing ( Entire Process)
    3. Integration Testing ( Along with other integrated modules)
    The 3 types of testing is as follows:-
    1. Unit testing (where an individual process relevant to a SD or MM etc is tested)
    2. Integration testing (where a process is tested that cuts across all areas of SAP).
    3. Stress testing (where lots of transactions are run to see if the system can handle the data)
    http://www50.sap.com/businessmaps/6D1236712F84462F941FDE131A66126C.htm
    Unit test issues
    The unit tools test all SAP development work that handles business object processing for the connector. Also, the unit test tools enable you to test the interaction of your work with the ABAP components of the connector. The test tools allow you to test your development work as an online user (real-time) only.
    Note:
    It is important to understand the differences between testing the connector as an online user and testing the connector as if operating as a background user.
    The differences between testing the connector as an online user or as a background user are described as follows:
    Memory--When testing a business object, the connector must log into the SAP application.
          The connector runs as a background user, so it processes in a single memory space that is never implicitly refreshed until the connector is stopped and then restarted (therefore it is critical in business object development to clear memory after processing is complete). Since you are an online user, memory is typically refreshed after each transaction you execute.
          For more information, see Developing business objects for the ABAP Extension Module. Any problems that may occur because of this (for example, return codes never being initialized) are not detected using the test tool; only testing with the connector will reveal these issues.
    Screen flow behavior--Screen flow behavior is relevant only when using the Call Transaction API. The precise screen and sequence of screens that a user interacts with is usually determined at runtime by the transaction's code. For example, if a user chooses to extend a material master record to include a sales view by checking the Sales view check box, SAP queries the user for the specific Sales Organization information by presenting an additional input field. In this way, the transaction source code at runtime determines the specific screen and its requirements based on the data input by the user. While the test tool does handle this type of test scenario, there is a related scenario that the test tool cannot handle.
          SAP's transaction code may present different screens to online users versus background users (usually for usability versus performance). The test tool only operates as an online user. The connector only operates as a background user. Despite this difference, unit testing should get through most of the testing situations.

  • Unit testing in flex

    .How to implement the unit testing for flex? and give an
    example?

    Try Flexunit:
    http://code.google.com/p/as3flexunitlib/

  • Unit Testing in PL/SQL

    Hi,
    I m writing some packages and in that some procedures are there. Now i want to test these procedures. I have downloaded utPLSQL from sourceforge.net
    But I am unable to use it. Do we need to copy those utPLSQL files where the orcale is present ? If so and after that do we need to run any .sql scripts before going to do Unit Testing.
    And please tell the procedure in brief in order to start Unit Testing.
    Thanks in Advance.

    I suggest you also check out Quest Code Tester for Oracle (disclosure: I design, build and use the tool - hey, I also wrote the original version of utPLSQL!), the first commercial automated testing tool for PL/SQL.
    www.quest.com/code-tester-for-oracle
    It generates virtually all of your test code, based on expected behavior you describe through a point and click interface. You can run tests through the UI or scheduled scripts.
    Regards,
    Steven Feuerstein
    www.ToadWorld.com/SF

  • Unit testing or integration testing?

    Here it says that this example is more of an explanation of framework than best practice because of the conflation of integration/unit testing concepts: http://docs.flexunit.org/index.php?title=Using_Asynchronous_Startup
    My question is, how do you define a line here between unit testing and integration testing? What kind of UI components asynchronous tests are then considered to be unit tests and not yet integration tests? Many books recommend having 100% code coverage with unit tests. How would this example look like, to be considered only a unit test and not integration test?

    The question about which levels of testing to do are really dependent upon you. Let me explain a bit more.
    If you are building an application, and only an application, then functional testing probably covers most of your needs. In an application environment, you have a relatively narrow pathway of options and interactions that a user might follow. So long as you test those options well, your app will probably work as well.
    Where I see the real value of unit testing is testing for the unknowns. If you have a class that will be used in multiple applications in multiple ways, or perhaps it is intended to be a reusable class where others in your organization will use it in the future, then you want lower level testing. You want to have the best coverage you can because you want to know that, regardless of the way someone chooses to use the code, it will likely function or at least fail gracefully.
    The same is true for integration. If I am creating a Flex component, then I can unit test part of it, but not all. So, I want to use integration tests to ensure that it works in as many circumstance as possible. Further, Flex components have a life cycle, so testing them when they are not on the display list isn't really a valid test..
    So, to summarize, I see unit and integration w/Flex about testing possibilities and trying to achieve realistic code coverage for known and possible use cases. I see functional testing as testing those components in very specific use cases.
    Which do you need? Depends. Are you developing reusable components across (n) projects, likely the first 2 and maybe the last. Are you an application developer testing that an application works in documented business cases? Just functional will likely work.
    Hope that helps,
    Mike

  • Unit testing - problems using £ sign

    Sorry if this has come up before...
    We're using the SQL Developer unit testing functionality in what we thought was a fairly straightforward manner.
    We use a startup to set up some data, run a procedure with specific values for the inputs, compare the outputs with expected values, and then use a teardown to remove the data.
    All works well except for one output field. For reasons I won't bother to go into, it's a varchar2 field that returns an amount, in the format £9.99 - i.e. with a UK pound (£) sign at the start of the string.
    Whenever I try and input an expected value including the pound sign, the whole value gets converted to null - so, £9.50 gets saved as an expected value of null, which then, of course, causes the test to fail (unless we set it to ignore the value which somewhat defeats the point of testing !)
    Playing around a little, it seems that characters such as $ and # are ok, but any string that uses £ anywhere within it (e.g. 876f£ffe) gets saved as null.
    Has anyone else encountered this or have a workaround/fix ?
    (SQL Developer version 3.2.20.09, running on Windows XP 32-bit)

    Have you tried opening a new browser window as the new user? That is:
    1. Hold Shift and right click IE shortcut
    2. Select Run as different user
    3. Enter the new user's credentials
    4. Browse to the SharePoint site
    Jason Warren
    @jaspnwarren
    jasonwarren.ca
    habaneroconsulting.com/Insights

  • Unit Testing: Supplying SYSDATE on a DATE parameter

    hi all,
    I have a procedure that I'm unit testing and one of the parameter is date, I want to supply a dynamic value to it relative to sysdate but SQL Developer only accepts hard coded date values. Does anyone know how I can supply SYSDATE or SYSDATE-50 to a date parameter directly. I can already solve this by using a wrapper procedure, just wondering if there's a solution to directly supply the value.
    Thanks,
    Alfredo

    Hi Kranthi.
    1. Assuming you are with Plus you can make the parameters optional in the parameters screen (tools -> parameters)
    so that if they get NULL as value they will return all data.
    2. the second way is if you like to keep it mandatory is to define a default value for the parameter and then take care of the situation in the condition.
    for example you'll define the 1-Jan-1900 as your default date for the from_date.
    Then in the condition change if you'll define it just as from_date > :P_from_date then you got what you wanted.
    BTW In similar situations when you are dealing with varchar you can do a manipulation such as:
    from_date > :P_from_date
    Or
    :P_from_date = '1-Jan-1900'
    Tamir

  • Unit Testing  approach

    Hi,
    We had done technical migration of value based roles to derived roles, and facing problem to design the unit testing approach for the same. can you please suggest what must unit testing approach and how to create test cases for authorizations specificaly to derived roles created from value based roles ?
    goal is after testing, end users should not feel any changes done in roles approach.
    Thanks.
    Regards,
    Swapnil
    <removed_by_moderator>
    Edited by: Julius Bussche on Oct 7, 2008 3:40 PM

    Hi Swapnil,
    The Testing of Security roles need to be taken in a two step approach
    Step 1 Unit Testing in DEV
    A. Prepare the test cases for each of the derived roles and ensure that your main focus is to see if you are able to execute all the tcodes that have been derived from the parent role with out authorization errors. You also need to verify if each of the derived roles are applicable to those respective Org level Values.
    B. Because there will not enough data in DEV ( except In some cases where you have a refresh of fresh PROD data) it is always advisable to do the actual testing of the roles in QA. The goal here is to see if you are able to perform a dry run of all tcodes/Reports/Programs that belong to the roles.
    C. You may create fewer Unit test ids as you only assign one ID with one role and once the role is tested you can assign the same ID to another role.
    Step 2 Integration Testing in QA
    A. Prepare the Integration Test cases for each of the Derived roles. Here most likely the testing will be performed by the  end users/Business Analysts in that respective Business Process. Each test case must reflect the possible Org level Authorization Objects and Values that need to be tested.
    B. As Integration testing is simulation of actual Production authorizations scenario, care must be taken when creating mulitple Integration test user ids and assigning them right roles and send the ids to the end users to perform the testing in QA.
    C. The objective here is that end user must feel comfortable with the test cases and perform both Positive and Negative testing. Testing results must be caputured and documented for any further analysis.
    D. In an event of any authorization errors from Integration testing, the authorization errors will be sent to the Security team along with SU53 screenshots. The roles will be corrected in DEV and transported back to QA and the testing continues.
    E. Also the main objective of Integration testing would be to check if the transactions are reflecting the right amount of data when executed and any mismatch in the data will be direct implication that the Derived roles do not contain the right Org level values.
    Hope this helps you to understand how testing of Security roles (Derived) is done at a high level.
    Regards,
    Kiran Kandepalli.
    Edited by: Kiran Kandepalli on Oct 7, 2008 5:47 AM

  • 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 with Microsoft Sharepoint Emulators and Fakes with Visual Studio 2013

    Hi All,
    I have created Test Project and now creating Test cases for Sharepoint. I found a link on MSDN which suggests using Fakes framework but it supports VS2012 and I am using Visual Studio 2013.
    So how can I use it with VS2013 or is there any other way with which I can implement the Test cases with VS2013.
    Please suggest.
    Thanks in advance.
    Himanshu Nigam

    Hi HimanshuNigam,
    According to your descrition, my understanding is that you want to use Fakes framework to create test case for SharePoint project in Visual Studio 2013.
    If you want to test using Fakes Framework, you can use the codeplex extension to achieve it. It supports Visual Studio 2013.
    Here is a detailed article for your reference:
    Better Unit Testing with Microsoft Fakes
    About how to include the Nuget package, you can use the package with the link below:
    NuGet Package Manager for Visual Studio 2013
    Installing NuGet
    If you still have question about this issue, I suggest you can create a post in Visual Studio, more experts will help you and you can get more detailed information from there:
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?category=visualstudio%2Cvsarch%2Cvsdbg%2Cvstest%2Cvstfs%2Cvsdata%2Cvsappdev%2Cvisualbasic%2Cvisualcsharp%2Cvisualc
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • Unit Testing of servlets and jsp by Junit

    hi,
    suggest me how to do the unit testing by junit!
    thanks in advance

    Or abstract the business logic away from the actual servlets themselves (always a good idea) and test those classes outside the context of a servlet framework.
    That limits the code that actually is impacted by being a servlet to the absolute minimum (essentially parameter passing).

Maybe you are looking for

  • Creation of Supplier Clearing List could not be finished

    Hello everyone, since a couple of months there is a problem while creating the supplier clearing list after receiving an ORDERS message. It seems that the flag SELFLAG in table /IDEXGE/SSCLISTA is not been set after creating the list items in table /

  • Alerts not getting Triggered for Integration Engine Error

    Hi, We are configuring Alert Framework in our project. Here when the scenario fails at communication channel we receive alerts but when it fails in message mapping we aren't getting any alerts. Below are the settings: Alert rule created with no restr

  • Download ALV to Desktop

    Hi All!   I have a Dialogue Program.In that I want to introduce a download button.Clicking on that button should allow me to download the ALV report to desktop in a excel sheet.     Secondly output in excel sheet should contain fields of ALV as well

  • SWCV assigned to Bus. System from SLD are not transferred to Int.Builder

    Hi guys, I am on PI7.11 and have currently stuck with the situation - Bus. System A has SWCVs assigned to it in the SLD. However, when opening the Business System as communication component in the Integration Bulder and going to the last tab "Other a

  • Can I have a UDA in POV or Page or row or column of a form?

    Hi, Can I have a UDA in POV or Page or row or column of a form?