Need advice about which tool to choose?Ask the StackShare community!
Selenide vs TestNG: What are the differences?
Key Differences between Selenide and TestNG
Selenide and TestNG are two popular tools used in software testing, but they have distinct differences in their functionalities and features.
Test Framework vs. Browser Automation Library: Selenide is primarily a browser automation library built on top of Selenium WebDriver, providing a more user-friendly and concise API for writing browser automation tests. On the other hand, TestNG is a full-fledged test framework that supports various test types, including unit, functional, and end-to-end tests, offering advanced test management and reporting capabilities.
Configuration and Dependency Handling: Selenide focuses on simplicity and minimizing the need for configuration. It provides sensible default configurations and automatically manages dependencies such as browser drivers. In contrast, TestNG allows more flexibility in configuring various aspects of test execution, such as test parallelization, test dependencies, and custom listeners.
Test Organization and Execution: Selenide encourages a more structured test organization by providing out-of-the-box support for Page Object Model (POM) pattern and Fluent Interface design. It also simplifies test execution by handling dynamic waits and synchronizations implicitly. TestNG, on the other hand, provides a comprehensive test organization framework with annotations, allowing users to create test suites, set up pre and post test conditions, and define test priorities and groups.
Assertions and Verifications: Selenide enhances the assertion capabilities of Selenium WebDriver by providing a set of highly expressive and concise methods for element checks and page validations. It also automatically retries assertions for a configurable period, reducing the flakiness of browser tests. TestNG offers a range of assertion methods as part of its assertion API, enabling users to perform complex verifications and define custom assertion failure messages.
Test Reporting and Logging: Selenide provides built-in reporting capabilities that generate clear and concise HTML reports with screenshots, detailed error messages, and failed browser console logs. It also outputs rich logging information during test execution. TestNG, being a comprehensive test framework, offers customizable report generation with detailed test execution results, including configuration parameters, test durations, and test failures, which can be integrated with various tools such as Jenkins.
Test Data Management: Selenide does not specifically provide features for managing test data. Users need to handle test data independently, either by creating test data in test fixtures or by utilizing external test data providers. In contrast, TestNG includes features for parameterizing tests and supports various data providers, enabling users to supply test data from different sources (e.g., XML, CSV, databases) for data-driven testing scenarios.
In summary, Selenide is predominantly focused on simplifying browser automation and enhancing the Selenium WebDriver API, while TestNG provides a broader set of features for comprehensive test organization, execution, and reporting, including support for multiple types of tests and advanced test data management capabilities.
Hi, I am starting out to test an application that is currently being developed - FE: React. BE: Node JS. I want the framework to be able to test all UI scenarios (from simple to complex) and also have the capability to test APIs. I also need to run tests across all OSs and Browsers (Windows, Mac, Android, iOS). I have also looked into react-testing-library and @TestProject.io. Any advice you can give as to which framework would be best and why would be so much appreciated! Thank you!!
You should also definitely look into Playwright, which is a new automation tool from Microsoft building on top of the Puppeteer experience and trying to bring this experience in the cross browser space - very exciting project. Great team. Also CodeceptJS as already Playwright support which at a ton of valuable features on top of Playwright, give it a go!
I'm also looking for the same, FE: React & BE: NodeJS. Cypress won't help as it lacks cross-browser testing, it doesn't support all the browsers. I'm still investigating it, but looks like WebdriverIO may fulfil what I'm looking for - Cross-browser testing, integration with CI/CD, running it as a docker service, good support on assertions & reporting of test results. Let me know if you found any information on any of the above mentioned points.
Hi Esther, if you really need cross OS and cross device automation Cypress wont help, with WebdriverIO you can do it … and check out CodeceptJS, which is a wrapper around several frameworks (like WebdriverIO) and will support future players (currently for example upcoming Playwright) as well.
Pros of Selenide
- Nice JAVA API5
- Very mature API2
- File upload support2
- Integrated with WebDriverManager project2
- Integrated with Selenium-Jupiter framework2
- Capture screen shots on fail1
- Cross browser1
- Proxy server1
Pros of TestNG
Sign up to add or upvote prosMake informed product decisions
Cons of Selenide
- Hybrid page model not possible1