Codechef4u is a community for computer professionals,by computer professionals,just like you; who loves sharing and helping each others,Join them
Share your post

Functional Testing

In this tutorial I will explain functional testing with sample example.

Definition:

Functional testing means testing the application against business requirements, client requirements.

In Detail:

Functional Testing:

  •     is a quality assurance (QA) process
  •     is the testing technique which used to test features
  •     It test functioning of the system / software

Example:

The registered user should be able to login to the Leave web application, only admin users
Has access for administration panel. General user can only apply for leave and check their leave details.
Master users (Manager) can approve/reject general users (Employee) leaves.

 

The functions are described in the FRS or SRS documents

Major Functional Testing Techniques are:

1. Unit Testing 
2. Integration Testing
3. System Testing  
4. Regression Testing
5. Acceptance Testing
6. Smoke Testing
7. Sanity Testing
8. Exploratory Testing 
9. Ad hoc Testing
10. Localization Testing
11. Interface Testing
12. Usability Testing
13. Globalization Testing          

    Unsafe Keyword

    Can we use pointer in C# this question frequently asked by beginner level C# programmer, yes there are some situations we require that.

    The unsafe keyword denotes an unsafe context, which is required for any operation involving pointers.

    Pointers in C# we use with below situations:

    1. Dealing with existing structures on disk
    2.  Advanced COM or Platform Invoke scenarios that involve structures with pointers in them
    3. Performance-critical code

    Frequently this is used with unmanaged code in C# , for example you want to write code for image data.

    Syntax:

    unsafe
    {
     
    // unsafe context: can use here unmanaged code  or pointer code.
     
    }

    Method:

    unsafe static void sammpleMethod(unmanaged paramter 1,unmanaged parameter2,unmanaged paramter n..)
    {
       // Unsafe context: can use pointers here.
    }

    Example:

    namespace UnsafeExample
    {
       class Program
       {
          public static void Main()
          {
             unsafe
             {
                int var = 50;
                int* p = &var;
                Console.WriteLine("value is: {0} " , var);
                Console.WriteLine("value is: {0} " , p->ToString());
                Console.WriteLine("Address is: {0} " , (int)p);
             }
            
             Console.ReadKey();
          }
       }
    }

    Example with block:

     unsafe
    {
        // whole block code is considered as unsafe
        BitmapData bmData = testbm.LockBits(...)
        byte *bits = (byte*)pixels.ToPointer();
        // Do stuff with bits
    }
            }

    Interface in Detail

    An interface looks like a class which contains only the declaration of methods, properties, events or indexers and has no implementation for any member.

    Class or structure that implements interface must implement all interface members.

    An interface can be member of class and namespace and interface has below members:

         a.      Methods
    b.      Properties
    c.       Indexers
    d.      Events

    Points To Remember:

    1. Interface members cannot have any access modifiers even public, default access specifiers is public.

    2. An interface can extend another interface.

    3. Interface has no implementation for any member.

    4. Interface contains only Methods, Properties, Indexers, delegates and events signature.

    5. A class or structure can implement more than one interface.

    6. Interface cannot be instantiated but it can be referenced by the class object which implements it.

    i.e  ICollage collageInfo=new student();

    7. In C# multiple inheritance is possible with interface, an interface can inherit from one or more base interfaces.


    Interface Example:

    public interface ICollage

        {

            // Property declaration:

            string Name

            {

                get;

                set;

            }

     

            void GetCollageInfo();

        }

    Implementation:

    public class student : ICollage

       {

          public static int numberOfStudents;

     

          private string name;

          public string Name  // read-write instance property

          {

             get

             {

                return name;

             }

             set

             {

                name = value;

             }

          }

     

          private int counter;

          public int Counter  // read-only instance property

          {

             get

             {

                return counter;

             }

          }

     

          public student()  // constructor

          {

             counter = ++counter + numberOfStudents;

          }

     

          public void GetCollageInfo()

          {

             Console.Write("Engineering collage");

          }

       }

     

    Multiple inheritances Example with interface:

        public interface ICollage

        {

            void GetCollageInfo();

        }

     

     

    public partial class Teacher

        {

            public static int numberOfTeachers;

     

            private int counter;

            public int Counter  // read-only instance property

            {

               get

               {

                  return counter;

               }

            }

     

            public Teacher()  // constructor

            {

                counter = ++counter + numberOfTeachers;

            }

        }

     

     

    public class student :Teacher,ICollage

       {

        

          public void DiaplyStudentData()

          {

            Console.WriteLine("i am Nagnath Kendre");

             GetCollageInfo();

          }

     

          public void GetCollageInfo()

          {

             Console.Write("Engineering collage");

          }

     

          static void main()

          {

             student collageInfo = new student();

             Teacher techerDetails =new Teacher();

             collageInfo.DiaplyStudentData();

          }

     

       }