For-loop in Java
class ForLoop {
public static void main(String[] args) {
int c;
for (c = 1; c <= 10; c++) {
System.out.println(c);
}
}
}
Azure, RPA, AI, Selenium, Angular, API
class ForLoop {
public static void main(String[] args) {
int c;
for (c = 1; c <= 10; c++) {
System.out.println(c);
}
}
}
WSDL (Web services description language) helps client to initiate the correct web service
UDDI is the online directory which has all the WDSL available and all web services client gets that from UDDI.
2. REST
SOAP uses HTTP as media for transferring data. Format used in XML.
Sample feature file contents as below:
Feature: Login and Logout Action
Scenario: Successful Login with Valid Credentials
Given User is on Application Home Page
When User Navigates to Application LogIn Page
And User enters UserName and Password and click submit button
|UserName|Pwd |
|abc | 123 |
Then Message displayed as Login Successfully
@When(“^User enters UserName and Password and click submit button$”)
public void user_enters_UserName_and_Password_and_click_submit_button(DataTable table) throws Throwable {
// Write code here that turns the phrase above into concrete actions
List<List<String>> data = table.raw();
driver.findElement(By.id(“IDTokenA1”)).sendKeys(data.get(1).get(0));
driver.findElement(By.id(“IDTokenB1”)).sendKeys(data.get(1).get(1));
driver.findElement(By.name(“Login.Submit”)).click();
// throw new PendingException();
}
Sample feature file contents as below:
Scenario Outline: Login functionality for a website.
Given User navigates to Login page
When user enters Username as “<username>” and Password as “<password>”
Then login should be unsuccessful
Examples:
| username | password |
| ABC | 123 |
@When(“^user enters Username as \“([^\”]*)\” and Password as \”([^\”]*)\”$”)
public void user_enters_Username_as_and_Password_as(String arg1, String arg2) {
driver.findElement(By.id(“IDTokenA1“)).sendKeys(arg1);
driver.findElement(By.id(“IDTokenB1“)).sendKeys(arg2);
driver.findElement(By.id(“Login.Submit“)).click();
}
package cucumberTestRunnerTest;
/*
* cucumberTestRunner sample code below
*
*/
import org.junit.runner.RunWith;
import cucumber.api.junit.Cucumber;
import cucumber.api.CucumberOptions;
@RunWith(Cucumber.class)
@CucumberOptions(format={“pretty”}
,features = “Feature” // refer the above feature file sample
,glue={“stepDefinition”} // note: need to create a package stepDefinition and create a regression scriptclass
,dryRun = false)
public class TestRunnerTest {
}
Note: JUnit runner uses the JUnitframework to run Cucumber using annotation – you could see in the above code that single empty class with annotation.
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.0.14</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.0.14</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.1.5</version>
</dependency>
</dependencies>
cucumber-java
cucumber-core
cucumber-junit
cucumber-jvm-deps
cucumber-reporting
gherkin
junit
mockito-all
cobertura
package stepDefinition;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
importorg.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.WebDriver;
import cucumber.api.DataTable;
import cucumber.api.PendingException;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class RegressionTest { // refer the Test runner sample code point #3 to see how the this code is mapped
WebDriver driver;
// run TestRunner.java file and get the out put from Console and copy/paste below:
@Given(“^User is on Application Login Page$”)
public void user_is_on_Application_Home_Page() throws Throwable {
// Write code here that turns the phrase above into concrete actions
driver = new InternetExplorerDriver();
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
//throw new PendingException();
}
package yourpagename;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import java.io.File;
import java.io.FileInputStream;
importjava.util.List;
importjava.util.concurrent.TimeUnit;
importorg.openqa.selenium.By;
importorg.openqa.selenium.WebElement;
importorg.openqa.selenium.ie.InternetExplorerDriver;
importorg.openqa.selenium.support.ui.Select;
importorg.openqa.selenium.WebDriver;
importorg.testng.annotations.AfterClass;
importorg.testng.annotations.AfterTest;
importorg.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import Package.AnyotherClass; // if needed
public class AnyotherClassPage extends InitialClass
{
//WebDriver driver;
AnyotherClass ObjectName;
@Test(priority = 1)
public void Excel() throws Exception
{
ObjectName = new AnyotherClass (driver);
ObjectName.objectclick();
System.out.println(“Started executing Test Cases”);
// load excel file
File filePath = new File(“C:\\xxxxx\\ExcelFileName.xls”);
FileInputStream FS = new FileInputStream(filePath);
HSSFWorkbook WB = new HSSFWorkbook(FS);
HSSFSheet sheet = WB.getSheetAt(0);
int rowcount = sheet.getLastRowNum() – sheet.getFirstRowNum();
int colcount = sheet.getRow(0).getLastCellNum();
int a =0 ;
System.out.println(“Number of rows” + rowcount);
System.out.println(“Number of columns” +colcount);
for(int b=1;b<rowcount;b++)
{
HSSFRow row = sheet.getRow(b);
//for(int j=0;j<colcount;j++)
//{
//HSSFCell cell = row.getCell(j);
String excelCell1 = row.getCell(a).getStringCellValue();
String excelCell2 = row.getCell(a+1).getStringCellValue();
System.out.println(“XLS Values are — “ + excelCell1 + “—“ + excelCell2);
//}
ObjectName.NewMethod1(excelCell1);
ObjectName.NewMethod2(excelCell2); // code continues … …
TestRunner is a program used in Cucumber to access Feature file as copied in the picture below.
Feature file is something that has user requirement scenarios written in English which gives more readability and understandability of the requirement which is called Gherkin language.
So any roles in the company like Tester, developer, end user, and techno functional person can read it and understand it. Also this will reduce the complication in terms of missing requirement or misrepresenting or misunderstanding requirements between different roles like Developer , tester, and end user,
In order to link Cucumber with Selenium WebDriver, you need to start a Java project in eclipse IDE.
Then, add both Cucumber and Selenium jar files
Write test runner code and execute the same . Please refer BDD testing details on Selenium Cucumber
Sample Test runner code:
package javaArrays;
import java.util.Scanner;
public class FourDimArray {
public static void main(String[] args) {
int a[][][][] = new int[5][4][3][2];
int i,j,k,l, num = 1;
for (i=0; i<5; i++)
{
for(j=0; j<4; j++)
{
for(k=0; k<3; k++)
{
for(l=0; l<2; l++)
{
a[i][j][k][l] = num;
num++;
}
}
}
}
for(i=0; i<5; i++)
{
for(j=0; j<4; j++)
{
for(k=0; k<3; k++)
{
for(l=0; l<2; l++)
{
System.out.print(“a[“ +i+ “][“ +j+ “][“ +k+ “][“ +l+ “] = “ +a[i][j][k][l]+ “\t”);
}
System.out.println();
}
System.out.println();
}
System.out.println();
}
}
}
Salesforce.com is an American cloud computing company.
Salesforce offers Software as a Service (SaaS) platform which helps in Customer Relationship Management.
It has a multi-tenant architecture and subscriptions.
The following are the application clouds in Salesforce CRM.
Salesforce also offers Platform as a Service (PaaS) using Force.com sites.
People involved in Salesforce Implementation
1. End User ( Customer)
2. Administrator
3. Developer
4. Consultant
The following are the list of Salesforce Certifications.
What is Apex?
Datatypes in Apex
Apex primitives include the following datatypes.
Hadoop MapReduce is the main core components of Hadoop and is a programming model Hadoop MapReduce helps implementation for processing and generating large data sets, it uses parallel and distributed algorithms on a cluster. Hadoop MapReduce can handle large scale data: petabytes, exabytes.
Mapreduce framework converts each record of input into a key/value pair.
To understand more about Blockchain and crypto currency, lets explain about current Banking system works.
Current Banking systems : when a user does an online or ATM transaction , the centralized banking ledger verifies and confirm the authenticity of accounts. For that work, every bank or third party sites charges to user.
Blockchain is not like banking centralized ledger but this software uses a decentralized ledger across the thousands of computers and every transactions are updated in each and every ledger. That means everyone is aware of the transactions rather than a centralized bank stores all information and charges for that. There are volunteering systems who does this effort of maintaining all ledgers for block chain.
Block chain uses cryptography mythology to protect the ledger information so that no one can modify or destroy this.
Block chain concept is utilized by Crypto currency , online voting system, signature system, agreement systems etc.
bitcoin BTC
ethereum ETH
bitcoincash BCH
ethereumclassic ETC
litecoin LTC
einsteinium EMC2
dash DASH
ripple XRP
bitcoingold BTG
zcash ZEC
eos EOS
qtum QTUM
syscoin SYS
neo NEO
monero XMR
vertcoin VTC
iota IOT
powerledger POWR
omisego OMG
santiment SAN
Jmeter recording
How to create Jmeter scripts?
Recording Jmeter scripts using Jmeter’s HTTP(S) Test Script recorder. There are two ways
1) Manually adding scripts ( Test plan >> Tread Group >> Add>> Sampler >> HTTP Request )
2) Recording using Jmeter’s HTTP(S) Test Script recorder
How to record Jmeter scripts using HTTP(S) Test Script recorder
Prior doing that we need to configure browser and learn about the Proxy setup
Jmeter to Application server communication need to be routed through a browser Proxy for this recording purpose. For that you may need to select the Browser (here we can use Firefox browser”
1) Navigate to Firefox >> Tools >> options >> Advanced >> Network >> Settings
2) Select Manual Proxy configuration >> HTTP Proxy = localhost & Port = 8080
How to run Jmeter in Jenkins
steps:
Jenkins setup and performance plugin setup:
1) copy performance plugin into Jenkin’s home directry before you start the test.
2) to do that – you can download the performance plugin “performance.hpi” from the site https://wiki.jenkins-ci.org/
3) how to find the home directry of jenkins – to do that you can navigate to jenkins home page (localhost:8080) and then
4) click on “Manage Jenkins” and then click on “Configure system” the you will notice “Home directy” path in there.
Configure Jmeter and create a basic script in Jmeter:
5) download Jmeter Binary zip file from Jmeter site http://jmeter.apache.org/
6) unzip it and go to the “bin” directory of the Jmeter folder, wherre you will notice “user.properties” file.
7) open the file in notepad or notepad++ or any other text editor
8) add a line “jmeter.save.saveservice.
9) create a Jmeter script and make sure you can run it in non GUI mode i.e either in DOS mode or using shell scripts in MAC (note down the commands used in respective OS and it could be used in Jenkins job setup)
Note: for windows command line run, you can use the following commands
C:\[JMETER BIN directory]\jmeter.bat -Jjmeter.save.saveservice.
Note 1: For detailed topics on Jmeter scripts creation , please visit Jmeter , Jmeter recording
setup Jenkin’s job to run Jmeter scripts
9) go to Jenkins home page (localhost:8080) and then click on “New Item” on “Freestyle project”
10) in the “New item” page, give some name in the item name field and go to below to section “Build” and add build step
11) add build step can be either a) “execute windows batch command” for windows or b) “Execute shell” for MAC
12) provide your command in there and save.
13) Click on “Build now” which would call the Jmeter (jmx) file and run the program
14) after the run, you can verify the Jenkins console to review the results.
1) go to https://jenkins.io and download Jenkins.war file
2) place the war file in a folder (e.g. C:\Jenkins\Jenkins.war )
3) then open command prompt (windows start menu > run > cmd will open command prompt )
4) in command prompt, go to folder C:\Jenkins\ ( command : “CD C:\Jenkins\” ) and then run command ” java -jar Jenkins.war ”
5) this will exract a folder name “.jenkins” into your user folder ( the path is usually “C:\users\”your login”\.jenkins”
6) copy “.jenkins” folder and paste to folder C:\Jenkins\, so that you have “C:\Jenkins\.jenkins” as the folder path.
7) Now you setup a Enviroment variable (to set up that go to Control panel > system > Advanced System settings )
8) then add Enviroment variable as “JENKINS_HOME” and value as “C:\Jenkins\.jenkins”
You all set to run Jenkins on your machine!
Open a browser and type “localhost:8080” to see Jenkins session.
Selenium supports Cross Browser Testing and parallel testing. The Selenium tests can be run on multiple browsers and multiple machines and multiple Operating systems. Selenium offers open source tools and supports test automation for web applications
Supports several scripting languages like Java, Python, C#, and PHP
Reporting are very easy and extensible, Selenium uses Browser native commands. It locates and actions applied on UI elements
TestNG quick summary:
TestNG’s is Selenium + reporting features. It is easy to generate reports using Listeners and Reporters in TestNG
Features of TestNG includes the following,
1) Annotations – please refer my annotation blog Annotation – TestNG’s test case priority
2) Supports parameterization/ data driven testing
3) Test cases can be grouped and parallel testing is allowed.
Application behavior is the main focus on BDD. The requirements are written in English which gives more readability and understandability of the requirement.
So any roles in the company (Tester, developer, end user, and techno functional person) can read it and understand it. Also this will reduce the complication in terms of missing requirement or misrepresenting or misunderstanding requirements between different roles (Developer /tester / end user)
Gherkin is a business readable language – refer below for an example. Below feature file is integrated with Selenium and are having user stories as below.
Please refer below – “feature, Scenario, Given, When, And, Then “are the Keywords below to understand on how to write a feature file.
In order to link Cucumber with Selenium WebDriver, you need to start a Java project in eclipse IDE.
Then, add both Cucumber and Selenium jar files
Write test runner code and execute the same . Please refer BDD testing details on Selenium Cucumber
Jenkin related steps:
1) start jenkins by running command in DOS prompt (detailed steps in here )
2) then make sure you are able to access url : localhost:8080
3) then you need to configure jenkins to run the selenium scripts – for that click on “Manage Jenkins”
4) then click on Configure systems
5) Find out the jdk files are installed (usually in C:\ program files … folder path) and copy paste the path in JDK section “JDK Installations” in ” Configure systems” which you are already in.
6) Give JDK name “JAVA_HOME” and provide Java path below in the next field.
Selenium related steps:
3) Open eclipse IDE and start new Java project
4) make sure you added selenium jars (Selenium server standalone jar file which you can download add to new project) to support selenium framework for your automation testing.
5) then create a simple selenium script – make sure it is running and completing successfully in Eclipse.
6) Also create a xml file give a name “Xml1.xml” Make sure Run “Xml1.xml” as “TestNG Suite” is working fine in Eclipse. Also notedown the xml file path in selenium project. create a lib folder in that and add all jar files which are required.
Commmand prompt:
7) navigate to that project folder in command prompt and set all required classpath like bin and lib etc which are already in xml file folder in selenium project which you got from selenium project in eclipse.
8) then type command “Java org.testng.testNG Xml1.xml” which will display results in command prompt/DOS screen
9) now create a batch file “Batch1.bat” which contains the above command and also a command for compiling as e.g “java -cp bin;lib/* org.testng.testNG Xml1.xml”
Jenkins setup to build and run the file:
10) in Jenkins, create a “new item” with selection of “Freestyle project”
11) then select “Advance options” and put the Selenium project home directory path in there.
12) the build trigger section, select Batch file execution option in there, then put the batch file name “Batch1.bat”
13) click and save the new item
14) click on “Build Now” and verify the “Console output”
Configuring Hub machine
1) Start the command prompt/DOS prompt
2) Navigate to the folder location where the Selenium server jar file is kept.
3) Type java –jar selenium-server-standalone-[VERSION].jar –role hub
Note: [VERSION] is the one your downloaded version of selenium-server-standalone Jar file.
Selenium Hub
4) Now type: http://localhost:4444 in browser
Your will see the below screen
5) Now type: http://localhost:4444/console in browser
Configuring Node machines
Follow the same steps 1 to 2 in node machines
Then type,
Java –jar selenium-server-standalone-[VERSION].jar –role node –hub http://yourHUBmachineIP:4444/grid/register
To run selenium scripts in Jenkins, Jenkins needs to started.
To make Jenkins server start, please use the following command in the Jenkins folder of your machine when Jenkins.warfile is downloaded from internet…
Note: Java-JDK file folder path is usually “C:\Program files\Java\JDK….”
Note: Disable “Install Automatically” check box else it will update with new Java versions and your selenium program might get conflicts
Note: to get the XML folder path in project home directory, you could go to Eclipse project and right click to see properties.
Note: you also need to put all the jar files required for selenium testing under the lib folder(you may need to create”lib” folder)
Just to test your TestNG scripts are working, you can navigate to Project home directly (XML located) through DOS/Command prompt and then type as below:
Note: before that you need to set class path as bin directory of Project home folder. Command : “set classpath=C:\Selenium\project\bin;” as an example for binary file
Note1: similarly lib files, Command : “set classpath=C:\Selenium\project\lib\*” as an example
or command: set classpath=C:\Selenium\project\bin;C:\Selenium\project\lib\*;
Then execute testng.xml file through command prompt
command : java org.testng.TestNG testng.xml
Create a batch file using notepad – steps
‘ java -cp bi;lib/* org.testng.TestNG testng.xml ‘
2) save the notepad as “runSelenium.bat” which will create a bat file. Place it in project home directory.
Jenkins job creation:
Call CloseAllBrowsers_ExcludingALM()
Function CloseAllBrowsers_ExcludingALM()
‘To ceclare Variables
Dim objDes, objList, objIndex
‘To Create Object Description for all opened browsers opened.
Set objDes=Description.Create
objDes.Add “micClass”,”Browser”
‘To get all the opened browsers objects from Desktop
Set ObjList=Desktop.ChildObjects(objDes)
‘Indexing always starts from “0”
For objIndex=0 to objList.count-1
‘To cverify the name of the browser is “HP Application Lifecycle Management”
If lcase(objList(objIndex).GetROproperty(“name”))<>”HP Application Lifecycle Management” then
‘Close the Browser
objList(objIndex).close
Exit For
End If
Next
First stop the Jenkins service if you are already running jenkins
Go to the folder where jenkin’s config.xml file is stored (generally C:\jenkins\.jenkins\config.xml)
Open config.xml file using notepad++ or any text editor
Search for <useSecurity>true</useSecurity> and change that to <useSecurity>false</useSecurity>, Save the file.
re-start Jenkins service (using Java -jar jenkins.war in commandline)
You should not be seeing login prompt but directly accessing Jenkins home page when you type localhost:8080 in browser.
Create a “.vbs” file as below and save the file as “AOM.vbs” in C:\QTP\VBS folder.
In Jenkins create Job, Select ‘Execute Windows Batch Command’ in Build Step. Enter below command.
and then use that in Jenkins.
Note: To learn how to create a Jenkins job or how to start Jenkins – please refer create a Jenkins job and Run Jenkins locally in my site.
Below code is the “AOM.vbs” which is called by Jenkins Job.
Call QTP()
Public function QTP()
‘Create Quick test pro(QTP/UFT) object
Set objQTP = CreateObject(“QuickTest.Application”)
objQTP.Launch
objQTP.Visible = True
‘to open QTP Test
objQTP.Open “Test file path “, True
Set objResults= CreateObject(“QuickTest.RunResultsOptions”)
objResults.ResultsLocation = “Result path of qtp” ‘Set the results location
‘to run qtp script results
objQTP.Test.Run objResults
‘to close QTP
objQTP.Test.Close
objQTP.Quit
End function
Web Layer (Presentation Tier)
Contains Virtual Machines and Physical Machines with OS can be Windows, UNIX or Linux
Contains Apache web Server, Apache tomcat, Sun Java Web Server or MS Internet Information Services (IIS)
Application Layer (Logic Tier)
Contains Virtual Machines and Physical Machines with OS can be Windows, UNIX or Linux
Contains Apache tomcat, Red Hat JBoss, BEA Web Logic or IBM WebSphere app server
Database Layer (Data Tier)
Contains Virtual Machines and Physical Machines with OS can be Windows, UNIX or Linux
Contains SQL or Oracle
1) Go to web.whatsapp.com in a web browser on a computer.
2) Then, on your iOS/Android/Windows mobile phone, open WhatsApp and press the Options on top right corner side
3) then press WhatsApp Web from the options.
4) use iOS/Android/Windows mobile phone to scan the QR code shown on the browser on your computer.
headless web browsers or programs are used to stimulate the browsers where there is no GUI is used for browser actions,
If you want to do browser operations or collect data from UI, there programming concepts will be used.
headless web browsers are listed as below,
HtmlUnit – No GUI browser for Java programmers and its pure java implementation, Open source programs. JavaScript support/DOM emulated. mainly used for used for testing purposes or to retrieve information from web sites.
Spynner – Programmatic web browsing module having AJAX support for Python
Ghost – it is a webkit web client written in python. it is WebKit-based. JavaScript supported and Open source.
Watir-webdriver- it an open source Ruby library for automating tests. Complete JAva script Support via Browsers
Twill – Allows users to browse the Web using command-line interface . Supports automated testing on web applications and Open source.
Awesomium – is Chromium-based. and supports JavaScript and provides HTML-powered interfaces.
ZombieJS – Open source headless testing using Node.js. JavaScript support/emulated DOM.
SimpleBrowser – Open source web browser engine designed for automation tasks. It is built for .Net framework and No JavaScript support.
To maximize automation benefits in terms of best output and cost effectiveness is by implementing best matching framework based on your product line.
When an organization plans for cost effective automation frameworks, they can always consider 2 types of frameworks to start having maximized results with less effort and cost. Basically optimizing your efforts and get better ROI relatively in less time.
Let me give an example when you consider the type 1 which is BDD for acceptance testing.
The very reason for BDD is that it can utilize business user’s collaboration in automation. This is the easiest way to get business team’s association on your automation efforts.
In my opinion, when you compare within different BDDs, cucumber has upper edge as opposed to Robot Framework as simplicity in it that will help business user involve easily.
As an e.g. cucumber frameworks need feature file and typical feature file example will have user scenarios as below,
Feature: Login Action
Scenario: User successfully Login to application with valid user id and password
Given User is on application login prompt page
When User enters User name and password
Then Message displayed as Login is successful
Scenario Outline: data parameter test
When User navigates to application search screen
Then user input “<InputInfo>” as “InputVal”
Examples:
| InputInfo |
| ABC1 |
| ABC2 |
In the above example you can see that a business user can simply follow the format for above 2 test cases which is written in feature file.
1) Scenario
2) Scenario Outline:
Later automation architect or engineer can develop test runner file and convert this as automation test scripts. Please refer link for more details about cucumber framework.
Benefits
To understand more about Blockchain and cryptocurrency, lets explain about current Banking system works.
Current Banking systems : when a user does an online or ATM transaction , the centralized banking ledger verifies and confirm the authenticity of accounts. For that work, every bank or third party sites charges to user.
Blockchain is not like banking centralized ledger but this software uses a decentralized ledger across the thousands of computers and every transactions are updated in each and every ledger. That means everyone is aware of the transactions rather than a centralized bank stores all information and charges for that. There are volunteering systems who does this effort of maintaining all ledgers for block chain.
Block chain uses cryptography mythology to protect the ledger information so that no one can modify or destroy this.
Block chain concept is utilized by Cryptocurrency , online voting system, signature system, agreement systems etc.