Compiling and Running Java Programs without IDE – Online Compiler – Online Editor



In this tutorial we will focus on executing java programs for
practice without using IDE’s like Eclipse,
NetBeans,IntelliJ
and also to run java programs
without installing the JAVA Software and compile
and run using the Online Editors.
Download and install the Java from this link -> Java SE Development Kit 8 Downloads

Executing the JAVA Programs without using IDE’s such as Eclipse,Net-beans, IntelliJ Editors
Make sure the java is installed in the location.

JAVA INSTALLATION DIRECTORY LOCATION

JAVA INSTALLATION DIRECTORY LOCATION

Basic Program in JAVA.

Compiling Java from the Command Line / Terminal on MAC or Linux.
1. To open command line Win + R keys on your keyboard. Then, type cmd or cmd.exe and press Enter

Win + R keys on your keyboard. Then, type cmd or cmd.exe and press Enter to open Command line.

Win + R keys on your keyboard. Then, type cmd or cmd.exe and press Enter to open Command line.





2. Execute the following Command to Compile the Program.
javac HelloWorld.java

javac HelloWorld.java

javac not recognized error:
‘javac’ is not recognized as an internal or external command, operable program or batch file error
comes when you try to compile a Java source file using javac command e.g. javac Helloworld.java
To overcome this you can give the path of the javac available in the program files.

Location of file javac available under the directory java/jdk.

Location of file javac available under the directory java/jdk.


Executing Java from the Command Line / Terminal on MAC or Linux.
open command line and execute the JAVA program using the follow command.
java HelloWorld

java HelloWorld


Executing the JAVA programs using Online Editors without downloading the software.
Practicing the java programs without installing the Java is easy using the below online
editor. This helps to Edit and execute the programs



REST API Automation Testing Tutorial 1 with Rest Assured – Live Example



Rest Assured
Rest Assured API is used to test the REST [Representational State Transfer] methods as such GET,POST,DELETE and UPDATE Methods. REST API Documentation can be referred using the link http://www.javadoc.io/doc/com.jayway.restassured/rest-assured/2.9.0.
In this tutorial we will discuss about the usage of GET Method.
Before Getting into this Example Please follow the links mentioned below for better understanding of Rest Services.
Rest API Basics
REST API – FACEBOOK & GOOGLE API EXAMPLES

Pre-requisites
Follow the Steps in the Link to download the sample REST Application and deploy on
a tomcat Server-> REST API Application Live Example
Implementing the Framework
All the below methods taken care as part of Framework
1. Method Response getServiceResponse(String serviceURL) added as part of the RestLibrary.java class which helps to provide the response based on the end point URL passed as a parameter.


2. Methods used to store the Run time Value in setSysProperty() and fetch the value using getSysProperty().

3. This framework is implemented with Object Properties where the REST Endpoint url’s are
stored in the configuration.properties
.

3. Test case to retrieve all the Customers.


4. Test case to retrieve a particular customer by updating the Customer ID during run time.


5. Test case to retrieve a particular customer by updating the Customer ID using setProperty() and getProperty() Methods.

6. This framework is integrated with Allure as well, so the response can be viewed in the report itself.

REST API Live Example - GET Method Implementation

REST API Live Example – GET Method Implementation




Logic as follows:
RestAssuredExamples.java

RestLibrary.java

APIBaseClass.java

configuration.properties

Attaching the XML Response in Allure Report
1. Refer to complete implementation of Allure Reporting.

Allure Reporting





2. Add the below code in your Base Class.

Attaching the JSON Response in Allure Report
1. Refer to complete implementation of Allure Reporting.

Allure Reporting





2. Add the below code in your Base Class.

CSS Quiz for Beginners & Interview Questions




Total-QA Css Quiz

1. What is the CSS used for representing the heading tags with background color as green?

 
 
 
 

2. What is the Correct Syntax for CSS to be mentioned in the style tag in the head section?

 
 
 
 

3. What is the attribute to represent the Internal Styles??

 
 
 
 

4. What is the property used for background-color for an input Element?

 
 
 
 

5. What is the CSS property used to generate space around an element’s content, inside of any defined borders??

 
 
 
 

6. What is the CSS used for the Displaying the body back ground color?

 
 
 
 

7. What is the attribute used to represent in-line style Sheets?

 
 
 
 

8. What is the syntax for representing multiple styles for an Element?

 
 
 
 

9. What is the full form of CSS?

 
 
 
 

10. What is the correct way of representing the External CSS?

 
 
 
 

Question 1 of 10

Cick this Subscription Link to keep in touch with us!!

