You are on page 1of 5

Automation

Maven = project management and comprehension tool ; provides


developers a complete build lifecycle framework; simplifies and
standardizes the project build process .
Maven uses Convention over Configuration. When a Maven project is
created , Maven also creates default project structure .
Maven POM = POM ( project object model), fundamental Unit of work in Maven ,
a xml file . Before creating a POM , first need to decide the mandatory fields :
group (groupId) , its name(artifactId) and its version
Project notation in repository is groupId:artifactId:version
In order to run multiple test cases written in webdriver / eclipse, you must create
a xml file this will act as a configuration file through.
TESTNG reads what the test cases which needs to be execute are.
If you want to have the indentation, you must select all the lines code from the
xml richt click Source Format Active Elements /Ctrl+I
If you want to execute more then one test case in webdriver , you can use those
two method with one test method per test class , in your @BeforeMethod you
can instantiate the WebDriver browser instance and then in the @AfterMethod
you can kill it [ TestNG ]

Git = change control management system . Is optimized for distributed


development , large file sets , complex merges , making trial branches,
very fast , being robust .

Git is not optimized for : tracking file permissions and ownership,


tracking individual files with separate history .

I . Create a new repository


Command : $ git init

II. checkout a repository


Command for a working copy of a local repository: $ git clone
/path/to/repository

Command when using a remote server:$ git clone


username@host:/path/to/repository

III. Worklfow
working directory = holds the actual files
Index = acts as a staging area
Head = points to the last commit youve made( of your
local working copy)

IV. Add & commit


Command for changes(add it to the Index): $ git add <filename> /$ git add *

Command to commit the changes , to the HEAD , but not to your remote
repository :$ git commit -m "Commit message"

V. Pushing changes
Command to send all changes from HEAD to remote repository : $ git push
origin master [ master = whatever branch you want to push it ]
Command for not cloned the existing repository, but still need to connect to a
remote server:$ git remote add origin <server>

VI. Branching = used to develop features isolated from each other . Master
branch = the default branch when you create a repository .
Commands
to create a new branch : $ git checkout -b feature_x
to switch back to default : $ git checkout master
to delete the branch again : $ git branch -d feature_x
( for a branch to be available ) to push the branch to your remote
repository : $ git push origin <branch>

VII. Update & merge


Commands
To update your local repository to the newest commit : $ git
pull

To merge a branch into the active branch(ex: master) :$ git


merge <branch>

To mark the changes as merged : $ git add <filename>

VIII. Tagging ( its recommended to create tags for software releases)


Command to create a new tag : $ git tag name 1b2e1d63ff [1b2e1d63ff =
represent the first 10 characters of the commit id you want to reference with
your tag ]

IX. Log

Command
Command
Command
Command

to
to
to
to

study repository history : $ git log


see only the commits of a certain author : $ git log --author=bob
see each commit in one line : $ git log --pretty=oneline
see an ASCII art tree with the names of tags& branches : $ git log

--graph --oneline --decorate all

Command to see files which have changed : $ git log --name-status


Command to go to help : $ git log help

X. Replace local changes


Command to replace local changes in HEAD : $ git checkout -- <filename>
[Changes already added to the index, as well as new files, will be kept. ]
Command to drop all the local changes and commits , fetch the latest history
from the server & point your local master branch : $ git fetch origin ; $ git
reset --hard origin/master

XI. Useful hints


Command for built-in git GUI : $ gitk
Command to use colourful git output : $ git config color.ui true
Command to show log on just one line/commit : $ git config format.pretty
oneline

Command to use interactive adding : $ git add -i

How to run automated tests from windows command line


Enter in the folder which exist the automated tests [to enter in
partion D write d:]
cd (space) folder name
mvn (space) - v = to identify if maven is installed
mvn (space) clean install = to copy all the tests in your local
repository
GIT useful commands :
ll = to see the list of all the files / folders from a directory / partion
..
git pull = to pull on your local repository, all the modifications
git branch = to see on which branch you are
git log (space) n (2..3) = to see the last commits
ls = all the files from a specific folder will be displayed
gitk filename(or class java) = show history
From IntelliJ , go to VCS / GIT / Stash Changes = if you want to save you local
modification [ to add it in a new folder ]. Once this action is made , from VCS /
Commit Changes no modifications should be displayed
Git Bash commands to push the local modifications to the main server :

git status
git checkout (space) filename = in order to discard the unwanted
modifications
git add (space) filename (or file path name )
git add. = in order to add multiple files
git commit (space) m message for commit
git push

http://jasmine.github.io/ - link java script code testing

The difference between ArrayList and LinkedList si that ArrayList is used


when the use needs to access quick data and the LinkedList to insert/delete
many entries .
ArrayList is better for storing and accessing data, as it si very similar to a normal
array
LinkedList is better for manipulating data , such as making numerous inserts and
delets
Arrays and List store elements as ordered collections , with each element given
an integer index .
HashMap is used for storing data collections as key and value pairs. One object
is used as a key(index) to another object(the value) . In order to access the

HashMap elements, use the get method and the corresponding key http://screencast.com/t/xMSvavLi0

Iterators
An Iterator is an object that enables to cycle through a collection, obtain or
remove elements.
Before you can access a collection through an iterator, you must obtain one.
Each of the collection classes provides an iterator() method that returns an
iterator to the start of the collection. By using this iterator object, you can access
each element in the collection, one element at a time.
The Iterator class provides the following methods:
hasNext(): Returns true if there is at least one more element; otherwise, it
returns false.
next(): Returns the next object and advances the iterator.
remove(): Removes the last object that was returned by next from the
collection.
The Iterator class must be imported from the java.util package.
import java.util.Iterator;
import java.util.LinkedList;
public class MyClass {
public static void main(String[ ] args) {
LinkedList<String> animals = new LinkedList<String>();
animals.add("fox");
animals.add("cat");
animals.add("dog");
animals.add("rabbit");
Iterator<String> it = animals.iterator();
String value = it.next();
System.out.println(value);
}
}
//Outputs "fox"
it.next() returns the first element in the list and then moves the iterator on to
the next element.
Each time you call it.next(), the iterator moves to the next element of the list.

Creating a File
To start, create a File object and specify the path of the file in the constructor.

import java.io.File;
...
File file = new File("C:\\data\\input-file.txt");
With the exists() method, you can determine whether a file exists.
The getName() method returns the name of the file

Reading a File
Files are useful for storing and retrieving data, and there are a number of ways to
read from a files.
One of the simplest ways is to use the Scanner class from
the java.util package.
The constructor of the Scanner class can take a File object as input.
To read the contents of a text file at the path "C:\\sololearn\\test.txt", we would
need to create a File object with the corresponding path and pass it to the
Scanner object.
try {
File x = new File("C:\\sololearn\\test.txt");
Scanner sc = new Scanner(x);
}
catch (FileNotFoundException e) {
}

You might also like