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.

Similar Messages

  • Unit testing, integration and functional testing

    Hello all,
    I would like to know the difference between Unit testing, integration and functional testing. And also what are the testing tools that are more commonly used?
    Thanks,
    Maxx

    Hi,
        Unit testing :
                    A complete cycle of each  module will be tested
                    ie for PP Right from requirements to planned orders /production orders
                    confirmation .
        Integration testing:
                    Here cross module testing will be carried out.
                     ie PP and MM integration
                        After confirming production order a GR is made /billing is carried out
                        and delivered.
          Functional testing:
                    This testing is carried out to see whether the system can with stand l the loads during processing by users.
                    Stress test and volume test.
                Regards,
                nandha

  • Suggestions requested for Unit Testing process and build processes.

    Hi All,
    We are using WebLogic WorkShop 8.1 SP2 to build our WebApp. One thing I am trying
    to get together is a "Best Practises" list for aspects of WorkShop developement,
    particularly Unit Testing, Continous Build methodology, source control management
    etc.I have been through the "Best Practises Guide" that comes in WorkShop help,
    but it doesnt address these issues.This could help us all for future projects.
    1)Could anyone give pointers on how to perform Unit Testing using either JUnit/JUnitEE
    in the WorkShop realm, given that Controls cannot be accessed directly from PO
    Test classes.
    2)For a project of size say 5 developers ,does it make sense to have a nightly
    build using tools like CruiseControl?We use CVS for our source control and its
    working out pretty well, but given that we currently have no Unit Tests that can
    be run after the build and that can provide some reports on what broke/what didnt?
    I am sure we all would appreciate any suggestions and more questions on this topic.
    Thanks,
    Vik.

    Hi, Chris,
    can you perhaps explain your solution in greater detail. I am really curious to
    find a way to test controls.
    "Chris Pyrke" <[email protected]> wrote:
    >
    I have written (well it's a bit of a dirty hack really) something that
    lends itself
    to the name ControlTest (it unit tests controls). Its a blend of Junit
    and Cactus
    with some of the source of each brutalised a bit to get things to work
    (not much
    - it was a couple of hours work, when I was supposed to be doing something
    else).
    To write a control test you code something like...
    package com.liffe;
    import com.liffe.controlunit.ControlTestCase;
    import controls.Example;
    public class TestExample extends ControlTestCase
    private Example example = null;
    public void setUp() {
    example = (Example)getControl("example");
    public void testExample() {
    this.assertNotNull(example);
    String result = example.getData();
    assertEquals(result, "Happy as Larry");
    Other tasks required to set up a test are creating a web project with
    a jpf which
    needs some cut and paste code (14 lines) in its begin method and a jsp
    which is
    also cut and paste (5 lines). (ie create a standard web project and paste
    in 2
    pieces of code)
    In the web project you need to create a control (A) with an instance
    name of controlContainer.
    (if it's called something else the pasted in code will need changing
    to reflect)
    In this control you need to put an instance of TestContainerImpl and
    any controls
    that need testing.
    You then need to add a method to the control (A) that looks like…
    * @common:operation
    public String controlTestRun(String theSuiteClassName, boolean xsl)
    container.setControl("example", example);
    return container.controlTestRun(theSuiteClassName, xsl);
    You need to call container.setControl for each control being tested and
    the object
    'container' is the instance name of the TestContainerImpl that was put
    in.
    There are 4 jars (junit, cactus etc) that go in the library. You will
    also need
    the ControlUnitBase project (or maybe just it's jar).
    To use you call a URL like:
    http://localhost:7001/TestWeb/Controller.jpf?test=com.liffe.TestExample
    TestWeb is the name I gave to my web project - this will be different
    for each
    test project
    com.liffe.Example is the class above and will therefore be different
    for each
    test case.
    You can also call
    http://localhost:7001/TestWeb/Controller.jpf?test=com.liffe.TestExample&xsl=true
    (Note the extra &xsl=true) and the browser will (if it can) render it
    more prettily.
    This seems to do the job quite nicely, but there are several caveats
    I would hope
    someone from bea would be able to address before I start using it widely.
    1) To access the control you need to create it (eg as a subcontrol in
    the control
    (A) above.
    To get it into the test case you need to pass it round as an Object (can't
    return
    Control from a control operation). As it's being passed around among
    Java (POJO)
    classes I'm assuming that control remains in the control container context
    so
    this is OK. It seems to work and the Object is some form of proxy as
    any control
    seems to be reproxied before the control is invoked from the test case.
    2) If I'm testing controls called from a JPD then they either need to
    be in a
    control project (and my test cases called from a Web Project) which makes
    for
    a large increase in project numbers (we already have this and are trying
    to resist
    it) To avoid this - as a process project is a brain damaged web project
    I simply
    perform some brain surgery and augment the process project with some
    standard
    files found in any old web project. this means I can call the test JPF
    from a
    browser. This seems nasty, is there a better way?
    3) I would like to be able to deliver without the test code. At the worst
    the
    code can be in place but must be inacessible in a production environment.
    I don't
    know how best to do this - any suggestions (without creating lots of
    projects,
    or lots of manual effort)
    If anyone has read this far I would ask the question does this seem like
    the kind
    of thing that would be useful?
    Hopefully a future version of workshop will have something to enable
    unit testing
    and this hacking will be unnecessary.
    Could someone from BEA tell me if this is a dangerous way to do things?
    Chris
    "vik" <[email protected]> wrote:
    Hi All,
    We are using WebLogic WorkShop 8.1 SP2 to build our WebApp. One thing
    I am trying
    to get together is a "Best Practises" list for aspects of WorkShop developement,
    particularly Unit Testing, Continous Build methodology, source control
    management
    etc.I have been through the "Best Practises Guide" that comes in WorkShop
    help,
    but it doesnt address these issues.This could help us all for future
    projects.
    1)Could anyone give pointers on how to perform Unit Testing using either
    JUnit/JUnitEE
    in the WorkShop realm, given that Controls cannot be accessed directly
    from PO
    Test classes.
    2)For a project of size say 5 developers ,does it make sense to have
    a nightly
    build using tools like CruiseControl?We use CVS for our source control
    and its
    working out pretty well, but given that we currently have no Unit Tests
    that can
    be run after the build and that can provide some reports on what broke/what
    didnt?
    I am sure we all would appreciate any suggestions and more questions
    on this topic.
    Thanks,
    Vik.

  • Problem creating unit testing repository (and workaround)

    I tried to create the unit testing repository with a user that had all the required system privileges granted through a different role other than RESOURCE and CONNECT roles, and who wasn't explicitely granted CREATE VIEW, but inherited it through the custom role. However the check in SQL Developer is explicitely for the RESOURCE and CONNECT roles (regardless of what privileges they have granted to them in whichever database version past, present or future) and for CREATE VIEW privilege granted direct to the user:
    SELECT DECODE (roles.required_role_count + privs.required_priv_count,
                   3, 1,
                   0)
              AS basic_privs_granted
      FROM (SELECT COUNT (*) AS required_role_count
              FROM user_role_privs
             WHERE granted_role IN ('CONNECT', 'RESOURCE')) roles,
           (SELECT COUNT (*) AS required_priv_count
              FROM USER_SYS_PRIVS
             WHERE privilege IN ('CREATE VIEW')) privsI found this SQL contained within the sqldeveloper/extensions/oracle.sqldeveloper.unit_test.jar in an XML file: oracle/dbtools/unit_test/manage_user/UserSql.xml and replaced the SQL with one that actually checks for the specific system privileges:
    SELECT DECODE (required_sys_priv_count,
                   10, 1,
                   0)
              AS basic_privs_granted
      FROM
           (SELECT COUNT(*) AS required_sys_priv_count FROM
             (SELECT privilege
                FROM role_sys_privs
               WHERE privilege IN ('CREATE CLUSTER','CREATE INDEXTYPE','CREATE OPERATOR','CREATE PROCEDURE','CREATE SEQUENCE','CREATE SESSION','CREATE TABLE','CREATE TRIGGER','CREATE TYPE','CREATE VIEW')
              UNION
              SELECT privilege
                FROM user_sys_privs
               WHERE privilege IN ('CREATE CLUSTER','CREATE INDEXTYPE','CREATE OPERATOR','CREATE PROCEDURE','CREATE SEQUENCE','CREATE SESSION','CREATE TABLE','CREATE TRIGGER','CREATE TYPE','CREATE VIEW')))This enabled me to bypass that check when creating the respository. I don't know if all these privileges are actually required by the unit testing repository or not, so maybe the above list can be reduced...
    Edited by: RDB on Mar 1, 2013 2:24 PM

    Hi Sai Vineeth,
    First of all, I appreciate your elaborate way of framing the question. That itself helps others to comment.
    On the first two questions, I am sure you'll be able to follow the answers provided and take care of your concerns.
    On your question 3), an additional piece of information that should bring smile to you
    Whether the Test is to happen in DEV or QAS or whatever 'System Role' is dependent on the Test Plan.
    So, if you have two distinct Test Plans, one for Unit Tests and the other for Integration Tests, which should be the case, as usual, you can certainly point the System Role to DEV or QAS as required.
    Feel free to pose any other query as well.
    Best regards,
    Srini

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

  • Trouble w unit test code

    this code compiles fine, but my unit tests starting with the lines
    public static class AllTests extends TestCase {
    are failing with a null pointer exception. i was advised that
    '>
    The testCreateAccount is failing because you're using a local variable,newAccount,
    in the setUp method(), which has the same name as the class instance variable,newAccount.
    Since the testCreateAccount uses the class instance variable, it is null.
    protected void setUp() {
    anAccountServiceImpl = new AccountServiceImpl();
    AccountEntryStruct newAccount = new AccountEntryStruct();'-so i changed all instances of newAccount to newAccount2 in my unit tests (you
    will see towards
    the bottom of my code). it looks like the testCreateAccount method is still
    using a
    null value. i'm not sure if i'm following the advice correctly...
    code is below:
    // AccountServiceImpl.java: The AccountService Implementation
    package com.kafein.accountServices;
    import java.util.Hashtable;
    import java.util.Calendar;
    import java.util.GregorianCalendar;
    import junit.framework.TestCase;
    import junit.framework.Test;
    import junit.framework.TestSuite;
    import org.omg.PortableServer.*;
    import com.kafein.idl.accountServices.AccountServicePOA;
    import com.kafein.idl.accountServices.AccountEntryStruct;
    import com.kafein.idl.accountServices.AccountStruct;
    import com.kafein.idl.utilities.DateTimeStruct;
    import com.kafein.idl.exceptions.NotFoundException;
    import com.kafein.idl.exceptions.DataValidationException;
    import com.kafein.idl.errorCodes.DataValidationErrorCodes;
    import com.kafein.utils.ServiceHandler;
    import com.kafein.utils.Log;
    public class AccountServiceImpl extends AccountServicePOA {
    POA poa;
    private Hashtable accounts = new Hashtable(); // collection of Accounts
    private static int nextAccountID = 1; // global account ID
    * Construct an instance.
    public AccountServiceImpl(POA aPOA) {
    super();
    poa = aPOA;
    * Overloaded constructor for unit tests.
    protected AccountServiceImpl() {
    poa = null;
    * createAccount is used by administrator to add a new Account
    * in the system.
    * @param newAccount AccountEntryStruct containing data for new account
    * @return int the new unique Account ID
    * @exception com.kafein.idl.exceptions.DataValidationException
    public int createAccount(AccountEntryStruct newAccount) throws
    DataValidationException {
    validateData (newAccount); // throws DataValidationException;
    int accountID = getNextID();
    // Create new Account.
    Account anAccount = new Account(accountID,
    newAccount.userName,
    newAccount.userEmail,
    newAccount.creditCardType,
    newAccount.creditCardNumber,
    newAccount.creditCardExpirationDate.year,
    newAccount.creditCardExpirationDate.month,
    newAccount.userPassword,
    newAccount.initialBalance);
    accounts.put(accountID,anAccount);
    return accountID;
    * isAccountValid is used to validate a user logon.
    * @param accountID AccountID
    * @param userPassword String
    * @return boolean true to indicate an existing Account
    public boolean isValidAccount (int accountID, String userPassword) {
    // Get account with key equal to accountID.
    AccountStruct anAccount;
    try {
    anAccount = (AccountStruct) getAccount (accountID);
    catch (NotFoundException e) {
    return false;
    // Verify password.
    return (anAccount.userPassword.equals(userPassword) ? true : false);
    * getAccount is used to retrieve an existing Account in the system
    * @param int AccountID
    * @return AccountStruct containing data for the existing Account
    * @exception com.kafein.idl.exceptions.NotFoundException
    public AccountStruct getAccount(int accountID)throws
    NotFoundException {
    // Verify that accountID is within an appropriate interval.
    if (accountID < 1 || accountID > accounts.size()) {
    throw new NotFoundException(DataValidationErrorCodes.INVALID_ACCOUNT_ID,
    "Account ID not found");
    // Get Account and convert to AccountStruct (which is returned).
    Account anAccount = (Account) accounts.get(accountID);
    return anAccount.getAccountStruct();
    * getAllAccounts is used to retrieve all existing Accounts in the system
    * @return AccountStruct[] containing all existing Accounts.
    * @fyi returns an empty sequence if no Accounts exist
    public AccountStruct[] getAllAccounts() {
    // Allocate the array of AccountStructs.
    int lastKey = accounts.size();
    AccountStruct[] accountSequence = new AccountStruct[lastKey];
    if (lastKey==0) {
    return accountSequence;
    // DAR:Sort accounts by accountID (int).
    // Create AccountStructs from Accounts.
    for (int i = 1; i <= lastKey; i++) {
    Account anAccount = (Account) accounts.get(i);
    accountSequence[i-1] = anAccount.getAccountStruct();
    return accountSequence;
    * validateData is used to check new account data.
    * @param newAccount AccountEntryStruct containing data for new account
    * @exception com.kafein.idl.exceptions.DataValidationException
    protected void validateData(AccountEntryStruct newAccount) throws
    DataValidationException {
    // Check all of the member data in newAccount.
    if (newAccount.userName.equals("")) {
    throw new DataValidationException(
    DataValidationErrorCodes.INVALID_USER_NAME,
    "User Name must not be empty");
    if (newAccount.userEmail.equals("")) {
    throw new DataValidationException(
    DataValidationErrorCodes.INVALID_USER_EMAIL,
    "User Email must not be empty");
    if (newAccount.creditCardType.equals("")) {
    throw new DataValidationException(
    DataValidationErrorCodes.INVALID_CREDIT_CARD_TYPE,
    "Credit card type must not be empty");
    if (newAccount.creditCardNumber.equals("")) {
    throw new DataValidationException(
    DataValidationErrorCodes.INVALID_CREDIT_CARD_NUMBER,
    "Credit card number must not be empty");
    // Compare creditCardExpirationDate to current date
    // (we only consider year and month).
    GregorianCalendar now = new GregorianCalendar();
    DateTimeStruct proposed = newAccount.creditCardExpirationDate;
    if (proposed.year < now.get (Calendar.YEAR) ||
    (proposed.year == now.get (Calendar.YEAR) &&
    proposed.month < now.get (Calendar.MONTH) + 1)) {
    throw new DataValidationException(
    DataValidationErrorCodes.INVALID_CREDIT_CARD_EXPIRATION_DATE,
    "Credit card has expired");
    if (newAccount.userPassword.equals("")) {
    throw new DataValidationException(
    DataValidationErrorCodes.INVALID_USER_PASSWORD,
    "Password must not be empty");
    else if
    (!newAccount.userPassword.equals(newAccount.userPasswordVerification)) {
    throw new DataValidationException(
    DataValidationErrorCodes.INVALID_USER_PASSWORD,
    "Password verification failure");
    if (newAccount.initialBalance < 0.0F) {
    throw new DataValidationException(
    DataValidationErrorCodes.INVALID_BALANCE,
    "Account Balance cannot have a negative balance");
    * getNextID is used to generate a unique ID.
    * Needs a much better implementation that generates a globally unique ID!
    * @return int an Account ID
    protected synchronized int getNextID() {
    nextAccountID++;
    return nextAccountID - 1;
    * override defaultPOA to return this servant's POA, not Root POA
    public POA defaultPOA() {
    return poa;
    * AllTests is used for unit testing the AccountServiceImpl Class. It
    extends the
    * JUnit testing framework's TestCase class.
    * To execute in graphic mode:
    * java junit.swingui.TestRunner
    com.kafein.accountServices.AccountServiceImpl$AllTests
    * To execute in text mode:
    * java com.kafein.accountServices.AccountServiceImpl$AllTests
    public static class AllTests extends TestCase {
    private AccountServiceImpl anAccountServiceImpl;
    private Hashtable accounts = new Hashtable();
    private Account anAccount;
    private AccountEntryStruct newAccount2;
    public AllTests(String name) {
    super(name);
    protected void setUp() {
    anAccountServiceImpl = new AccountServiceImpl();
    AccountEntryStruct newAccount2 = new AccountEntryStruct();
    newAccount2.userName = "testName";
    newAccount2.userEmail = "test@email";
    newAccount2.creditCardType = "testCreditCardType";
    newAccount2.creditCardNumber = "0123456789";
    newAccount2.creditCardExpirationDate = new DateTimeStruct();
    newAccount2.creditCardExpirationDate.year = 2005;
    newAccount2.creditCardExpirationDate.month = 6;
    newAccount2.creditCardExpirationDate.day = -1; // not applicable data
    newAccount2.creditCardExpirationDate.hour = -1;
    newAccount2.creditCardExpirationDate.minute = -1;
    newAccount2.userPassword = "kafein";
    newAccount2.userPasswordVerification = "kafein";
    newAccount2.initialBalance = 0.0F;
    protected void tearDown() {
    public static void main (String[] args) {
    junit.textui.TestRunner.run(suite());
    public static Test suite() {
    return new TestSuite(AllTests.class);
    public void testGetAllAccountsSizeZero() {
    AccountStruct[] results =
    anAccountServiceImpl.getAllAccounts();
    assertTrue(results != null);
    assertTrue(results.length == 0);
    public void testCreateAccount() {
    try {
    int testAccountID = anAccountServiceImpl.createAccount(newAccount2);
    //fail(); // shouldn't get here
    assertTrue(testAccountID == 1);
    AccountStruct[] results = anAccountServiceImpl.getAllAccounts();
    assertTrue(results[0].userName.equals("testName"));
    assertTrue(anAccountServiceImpl.isValidAccount(1, "kafein"));
    } catch(DataValidationException e) {
    public void testGetAllAccounts() {
    AccountStruct[] results = anAccountServiceImpl.getAllAccounts();
    assertTrue(results[0].userName.equals("testName"));
    public void testIsValidAccount() {
    assertTrue(anAccountServiceImpl.isValidAccount(1, "kafein"));
    }

    thanks again all
    my code now looks like
            public static class AllTests extends TestCase {
              private AccountServiceImpl anAccountServiceImpl;
              private Hashtable accounts = new Hashtable();
              private Account anAccount;
              private AccountEntryStruct newAccount2;
              public AllTests(String name) {
                            super(name);
                    protected void setUp() {
              anAccountServiceImpl = new AccountServiceImpl();
              newAccount2 = new AccountEntryStruct();
              newAccount2.userName = "testName";
                    newAccount2.userEmail = "test@email";
                    newAccount2.creditCardType = "testCreditCardType";
                   newAccount2.creditCardNumber = "0123456789";
                    newAccount2.creditCardExpirationDate = new DateTimeStruct();
                    newAccount2.creditCardExpirationDate.year = 2005;
                    newAccount2.creditCardExpirationDate.month = 6;
                    newAccount2.creditCardExpirationDate.day = -1; // not applicable data
                    newAccount2.creditCardExpirationDate.hour = -1;
                    newAccount2.creditCardExpirationDate.minute = -1;
                    newAccount2.userPassword = "kafein";
                    newAccount2.userPasswordVerification = "kafein";
                    newAccount2.initialBalance = 0.0F;
                    protected void tearDown() {
                    public static void main (String[] args) {
                            junit.textui.TestRunner.run(suite());
                    public static Test suite() {
                            return new TestSuite(AllTests.class);
              public void testGetAllAccountsSizeZero() {
                        AccountStruct[] results = anAccountServiceImpl.getAllAccounts();
                        assertTrue(results != null);
                        assertTrue(results.length == 0);
                    public void testCreateAccount() {
                    try {
              int testAccountID = anAccountServiceImpl.createAccount(newAccount2);
              assertTrue(testAccountID == 1);
              AccountStruct[] results = anAccountServiceImpl.getAllAccounts();
              assertTrue(results[0].userName.equals("testName"));
              assertTrue(anAccountServiceImpl.isValidAccount(1, "kafein"));
                      //fail(); // shouldn't get here
              } catch(DataValidationException e) {
                    public void testGetAllAccounts() {
              AccountStruct[] results = anAccountServiceImpl.getAllAccounts();
              assertTrue(results[0].userName.equals("testName"));
                    public void testIsValidAccount() {
              assertTrue(anAccountServiceImpl.isValidAccount(1, "kafein"));
    }-it compiles cleanly. unit tests testGetAllAccounts() and testIsValidAccount() are failing still, however. i'm not sure how to initialize the struct outside of the setUp method and have the struct be available to methods outside of setUp()

  • 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  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 packages in sql developer

    It appears that the specify parameters window is blank for packaged functions which means the test call fails when run. Is this a grant or synonym issue ( or something similar ) or is there an issue with testing packages via the unit test interface of sql developer. Thanks in advance.

    Seems that you cannot right click on the packaged schema object from the schema connection i.e. you have to create the test from the unit test tab and then choose the object type i.e select packages and then the packaged function or procedure. This method results in the Specify Parameters window having the correct signature displayed. Procedures or methods can be created via the unit test tab or the active connection tab.

  • Custom Infotype not visible in Unit Testing Client

    I created Infotype in client 110.I can see IT 9000 in Development client 110.But It is not in the client 120 which is Unit test client.I think Infotypes are client independent....Then why can not I see in client 120.

    Hi,
    I guess you are refering to the client of the same server....
    Since the infotypes are not client independent , you have to go to transaction
    SCC1 of unit testing client and copy both customizing and workbench request.
    After this you can view the infotype.
    Have Fun!!
    Ira!!

  • Hi Experts, questions about abap unit test(abap oo)?

    Hi Experts,
    I am learning abap unit test, could you please tell me some info about how I can test the performance of some specific code in my program? can abap unit test do this kind of job? and could you please tell me what I can do using abap unit test? and some classic examples are appreciated, thanks in advance!
    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

  • EDQ Test planning and recording

    Hi,
    I'm working on a data deduplication and matching project using EDQ. We need to document our unit test plans and evidence. EDQ allows easy manual checking of dataflows but I don't want to waste time taking screen grabs and producing unwieldy documents. Are there any test planning or test automation tools that we can use? Failing that is it possible to export the results and evidence that each function has worked? If neither of these are options can i ask how others capture unit test evidence?
    Thanks
    Jason

    Actually, we are running Analyzer and Essbase on the same server and reports on a seperate server. I inherited the Essbase/Analyzer configuration and since it is working well, I'm not looking to mess with it. Reports worked out well because we had just decommissioned a server that was running SpiderMan (Hyperion Enterprise Web tool) when we took Spiderman down, it freed up a perfectly good server which was already configured for Internet access. The install of reports was smoother than we could have hoped for.oh, and we do not have planning..Still using Pillar.

  • Mocking Oracle database in unit-tests

    In need to write unit tests that uses old node-oracle library and I am looking for options to run tests w/o real database.
    Is there in-memory fake database implementations (such as mockcouch for CouchDB or TingoDB for MongoDB)?
    Is there real world success stories to use Sinon.Js to mock database?
    Should I now rewrite modules to use with current supported library to make this 2 options available or better/simpler implemented?
    Should I not write unit-tests now and wait until options 1) and 2) available are?

    In need to write unit tests that uses old node-oracle library and I am looking for options to run tests w/o real database.
    Is there in-memory fake database implementations (such as mockcouch for CouchDB or TingoDB for MongoDB)?
    Is there real world success stories to use Sinon.Js to mock database?
    Should I now rewrite modules to use with current supported library to make this 2 options available or better/simpler implemented?
    Should I not write unit-tests now and wait until options 1) and 2) available are?

  • [svn] 2768: sanity and error tests have been moved to asc/test/compiler/ and now use the runtests.py script to execute

    Revision: 2768
    Author: [email protected]
    Date: 2008-08-06 14:28:35 -0700 (Wed, 06 Aug 2008)
    Log Message:
    sanity and error tests have been moved to asc/test/compiler/ and now use the runtests.py script to execute
    Removed Paths:
    flex/sdk/trunk/modules/asc/test/errors-and-warnings/
    flex/sdk/trunk/modules/asc/test/sanity/

    Answered myself. JUst named the imput fields incorrectly.
    Couple of other problems also but sorted and now working
    fine...

  • I have question about null and undefined?

    I tested null and undefined all single character.
    I saw abnormal result
    /* test code */
    var A:String
    var Z:String
    var a:String
    var z:String
    trace("A: " + A);
    trace("Z: " + Z);
    trace("");
    trace("a: " + a);
    trace("z: " + z);
    /* End of test code */
    I tested this code on Flash 8.
    /* result */
    A: undefined
    Z: undefined
    a: undefined
    n: undefined
    o: null
    p: undefined
    z: undefined
    /* End of result */
    Only 'o' make different result.
    It is same result on Flash Player 8 and Flash Player 9.
    Please, tell me why.
    Thanks
    /* code generation code */
    type = "String"; //Number, Movieclipe ...
    for (i = 65; i < 91; i++)
    trace("var " + String.fromCharCode(i) + ":" + type);
    trace("");
    for (i = 97; i < 123; i++)
    trace("var " + String.fromCharCode(i) + ":" + type);
    trace("");
    for (i = 65; i < 91; i++)
    trace("trace(\"" + String.fromCharCode(i) + ": \" + " +
    String.fromCharCode(i) + ");");
    trace("trace(\"\");");
    for (i = 97; i < 123; i++)
    trace("trace(\"" + String.fromCharCode(i) + ": \" + " +
    String.fromCharCode(i) + ");");
    /* End of code generation code */

    kyduke,
    > I tested null and undefined all single character.
    > I saw abnormal result
    I can't reproduce your results. I used the exactl block of
    code you
    designated as ...
    /* code generation code */
    ... and all my trace() results are consistent.
    David Stiller
    Adobe Community Expert
    Dev blog,
    http://www.quip.net/blog/
    "Luck is the residue of good design."

Maybe you are looking for