Archive

Archive for March, 2015

What is Waterfall model ?

It was the first model of tests, is simple to understand and linear-sequential. You can use the waterfall model when the requirements are very well known, clear and fixed; Product definition is stable; No changes in the scope; You understood the technology; There are no ambiguous requirements; Resources with required expertise are available freely; Project is short.

In Royce’s original waterfall model, the following phases are followed in order:

1- Requirements specification resulting in the product requirements document
2- Design resulting in the software architecture
3- Construction (implementation or coding) resulting in the actual software
4- Integration
5- Testing and debugging
6- Installation
7- Maintenance

Model:

 

 

Iterative vs. waterfall
One of the differences between agile and waterfall is that testing of the software is conducted at different stages during the software development life-cycle. In the Waterfall model, there is always a separate testing phase near the completion of an implementation phase. However, in agile development and especially extreme programming, testing is usually done concurrently with coding, or at least, testing jobs start in the early days of iteration.

Advantages?

– This model is simple and easy to understand and use.
– It is easy to manage due to the rigidity of the model – each phase has specific deliverables and a review process.
– In this model phases are processed and completed one at a time. Phases do not overlap.
– Waterfall model works well for smaller projects where requirements are very well understood.

Disadvantages?

– Once an application is in the testing stage, it is very difficult to go back and change something that was not well-thought out in the concept stage.
– No working software is produced until late during the life cycle.
– High amounts of risk and uncertainty.
– Not a good model for complex and object-oriented projects.
– Poor model for long and ongoing projects.
– Not suitable for the projects where requirements are at a moderate to high risk of changing.

Sources: http://istqbexamcertification.com/what-is-waterfall-model-advantages-disadvantages-and-when-to-use-it/

http://en.wikipedia.org/wiki/Agile_software_development#Iterative_vs._waterfall

http://en.wikipedia.org/wiki/Waterfall_model

http://www.agilenutshell.com/agile_vs_waterfall

Advertisements

Create xml with shell script

Hi guys,

Today I will post a shell script that I am using to test a webservice. If you need a xml to test the performance of the server/webservice with Jmeter or if you just need generate a lot of xmls to make any type of test, this example can be useful.

In this code you can generate xmls and change some tags as id, date, etc…

#!/bin/bash
# Written by rafazzevedo
# http://www.azevedorafaela.wordpress.com

defaultpath="/User/" #Change this for the path where you want the files stay

echo "What do you want generate ?"
read element

echo "How many files ?"
read filescount
#Creating the subdirectory for each element and removing the existing folder
if [ ! -d $element ]
then
mkdir "$element"
else
rm -r "$element"
mkdir "$element"
fi

defaultpath=$defaultpath$element/

dateformat=$(date +"%m/%d/%YT%H:%M:%S")

for (( i=0;i<$filescount;i++ )) do

exec 3>temp.xml #Creating temporary file

#HEADER (Common for all xmls)
echo '&3'
echo ' xmlns:cpi="http://xml.wordpress.co.uk/types" >' >&3
echo " http://localhost:9999/$element$i" >&3
echo ' Title' >&3
echo " $dateformat" >&3
echo ' ' >&3
echo ' Rafaela Azevedo' >&3
echo ' http://wordpress.com/img.png' >&3
echo ' rafazzevedo@gmail.co.uk' >&3
echo " " >&3

#SPECIFIC TAGS OF EACH ELEMENT
case $element in

'article')
echo ' Content Test' >&3
echo ' ' >&3
;;

'image')
echo '' >&3
echo ' http://weather.gov/images/xml_logo.gif' >&3
echo ' NOAAs National Weather Service' >&3
echo ' http://weather.gov' >&3
echo '' >&3
;;

esac

echo '' >&3
cp ./temp.xml ${element}/$element-$i.xml #Copying the temporary files
rm ./temp.xml #Removing the temp files

done

echo "Created xml files"


It is helping me a lot lately , I do not need spend a lot of time doing some complex code or generate these files manually. I hope this helps you too .

If you have any suggestion or question, write a comment bellow 🙂

Thank you guys !

Java Reflection – Brief Tutorial

Hi guys, I will write simplified about Java reflection and how you can access with constructors, interfaces, super class, etc…

Java reflection it is useful to instantiate new objects, invoke methods and get/set field values without knowing the names of the classes/methods… and when you want to inspect classes, interfaces, fields and methods at runtime. It is used to examine and modify the structure and code in the same system at runtime.

For example, say you have an object of an unknown type in Java, and you would like to call a ‘doSomething’ method on it if one exists. Java’s static typing system isn’t really designed to support this unless the object conforms to a known interface, but using reflection, your code can look at the object and find out if it has a method called ‘doSomething’ and then call it if you want to.

   Method[] methods = MyObject.class.getMethods();

   for(Method method : methods){
      System.out.println("method = " + method.getName());
   }

