Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
348 views
in Technique[技术] by (71.8m points)

java - TestNG - "Unable to parse suite" error when trying to run an XML file

I am developing a test automation project using: IntelliJ, Maven, TestNG and Selenium Webdriver. The problem is that I am unable to run XML suite files. Right-clicking on such file gives me the option to run them but it fails with error: Unable to parse suite: InputStream cannot be null

There is no more info provided. TestNG plugin is installed and active. Run Configuration has TestNG option.

Here is the XML file that I am trying to run:

<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">

<suite name="All Test Suite" verbose="1">
    <parameter name="environment" value="chrome"/>
    <parameter name="remoteRun" value="false"/>

    <test name="Regression12">
        <classes>
            <class name="tests.SampleTest"/>
        </classes>
    </test>
</suite>

I was looking for an answer online but there is not much and none of the solutions work in my case. I was trying to change the location of the XML files but I didn't change anything.

Thanks for the help and please tell me if I should provide some more info.

IntelliJ version is 2020.3.2 - no updates for IDE or plugins are available so everything is up to date. I'm running it on Windows 10.

Update: Here is the stacktrace from IntelliJ after running an XML file. There is one error regarding "SLF4J" dependency (logging) but I don't think it's related to my problem.

2021-02-08 09:10:23,605 [ 282317]   INFO - ij.compiler.impl.CompileDriver - COMPILATION STARTED (BUILD PROCESS) 
2021-02-08 09:10:23,609 [ 282321]   INFO - j.compiler.server.BuildManager - Using preloaded build process to compile C:/Users/customname/IdeaProjects/customname-project-automated-tests 
2021-02-08 09:10:23,781 [ 282493]   INFO - lij.compiler.impl.CompilerUtil -     COMPILATION FINISHED (BUILD PROCESS); Errors: 0; warnings: 0 took 186 ms: 0 min 0sec 
2021-02-08 09:10:24,713 [ 283425]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2020.3.2/plugins/java/lib/jps-launcher.jar 
2021-02-08 09:10:24,799 [ 283511]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 
2021-02-08 09:10:24,800 [ 283512]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Defaulting to no-operation (NOP) logger implementation 
2021-02-08 09:10:24,800 [ 283512]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 
2021-02-08 09:10:26,197 [ 284909]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: WARNING: An illegal reflective access operation has occurred 
2021-02-08 09:10:26,197 [ 284909]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: WARNING: Illegal reflective access by com.intellij.util.ReflectionUtil (file:/C:/Program%20Files/JetBrains/IntelliJ%20IDEA%20Community%20Edition%202020.3.2/lib/util.jar) to method java.util.ResourceBundle.setParent(java.util.ResourceBundle) 
2021-02-08 09:10:26,197 [ 284909]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: WARNING: Please consider reporting this to the maintainers of com.intellij.util.ReflectionUtil 
2021-02-08 09:10:26,197 [ 284909]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations 
2021-02-08 09:10:26,197 [ 284909]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: WARNING: All illegal access operations will be denied in a future release 
2021-02-08 09:10:29,381 [ 288093]   INFO - rationStore.ComponentStoreImpl - Saving Project(name=TestNGTemplateProject, containerState=COMPONENT_CREATED, componentStore=C:UserscustomnameIdeaProjectscustomname-project-automated-tests)Kotlin2JvmCompilerArguments took 20 ms 

question from:https://stackoverflow.com/questions/66061776/testng-unable-to-parse-suite-error-when-trying-to-run-an-xml-file

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...