Sorting the Dynamic HTML Table List in Selenium WebDriver & Java



Sorting:
In computer science, a sorting algorithm is an algorithm that puts elements of a list in a certain order. The most frequently used orders are numerical order and lexicographical order or alphabetical order.
In Selenium WebDriver it is important to verify the Sort Functionality of the Dynamic HTML Content
is working as expected.

Sorting the Dynamic HTML Table-Selenium WebDriver & Java

Sorting the Dynamic HTML Table-Selenium WebDriver & Java

Steps to Perform:
1. Retrieve the List from HTML Table.
2. Store the List in an Array
3. Sorting the items in the Array using Swapping.
Swapping is the process of Exchanging the Values.
4. Click on Sort button in the WebPage.
5. Retrieve the List again.
6. Compare the Sorted Array generated in Step 3 with the List generated in Step 5.





Selenium WebDriver Logic




Refer to the below Links for Practise
Collections in Java
Complete List of Selenium Basics
50 Real Time Interview Questions
Real Time Scenario’s
Java Platform Standard Edition 8 Documentation
Complete List of Java Basics
Java Quiz
Java OOPS Quiz
Selenium Advanced Quiz
Selenium Quiz
Selenium WebDriver Resume

Performance Testing using Jmeter and Selenium WebDriver

Refer to the below Links for Practise
Complete JAVA QUIZ
Selenium Advanced Quiz
50 Real Time Interview Questions
Selenium Quiz
REST API QUIZ

JMETER
The Apache JMeter™ application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.

Apache JMeter features include:
Ability to load and performance test many different applications/server/protocol types:
• Web – HTTP, HTTPS (Java, NodeJS, PHP, ASP.NET, …)
• SOAP / REST Webservices
• FTP
• Database via JDBC
• LDAP
• Message-oriented middleware (MOM) via JMS
• Mail – SMTP(S), POP3(S) and IMAP(S)
• Native commands or shell scripts
• TCP
• Java Objects

Scenario:
Execute the Selenium Scripts in JMETER and verify the average response time taken in the execution of Selenium Scripts.



1. Download the Apache JMETER zip file from this link -> https://jmeter.apache.org/download_jmeter.cgi
Example: Download apache-jmeter-x.0.zip file.
2. Unzip the file and verify the contents of the JMETER.

Apache JMeter Directory Structure


3. Download the jmeter-plugins-webdriver from this link https://jmeter-plugins.org/?search=jpgc-webdriver and extract the contents and copy in the JMETER/lib folder.
Selenium-Jmeter Jar

Selenium-Jmeter Jar


Example: Download jpgc-webdriver-2.3.zip file.
4. Download the Java Native Access jars and JNA Platform jars and extract the files and copy in the JMETER/lib folder as shown below:

Java Native Access[JNA] allows you to call directly into native functions using natural Java method invocation. The Java call looks just like the call does in native code. Most calls require no special handling or configuration.
5. Open JMeter bat available under JMeter/bin folder.
• Right Click on Test Plan->Create Thread Group.
• Right Click on Thread Group->Select Sampler->WebDriver Sampler
• Right Click on Thread Group-> Select Config Element->Firefox Driver Config.
• Right Click on Thread Group->Listener->View Results in Table.

Sampler->Samplers tell JMeter to send requests to a server and wait for a response.
Config->Configuration elements can be used to set up defaults and variables for later use by samplers.
Listeners->A listener is a component that shows the results of the samples.
6. Copy the Jmeter Script in the WebDriver Sampler as shown below:

7. Execute the Jmeter Script and verify the Results in the View Results Table Listener for the Sample Time captured for executing the Selenium Script.

Jmeter Sampler Time in (ms)

Response Time in (ms)

QTP Basic Quiz & Interview Questions for Beginners

Cick this Subscription Link to keep in touch with us!!

Important topics to crack interviews for QTP/UFT
• Object identification concepts
• Object Repository/Descriptive programming
• Actions/Functions
• Checkpoints
• Recovery scenarios
• Virtual objects
• Test Data management /Data table
• Database connectivity
• Automation frameworks
• VBScripting

Link for QTP Documentation ->https://community.softwaregrp.com/t5/Quality-and-Testing/ct-p/quality-testing

Please go to QTP Basic Quiz & Interview Questions for Beginners to view the test

Xpath Axes Locators in Selenium WebDriver- Dynamic HTML Table


Refer to the below Links for Practise
Complete JAVA QUIZ
Selenium Advanced Quiz
50 Real Time Interview Questions
Selenium Quiz
REST API QUIZ

