Thursday, February 18, 2010

WHAT IS BREW?


BREW (Binary Runtime Environment for Wireless) is Qualcomm's open source application development platform for wireless devices equipped for code division multiple access (CDMA) technology. BREW makes it possible for developers to create portable applications that will work on any handsets equipped with CDMA chipsets. Because BREW runs in between the application and the chip operating system software, the application can use the device's functionality without the developer needing to code to the system interface or even having to understand wireless applications. Users can download applications - such as text chat, enhanced e-mail, location positioning, games (both online and offline), and Internet radio - from carrier networks to any BREW-enabled phone.
BREW is competing for wireless software market share with J2ME(Java 2 Micro Edition), a similar platform from Sun Microsystems. The initial version of BREW is solely for CDMA networks; later versions could be enabled for time division multiple access (TDMA) and Global System for Mobile Communication (GSM) networks

Wednesday, February 17, 2010

Wednesday, February 10, 2010

SIP Communication Example


SIP Communication Example

In this section a call will be analyzed in detail. In a SIP call there are several SIP transactions. A SIP transaction consists of several requests and answers and the way to group them in the same transaction is by means of CSeq parameter.
User AProxyUser B
- The first step is the user register. The users must register themselves to be found by other users. In this case, the terminals send a REGISTER request, where the fields "from" and "to" correspond to the registered user. The Proxy server, who acts as Register, consults if the user can be authenticated and sends an OK message if there is no problem.

-The following transaction corresponds to a session establishment. This session consists of an INVITE request of the user to the proxy. Immediately, the proxy sends a TRYING 100 to stop the broadcastings and reroute the request to the B user. The B user sends a Ringing 180 when the telephone begins to ring and it is also reroute by the proxy to the A user. Finally, the OK 200 message corresponds to the accept process (the user B response the call).

-At this moment the call is established, and the RTP transport protocol starts with the parameters (ports, addresses, codecs, etc.) of the SDP protocol.

-The last transaction corresponds to a session end . This is carried out with an only BYE request to the Proxy, and later reroute to the B user. This user replies with an OK 200 message to confirm that the final message has been received correctly.

Very useful link-
http://www.docs.hp.com/en/5992-4080/ch01s05.html

http://toncar.cz/Tutorials/VoIP/VoIP_Protocols_SIP_Messages.html

TEST STRATEGY VS TEST PLAN

Test Strategy:
It is a company level document and developed by QA category people like QA and PM. This document defines "Testing Approach" to achieve testing objective. Test strategy is the freezed part of BRS from which we get Test Policy and Test Strategy.

Components in the Test Strategy are as follows:
1. Scope and objective
2. Business issues
3. Roles and responsibilities
4. Communication and status reporting
5. Test deliverability
6. Test approach
7. Test automation and tools
8. Testing measurements and metrices
9. Risks and mitigation
10. Defect reporting and tracking
11. Change and configuration management
12. Training plan

Test Plan:
Test plan is the freezed document developed from SRS, FS, UC. After completion of testing team formation and risk analysis, Test Lead is preparing test plan document in term of what to test, how to test, who to test, and when to test.
There is one Master Test Plan consists of reviewed Project Test Plan and Phase Test Plan. so there is general talk about Project Test Plan.
Components are as follows:

1. Test Plan id
2. Introduction
3. Test items
4. Features to be tested
5. Features not to be tested
6. Approach
7. Testing tasks
8. Suspension criteria
9. Features pass or fail criteria
10. Test environment (Entry criteria, Exit criteria)
11. Test delivarables
12. Staff and training needs
13. Responsibilities
14. Schedule
15. Risk and mitigation
16. Approach

This is one of the standard approach to prepare test plan document, but things can vary company-to-company.



A Test Plan describes the approach, Features to be tested, Testers assigned, and whatever you plan for your project. A Test Plan is usually prepared by Manager or Team Lead. That is true but not exclusively. It depends on what the test plan is intended for. Some companies have defined a test plan as being what most would consider a test case. Meaning that it is for one part of the functionality validation.

A strategy is how you are going to address testing for the project. Some companies have a strategy or approach section in the test plan, others have a seperate document.

In some companies a general strategy document is created. This outlines what is expected/advised (depending the companies policy) to do. The test plan documents at this moment are based on the organizational strategy and as such are more light weight. 

Monday, February 1, 2010

puts() Vs fputs()


Write string to stdout puts():
Writes the C string pointed by str to stdout and appends a newline character ('\n').
The function begins copying from the address specified (str) until it reaches the terminating null character ('\0'). This final null-character is not copied to stdout.

Using fputs(str,stdout) instead, performs the same operation as puts(str) but without appending the newline character at the end.

/* puts example : hello world! */
#include 

int main ()
{
  char string [] = "Hello world!";
  puts (string);
}

Return Value

On success, a non-negative value is returned.
On error, the function returns EOF.


