Skip to main content

webforJ testing

Open in ChatGPT

Testing in webforJ apps combines unit, frontend, and end-to-end (E2E) testing, each serving a distinct purpose in keeping the app stable and reliable.

Unit testing​

Unit testing focuses on verifying individual components or backend logic in isolation. By following standard Java testing practices, such as using JUnit, developers can validate specific app logic and check that each "unit" performs as expected.

For views and components, the TestBed does browserless testing in plain JUnit tests without a browser or a server. A test adds a view to the page, acts on it the way a user does, and checks the result from Java.

Frontend testing​

Frontend testing covers the sources a project authors with the frontend bundler. The Bun test runner runs them as part of the same build that runs the Java tests, so a TypeScript component or a piece of client logic is verified the same way the backend is. See Frontend testing.

End-to-End (E2E) testing​

End-to-end testing validates what users experience in webforJ apps, which generate dynamic, single-page web interfaces. These tests simulate user interactions and verify the features of the entire app.

Using tools like Selenium and Playwright, you can:

  • Automate browser interactions by simulating button clicks and form submissions.
  • Verify consistent rendering and interactivity of dynamic UI components.
  • Confirm that behavior stays consistent across browsers and devices.

Combining testing strategies​

By combining unit and E2E testing:

  1. Isolate issues: detect and resolve component-level bugs early with unit testing.
  2. Confirm reliability: validate complete user journeys and system integrations with E2E testing.

Topics​