• Like


Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

RIA 05 - Unit Testing by Ajinkya Prabhune


guest presentation

guest presentation

Published in Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Unit Testing
    By AjinkyaPrabhune
  • 2. What is Unit Testing ?
    When to use Unit Testing ?
    How to write Unit Test ?
    FrameWorks Examples.
  • 3. The primary goal of unit testing is to take the smallest piece of testable software in the application, isolate it from the remainder of the code, and determine whether it behaves exactly as you expect.
    Good Definition for Unit Test- (define later)
    Unit Test is an automated piece of code that invokes the method or class being tested and then check some assumption about the logical behavior of that Method/Class. Unit Test is almost always written using a Unit Testing Framework. It can be written easily & runs quickly.
    It is fully automated, trustworthy, readable and maintainable.
    What is Unit Testing
  • 4. Assume we have a Addition class that we’d like to test.
    We can now create a simple test class which will call this method.
    MathOperation operation = new MathOperation();
    value = 7 should be expected for a successful Test.
    public class MathOperation
    public int Addition(int a, int b)
    if(a==null || b==null)
    System.Out.Println(“Null value occured”)
    return -1;
    return a+b;
  • 5. 1 . It helps you write better Code.
    In addition to finding errors in your code, unit testing can help you during the initial development of your class or module's public interface.
    Unit tests force you to think about how another developer will want to use your code while you're writing that code.
    2. Writing test cases will save you time later.
    3. Unit tests provide immediate feedback on your code.
    You don't have to wait until after code in a separate part of the application is written before you can test and know whether your code works.
    4. Unit Tests should be written at each stage of development of your code.
    so that continuous check of your code is maintained and saves you efforts during the final release of the software.
    Why/When to use Unit Test.
  • 6. The Tests should be Through.
    1. You should only be satisfied with your unit tests when
    you’re confident that your unit tests thoroughly verify that
    your code works as we expect it to work.
    2. Unit tests should exercise the expected as well as the
    unexpected conditions in your code.
    3. Special attention should be paid to areas of code that are
    particularly likely to break.
    How to write Unit test ?
  • 7. The Test should be Repeatable.
    1. Every one of your unit tests should be able to be
    run repeatedly and continue to produce the same
    results, regardless of the environment in which the
    tests are being run.
    2. Your unit tests should not rely on hard-coded
    server urls.
    3. Unit tests must be written in either a sandbox org
    or in a developer org.
  • 8. The Test should be Independent
    1. Your unit tests should only test one aspect of your code at a time, so that it is easy to understand the purpose of each unit test. Properly written, and well-decomposed unit tests are an excellent source of documentation.
    2. Each Test should be independent of the other Test.
  • 9. Junit – JAVA
    Nunit- .Net
    FrameWorks of Unit Testing
  • 10. Thank you