0% found this document useful (0 votes)
40 views

First Set The Path of The .Classfiles: To Run Testng XML File From Command Prompt

1. To run a TestNG XML file from the command prompt, set the classpath to the path of the class files and TestNG JAR files, then run the TestNG XML file with the org.testng.TestNG class. 2. The git init command with a project name initializes an empty Git repository for that project. 3. Assertions in Java are statements used to test assumptions, and throw an AssertionError if false. They must be enabled with -ea to be checked.

Uploaded by

ANUSHA S G
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

First Set The Path of The .Classfiles: To Run Testng XML File From Command Prompt

1. To run a TestNG XML file from the command prompt, set the classpath to the path of the class files and TestNG JAR files, then run the TestNG XML file with the org.testng.TestNG class. 2. The git init command with a project name initializes an empty Git repository for that project. 3. Assertions in Java are statements used to test assumptions, and throw an AssertionError if false. They must be enabled with -ea to be checked.

Uploaded by

ANUSHA S G
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

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

You might also like