Write string to stream fputs():
Writes the string pointed by str to the stream.
The function begins copying from the address specified (str) until it reaches the terminating null character ('\0'). This final null-character is not copied to the stream.
/* fputs example */
#include < stdio.h >

int main ()
{
   FILE * pFile;
   char sentence [256];

   printf ("Enter sentence to append: ");
   fgets (sentence,255,stdin);
   pFile = fopen ("mylog.txt","a");
   fputs (sentence,pFile);
   fclose (pFile);
   return 0;
}

Return Value

On success, a non-negative value is returned. On error, the function returns EOF.


gets() Vs fgets()


Get string from stdin
Reads characters from stdin and stores them as a string into str until a newline character ('\n') or the End-of-File is reached.
The ending newline character ('\n') is not included in the string.
A null character ('\0') is automatically appended after the last character copied to str to signal the end of the C string.
Notice that gets does not behave exactly as fgets does with stdin as argument: First, the ending newline character is not included with gets while with fgets it is. And second, gets does not let you specify a limit on how many characters are to be read, so you must be careful with the size of the array pointed by str to avoid buffer overflows.

Return Value

On success, the function returns the same str parameter.
If the End-of-File is encountered and no characters have been read, the contents of str remain unchanged and a null pointer is returnes.
If an error occurs, a null pointer is returned.
Use either ferror or feof to check whether an error happened or the End-of-File was reached.

/* gets example */
#include < stdio.h >

int main()
{
  char string [256];
  printf ("Insert your full address: ");
  gets (string);
  printf ("Your address is: %s\n",string);
  return 0;
}

fgets():
Reads characters from stream and stores them as a C string into str until (num-1) characters have been read or either a newline or a the End-of-File is reached, whichever comes first. A newline character makes fgets stop reading, but it is considered a valid character and therefore it is included in the string copied to str. A null character is automatically appended in str after the characters read to signal the end of the C string.

Return Value

On success, a non-negative value is returned. On error, the function returns EOF.
/* fgets exmaple */
#include < stdio.h >

int main()
{
   FILE * pFile;
   char mystring [100];

   pFile = fopen ("myfile.txt" , "r");
   if (pFile == NULL) perror ("Error opening file");
   else {
     fgets (mystring , 100 , pFile);
     puts (mystring);
     fclose (pFile);
   }
   return 0;
}

EXCEPTION HANDLING C++

Exceptions provide a way to react to exceptional circumstances (like runtime errors) in our program by transferring control to special functions called handlers.

To catch exceptions we must place a portion of code under exception inspection. This is done by enclosing that portion of code in a try block. When an exceptional circumstance arises within that block, an exception is thrown that transfers the control to the exception handler. If no exception is thrown, the code continues normally and all handlers are ignored.





NOTE: While handling derived class exception its required to first catch the derived class object before the base class otherwise the code under the derived class catch will never be executed.


Example:


#include < iostream >
using namespace std;


class B{
};


class D: public B {
};


int main()
{
 D derived;
 try {
 throw derived;
 }
 catch ( B b) {
cout<< "caught a base exception";
}
catch (D d) {
cout << "caught a derived exception";
}
return 0;
}


Here the catch(D d) will never be executed as the exception will flow to the catch(B b).


A exception is thrown by using the throw keyword from inside the try block. Exception handlers are declared with the keyword catch, which must be placed immediately after the try block:



Example



// exceptions
#include < iostream >
using namespace std;

int main () {
  try
  {
    throw 20;
  }
  catch (int e)
  {
    cout << "An exception occurred. Exception Nr. " << e << endl;
  }
  return 0;
}


For example, if we use the operator new and the memory cannot be allocated, an exception of type bad_alloc is thrown:



try
{
  int * myarray= new int[1000];
}
catch (bad_alloc&)
{
  cout << "Error allocating memory." << endl;
}


Because bad_alloc is derived from the standard base class exception, we can handle that same exception by catching references to the exception class:



// bad_alloc standard exception
#include < iostream >
#include < exception >
using namespace std;

int main () {
  try
  {
    int* myarray= new int[1000];
  }
  catch (exception& e)
  {
    cout << "Standard exception: " << e.what() << endl;
  }
  return 0;
}



In real world scenario we mostly have an exception class, which tells what the exception is.

Example:

#include < iostream >
#include < cstring >
using namespace std;

class MyException{

public:
char str_what[80];
int what;
MyException{
*str_what = 0;
what=0;
}
MyException(char *s, int i){
strcpy(str_what, s);
what = i;
}
};
int main()
{
int i;
try {
cout << "Enter a positive number:  ";
cin >> i;
if(i<0)
throw MyException("Not Positive",i);
}
catch (MyException e){
cout<< e.str_what << " : ";
cout<<  e.what << "\n";
}
return 0;
}
If Enter a positive number: -4
Not Positive: -4