CNTL+SHIFT+I: Shortcut To view the html
To run testng xml file from command prompt
1. First set the path of the .classfiles
set classpath=”path of the .class files”;
2. Set path of testng jar files
set classpath=”path of testng jar files”;
org.testng.TestNG testng.xml;
GIT
Command: git init fresh-project
// to initialize or create empty git repository; fresh project is the name og git repository
Assertion in java
Assertion is a statement in java. It can be used to test your assumptions about the program.
While executing assertion, it is believed to be true. If it fails, JVM will throw an error named
AssertionError. It is mainly used for testing purpose.
class AssertionExample{
public static void main( String args[] ){
Scanner scanner = new Scanner( System.in );
System.out.print("Enter ur age ");
int value = scanner.nextInt();
assert value>=18:" Not valid";
System.out.println("value is "+value);
}
}
If you use assertion, It will not run since assertion is disabled by default. To enable
the assertion, -ea or -enableassertions switch of java must be used.
Compile it by: javac AssertionExample.java
Run it by: java -ea AssertionExample
To check available ports in windows
netstat -a