why I am getting this error while running the jar file on remote machine all permissions are there to access the file

52 Views Asked by At
C:\\Users\\0641351\\Desktop\>java -jar CreatePSWithPrivateDuty1.jar
java.io.IOException: The device is not ready
at java.io.WinNTFileSystem.canonicalize0(Native Method)
at java.io.WinNTFileSystem.canonicalize(Unknown Source)
at java.io.File.getCanonicalPath(Unknown Source)
at org.testng.xml.Parser.parse(Parser.java:151)
at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:310)
at org.testng.TestNG.run(TestNG.java:1006)
at TestNgRunner.Poc_Xml_Runner.main(Poc_Xml_Runner.java:15)
\[TestNG\] \[ERROR\] No test suite found. Nothing to run
Usage: \<main class\> \[options\] The XML suite files to run
Options:

>!     -configfailurepolicy

Configuration failure policy (skip or continue)

>!     -d

Output directory

>!     -dataproviderthreadcount

Number of threads to use when running data providers

>!     -excludegroups

Comma-separated list of group names to  exclude

>!     -groups

Comma-separated list of group names to be run

>!     -junit

JUnit mode
Default: false

>!     -listener

List of .class files or list of class names implementing ITestListener or
ISuiteListener

>!     -methods

Comma separated of test methods
Default: \[\]

>!     -methodselectors

List of .class files or list of class names implementing IMethodSelector

>!     -mixed

Mixed mode - autodetect the type of current test and run it with
appropriate runner
Default: false

>!     -objectfactory

List of .class files or list of class names implementing
ITestRunnerFactory

>!     -parallel

Parallel mode (methods, tests or classes)

>!     -port

The port

>!     -reporter

Extended configuration for custom report listener

>!     -suitename

Default name of test suite, if not specified in suite definition file or
source code

>!     -suitethreadpoolsize

Size of the thread pool to use to run suites
Default: 1

>!     -testclass

The list of test classes

>!     -testjar

A jar file containing the tests

>!     -testname

Default name of test, if not specified in suitedefinition file or source
code

>!     -testnames

The list of test names to run

>!     -testrunfactory, -testRunFactory

The factory used to create tests

>!     -threadcount

Number of threads to use when running tests in parallel

>!     -usedefaultlisteners

Whether to use the default listeners
Default: true

>!     -log, -verbose

Level of verbosity

>!     -xmlpathinjar

The full path to the xml file inside the jar file (only valid if -testjar
was specified)[tag:tag-name]
Default: testng.xml

I tried chkdsk command

tried with relative and absolute paths for running the xml file inside jar

want to run the jar file

1

There are 1 best solutions below

0
Krishnan Mahadevan On

You would need to ensure that you have built a jar that contains the test classes. Your post doesn't explain whether that's the case.

Please refer to https://testng.org/#_running_tests_from_within_a_test_jar to see a complete example of how to use TestNG to run tests that are part of a jar.

To instruct TestNG to look for tests in a jar you should be using the -testjar command line argument and if you are looking to have TestNG use a specific suite file within the jar you would need to provide the location via the command line argument -xmlpathinjar

Below is a sample command:

java -jar target/uber-testjar-demo-1.0-SNAPSHOT-test-jar-with-dependencies.jar \
-testjar target/uber-testjar-demo-1.0-SNAPSHOT-tests.jar \
-xmlpathinjar suites/suite2.xml