What is happening here? It is obtaining the Class object from the class called MyObject, it is using the class object to get a list of methods in this class and print out their names.

From the classes you can obtain information about

  • Class Name
  • Class Modifies (public, private, synchronized etc.)
  • Package Info
  • Superclass
  • Implemented Interfaces
  • Constructors
  • Methods
  • Fields
  • Annotations

For a full list you should consult the JavaDoc for java.lang.Class.

Class Object

First you need obtain the object. If you know the name:

    Class myObjectClass = MyObject.class

If you don’t know the name at compile time:

    String className = ... //obtain class name as string at runtime Class class = Class.forName(className);

Class Name

To obtain the class name, you can try both:

    Class aClass = ... //obtain Class object, as above
    String className = aClass.getName();

If you want only the name without the package:

    Class  aClass          = ... //obtain Class object. See prev. section
    String simpleClassName = aClass.getSimpleName();

Modifiers

To obtain the class modifiers:

 Class  aClass = ... //obtain Class object, as above
 int modifiers = aClass.getModifiers();

The modifiers are packed into an int, you can use the methods with java.lang.reflect.Modifier:

    Modifier.isAbstract(int modifiers)
    Modifier.isFinal(int modifiers)
    Modifier.isInterface(int modifiers)
    Modifier.isNative(int modifiers)
    Modifier.isPrivate(int modifiers)
    Modifier.isProtected(int modifiers)
    Modifier.isPublic(int modifiers)
    Modifier.isStatic(int modifiers)
    Modifier.isStrict(int modifiers)
    Modifier.isSynchronized(int modifiers)
    Modifier.isTransient(int modifiers)
    Modifier.isVolatile(int modifiers)

Package Info

With the package you can have a look in the Manifest of the JAR and others.

   Class  aClass = ... //obtain Class object, as above
   Package package = aClass.getPackage();

Superclass

You can use:

  Class superclass = aClass.getSuperclass();

Interfaces

To get a list of interfaces you can use:

   Class  aClass = ... //obtain Class object, as above
   Class[] interfaces = aClass.getInterfaces();

If you need the complete list of interfaces, you will need to consult both class and superclasses recursively.

Constructors

To access constructors:

 Constructor[] constructors = aClass.getConstructors();

Methods

To access methods:

 Method[] method = aClass.getMethods();

Fields

 Field[] method = aClass.getFields();

Annotations

 Annotation[] annotations = aClass.getAnnotations();

 

You can find more details about the reflection in each constructor, annotations. fields in this tutorial. This was only a brief post to get start to use.

Examples of java reflection: http://docs.oracle.com/javase/tutorial/reflect/index.html

 

Source: http://tutorials.jenkov.com/java-reflection/classes.html

http://stackoverflow.com/questions/37628/what-is-reflection-and-why-is-it-useful

V-model tests – When use, Pros, Cons and Criticism

March 4, 2015 3 comments

V model is one of the most used software development process. Introduction of V model has proved the implementation of testing right from the requirement phase. V model is also called as verification and validation model.

test

V model is applicable when:

  • Requirement is well defined and not ambiguous
  • Acceptance criteria are well defined.
  • Project is short to medium in size.
  • Technology and tools used are not dynamic.

Pros and Cons of using V model:

PROS

CONS

– Development and progress is very organized and systematic– Works well for smaller to medium sized projects.– Testing starts from beginning so ambiguities are identified from the beginning.

– Easy to manage as each phase has well defined objectives and goals.

– Not suitable for bigger and complex projects– Not suitable if the requirements are not consistent.– No working software is produced in the intermediate stage.

– No provision for doing risk analysis so uncertainty and risks are there.

Criticism
The V-Model has been criticized by Agile advocates and others as an inadequate model of software development for numerous reasons. Including:
  • It is too simple to accurately reflect the software development process, and can lead managers into a false sense of security.
  • Fits the needs of project managers, accountants and lawyers rather than software developers or users. Although it is easily understood by novices
  • If practitioners persist with their naive view of the V-Model they will have great difficulty applying it successfully.
  •   Is inflexible and encourages a rigid and linear view of software development and has no inherent ability to respond to change.
  • Provides only a slight variant on the waterfall model and is therefore subject to the same criticisms as that model.
  • Implicitly promotes writing test scripts in advance rather than exploratory testing.
  • Encourages testers to look for what they expect to find, rather than discover what is truly there.
  • Also encourages a rigid link between the equivalent levels of either leg, rather than encouraging testers to select the most effective and efficient way to plan and execute testing.
  • It lacks coherence and precision.
V-model has the same idea of BDD, you need to share knowledge since the beginning of the project (kick-off), providing greater emphasis on testing, and particularly the importance of early test planning.

%d bloggers like this: