Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SuiteRunner could not be initial by default Configuration #2743

Closed
2 of 7 tasks
bj-9527 opened this issue Mar 22, 2022 · 0 comments · Fixed by #2744
Closed
2 of 7 tasks

SuiteRunner could not be initial by default Configuration #2743

bj-9527 opened this issue Mar 22, 2022 · 0 comments · Fixed by #2744
Milestone

Comments

@bj-9527
Copy link
Contributor

bj-9527 commented Mar 22, 2022

TestNG Version

7.5

Expected behavior

SuiteRunner could init by default Configuration

Actual behavior

Caused by: java.lang.NullPointerException
	at org.testng.internal.objects.SimpleObjectDispenser.instantiateUsingDefaultConstructor(SimpleObjectDispenser.java:178)
	at org.testng.internal.objects.SimpleObjectDispenser.createInstance(SimpleObjectDispenser.java:87)
	... 46 more

Is the issue reproducible on runner?

yes, here is a sample code

public class IssueTest {
  @Test
  public void issueTest() {
    XmlSuite suite = new XmlSuite();
    suite.setName("TestSuite");
    XmlTest test = new XmlTest(suite);
    test.setName("ChildTests");
    List<XmlClass> classes = new ArrayList<>();
    classes.add(new XmlClass("test.configuration.suites.IssueTest"));
    test.setXmlClasses(classes);

    final IConfiguration configuration = new Configuration();
    final boolean useDefaultListeners = true;

    SuiteRunner baseSuiteRunner = new SuiteRunner(configuration, suite,
        "outputDir",
        new ITestRunnerFactory() {

          @Override
          public TestRunner newTestRunner(ISuite suite, XmlTest xmlTest,
                                          Collection<IInvokedMethodListener> listeners, List<IClassListener> classListeners) {
            TestRunner runner =
                new TestRunner(configuration, suite, xmlTest,
                    false /* skipFailedInvocationCounts */,
                    listeners, classListeners);
            if (useDefaultListeners) {
              runner.addListener(new TestHTMLReporter());
              runner.addListener(new JUnitXMLReporter());
            }

            return runner;
          }

        },
        useDefaultListeners,
        Comparator.comparingInt(ITestNGMethod::getPriority));
    baseSuiteRunner.run();
  }
}
  • Shell
  • Maven
  • Gradle
  • Ant
  • Eclipse
  • IntelliJ
  • NetBeans

Test case sample

Please, share the test case (as small as possible) which shows the issue

Contribution guidelines

Incase you plan to raise a pull request to fix this issue, please make sure you refer our Contributing section for detailed set of steps.

bj-9527 added a commit to bj-9527/testng that referenced this issue Mar 22, 2022
bj-9527 added a commit to bj-9527/testng that referenced this issue Mar 22, 2022
bj-9527 added a commit to bj-9527/testng that referenced this issue Mar 22, 2022
@krmahadevan krmahadevan added this to the 7.6.0 milestone Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants