Thursday, February 28, 2019

What is mean by immutable object/class?
Assume we have a below class A as mutable:
Class A{
int i = 10;
int j = 20;

A a = new A();
}



a.i = 30;
a.j = 40;

Changing state of objects, so A is mutable.

Immutable: once object is created, we cannot change the content of the object.

String str = "Venu" -> We ca not change the state of str because string is immutable
str.concate("gopal) -> Creates a new object with modified content
s.o.p (str) = Venu

If asign ablove concatenate operation to a string s and print s then
String s = str.concate("gopal) ==> Venugopal

Why String is immutable in Java?

What is SCP:
The Java string constant pool is an area in heap memory where Java stores literal string values. The heap is an area of memory used for run-time operations.

String str = "Venu"

Class Student{
String str = "Venu"
String str1 = "Venu"
String str2 = "Venu"
Str2.concate("gopal")
}

line1: Whenever create using string leteral, an Object is created inside SCP with the contant "Venu"
line2: Creating same as string literal, which is already available with the same contant in SCP so a new reference is point out to existing the object.
(Duplicates are not allowed in SCP)
line3: Same happens as happened in line 2.

How SCP helps for memory optimization:
Suppose we have 10,000 students with same name, 10,000 objects will be created inside the memory, performance will be reduced.
We should not create a more objects, SCP has been implemented inside JVM it will create once object referece to same object if trying to create with the same name.

 Str2.concate("gopal") -> instead it point of str2, creates new object in Heap area as we are going some runtime operation. (Note: str, str1 also get effected if strings are mutable)


String s1 = new String("Venu") -> new keyword always creates a new object in Heap memory.

But, if we want to restrict to create a new object and retrieving same object which is created with the String literal then we can use intern() method.
if(str == s1){
True;
}

String intern():
is method in String class. It returns a canonical representation for the string object.
When the intern() method is invoked on a String object it looks the string contained by this String object in the pool, if the string is found there then the string from the pool is returned. Otherwise, this String object is added to the pool and a reference to this String object is returned.

Note: Java automatically interns all Strings by default.

Sunday, February 10, 2019

Software Testing Life Cycle:
Below is the summary of STLC along with Entry and Exit Criteria: Following phases are involved in STLC:
  1. Requirement Analysis
  2. Test Planning
  3. Test case development
  4. Test Environment setup
  5. Test Execution
  6. Test Cycle closure
1. Requirement Analysis:
  • Entry Criteria: 
      • Requirements Document available (both functional and non functional)
      • Application architectural document available
  • Activity:
      • Analyze business functionality to know the business modules and module specific functionalities.
      • Identify types of tests to be performed
      • Prepare Requirement Traceability Matrix (RTM).
      • Identify test environment details where testing is supposed to be carried out.
      • Automation feasibility analysis (if required).
  • Exit Criteria: 
      • Signed off RTM
      • Test automation feasibility report signed off by the client
  • Deliverables: RTM, Automation feasibility report (if applicable)
2. Test Planning:
  • Entry Criteria: 
      • Requirements Documents
      • Requirement Traceability matrix.
      • Test automation feasibility document.
  • Activity:
      • Preparation of test plan/strategy document for various types of testing
      • Test tool selection
      • Test effort estimation
      • Resource planning and determining roles and responsibilities.
  • Exit Criteria:
      • Approved test plan/strategy document.
      • Effort estimation document signed off.
  • Deleverables:
      • Test plan/strategy document., 
      • Effort estimation document.
3. Test Case Development:
  • Entry Criteria: 
      • Requirements Documents
      • RTM and test plan
      • Automation analysis report
  • Activity:
      • Create test cases, automation scripts (where applicable)
      • Review and baseline test cases and scripts
      • Create test data
  • Exit Criteria:
      • Reviewed and signed test Cases/scripts
      • Reviewed and signed test data
  • Deleverables: Test cases/scripts, Test data
4. Test Environment SetUp:
  • Entry Criteria: System design document and Environment set-up plan
  • Activity:
      • Prepare hardware and software requirement list
      • Setup test Environment and test data
      • Perform smoke test on the build
      • Accept/reject the build depending on smoke test result
  • Exit Criteria: 
      • Environment setup is working as per the plan and checklist
      • Test data setup is complete
      • Smoke test is successful
  • Deleverables: Environment ready with test data set up, Smoke Test Results.
5. Test Execution:
  • Entry Criteria: 
      • Baselined RTM, Test Plan, Test case/scripts are available
      • Test environment is ready
      • Test data set up is done
      • Unit/Integration test report for the build to be tested is available
  • Activity: 
      • Execute tests as per plan
      • Document test results, and log defects for failed cases
      • Update test plans/test cases, if necessary
      • Map defects to test cases in RTM
      • Retest the defect fixes
      • Regression testing of application
      • Track the defects to closure
  • Exit Criteria:
      • All tests planned are executed
      • Defects logged and tracked to closure
  • Deleverables:
      • Completed RTM with execution status
      • Test cases updated with results
      • Defect reports
6. Test Cycle Closure:
  • Entry Criteria: 
      • Testing has been completed
      • Test results are available
      • Defect logs are available
  • Activity:
      • Evaluate cycle completion criteria based on - Time, Test coverage, Cost, Software Quality, Critical Business Objectives
      • Prepare test metrics based on the above parameters.
      • Prepare Test closure report
  • Exit Criteria: Test Closure report signed off by client
  • Deleverables: Test Closure report, Test metrics

Sunday, February 3, 2019

Difference between BufferedReader and Scanner:
  1. It can parse the user input and read an int, short, byte, float, long and double apart from String. On the other hand, BufferedReader can only read String in Java.
  2. BuffredReader has a significantly large buffer (8KB) than Scanner (1KB), which means if you are reading long String from a file, you should use BufferedReader but for short input and input other than String, you can use Scanner class.
  3. BufferedReader is older than Scanner. It's present in Java from JDK 1.1 onward but Scanner is only introduced in JDK 1.5 release
  4. Scanner uses regular expression to read and parse text input. It can accept custom delimiter and parse text into primitive data type. While, BufferedReader  can only read and store String using readLine() method.
  5. Another major difference between BufferedReader and Scanner class is that BufferedReader is synchronized while Scanner is not. This means, you cannot share Scanner between multiple threads but you can share the BufferedReader object.

selenium-repo by venu

Blog helps to a student or IT employee to develop or improve skills in Software Testing.
For Online Classes Email us: gadiparthi122@mail.com

Followers

About Me

My photo
Hyderabad, Andhra Pradesh, India
I am Automation Testing Professional. I have completed my graduation in B.Tech (Computers) from JNTU Hyderabad and started my career in Software Testing accidentally since then, I passionate on learning new technologies

Contact Form

Name

Email *

Message *

Popular Posts