Dynamic Content:

In Web Applications the data in the HTML Table is dynamic always.
To Fetch the data available in the Dynamic Table or to identify the
Dynamic Web Elements available in the Web Page we should depend on Xpath Axes Locators.

Following are the Xpath Axes Locators:

Link for XPATH AXES->
https://www.w3schools.com/xml/xpath_axes.asp

• ancestor – select parent or grand parent
• following-sibling – Which follows
• preceding-sibling – Which precedes
• descendant – Child/subChild
• parent – Select Immediate Parent
• child- Select immediate Child
• following – Select all the matching nodes which are following
• preceding – Select all the matching nodes which are preceding




Real Time Example:

1. Access the Web Application URL -> https://money.rediff.com/gainers/bse/daily/groupa?src=gain_lose
2. Find the Stock Name ->‘Adani Enterprises Lt’.
3. Get the Price associated with the Stock Name.

Identify the following Xpath in Firepath for understanding:
Xpath Axes Locators
Xpath Example 1:
Identify the Parent of the WebElement
//a[contains(text(),'Adani Enterprises')]/parent::td


Xpath Example 2:
Identify the Ancestor of the Web Element
//a[contains(text(),'Adani Enterprises')]/parent::td


Xpath Example 3:
Identify the following Elements of the Web Element
In the Case of following all the Elements which are matching will be selected. Now the matching nodes are 501.
//a[contains(text(),'Adani Enterprises')]/parent::td/following::td


Xpath Example 4:
Identify the following siblings of the Web Element
In the Case of following-sibling all the Elements which are matching but should be part of the parent tag ‘tr’. Now the matching nodes are 4.
//a[contains(text(),'Adani Enterprises')]/parent::td/following-sibling::td


Fetching the Price associated with the Stock:
//a[contains(text(),'Adani Enterprises')]/parent::td/following-sibling::td[2]


Selenium Program:

REST API Quiz

      No Comments on REST API Quiz
Refer to the below Links for Practise
Complete JAVA QUIZ
Selenium Advanced Quiz
50 Real Time Interview Questions
Selenium Quiz
Please go to REST API Quiz to view the test
Refer to the below Links for Practise
REST API BASICS -> REST API BASICS
REST API Real Time Example for Beginners
Facebook & Google API Examples

Error using sendKeys() with Selenium WebDriver due to java.lang.CharSequence cannot be resolved

Refer to the below Links for Practise
Collections in Java
Complete List of Selenium Basics
50 Real Time Interview Questions
Real Time Scenario’s
Java Platform Standard Edition 8 Documentation
Complete List of Java Basics
Java Quiz
Java OOPS Quiz
Selenium Advanced Quiz
Selenium Quiz
Selenium WebDriver Resume

Fixing java.lang.CharSequence

In Eclipse whenever we create a project automatically it will pick the latest jre installed in your system jre 1.8.0_25 which is in my case as shown below:
Java Version From Command Line
But in selenium webdriver when we use ‘sendkeys()’ method throws error java.lang.CharSequence cannot be resolved.

We can resolve this in two ways
1. Setting the Source level project should be greater then 1.5.
2. Roll back the jre 8 to jre 7 in Eclipse.




Steps for Setting the Source level of the Project to greater then 1.5

1. Select Project right click->Build Path->Configure Build Path.

2. Select the Java Compiler option as shown below:

3. Select check-box for ‘Enable project specific settings”. Change the value from the compliance level drop down from 1.4 to 1.7. Click on ‘Ok’ button.

4. Verify the program now the issue will be resolved
Steps for roll-backing from jre 8 to jre 7
1. Select Project right click->Build Path->Configure Build Path.

2. Navigate to Libraries. Select the jre 1.8 and click on remove.Do not worry we are not removing the jre 1.8 from the system, we are removing the jre 1.8 reference from this project.

3. Click on Add Library Button->JRE System Library->Next.

4. Select Alternate JRE radio button. Click on ‘Installed JREs’ button.

5. In the installed JREs click on Add and Navigate to the directory where the jre7 is installed.

6. Select the JRE Type as ‘Standard VM’ and click on Next.

7. In my case JRE7 is installed in the following location.
C:\Program Files (x86)\Java\jre7
Provide JRE Name -> jre7.0
Click on Finish button.

8. Select jre7.0 checkbox in the list of Installed JRE’s. Click on Ok button.

9. Select the workspace default jre as JRE 7.0. Click on Finish button.

10. Verify the Java Build Path.

11. Verify the program now the issue will be resolved.