Skip to content

getting-started.md's LoginTest.java example is missing 'package com.example;', breaking testng.xml's class reference #47

Closed

Description

@shossain786

File: docs-site/docs/getting-started.md, Step 3's code block, headed src/test/java/com/example/LoginTest.java.

The code block itself never declares package com.example; — it opens straight into the imports. Step 4's testng.xml then references the fully-qualified com.example.LoginTest.

Repro

Copy Steps 1-4 verbatim into a fresh project (bare <dependency> snippet, selenium-boot.yml, LoginTest.java, testng.xml) and run mvn test.

Actual output

Compiles cleanly — no compiler error points at the real cause. Fails at test-run instead:

[ERROR] Cannot find class in classpath: com.example.LoginTest
[ERROR] org.apache.maven.surefire.booter.SurefireBooterForkException: There was an error in the forked process

The class actually compiles into the default (unnamed) package, so testng.xml's com.example.LoginTest reference can't find it. Nothing in that error message points a new user back at the missing package line.

Confirmed the fix: adding package com.example; as the first line of LoginTest.java (matching its com/example/ directory) makes the suite discover the class immediately and the test runs.

Suggested fix

Add package com.example; as the first line of the Step 3 code block.

Activity

  1. GameMaster97 commented on Sep 15, 2026

    @GameMaster97

    i added what you suggested

  2. shossain786 commented on Sep 15, 2026

    @shossain786
    ContributorAuthor

    Closing — this was filed against a stale local checkout (hadn't pulled #44, merged 09-12, which independently rewrote this whole Step 3 example). On current master the bug doesn't exist: SmokeTest.java lives at src/test/java/SmokeTest.java with no package, and testng.xml already references it unqualified. Verified passing as-is. Not a wontfix — the ground just moved out from under the report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions