SAP Commerce employs two distinct tools for code testing: Spock and JUnit. JUnit is readily prepared for SAP Commerce’s unit tests and Java integration tests, whereas Spock is employed in integration tests specifically designed for testing OCC web services. They both help make sure our code works correctly, but they have different ways of doing it.

The utilisation of all three testing methods, unitintegration, and end-to-end testing, is essential in software development. Unit testing plays a critical role in detecting early errors, isolating issues within code components, and validating internal logic. It also facilitates modular design, enhances development agility, and provides rapid feedback. These unit tests act as interactive documentation, ensuring comprehensive coverage. Integration tests, on the other hand, are vital in identifying potential problems in component interactions before they reach the end-to-end testing phase. While end-to-end tests are key in verifying complete system functionality, integration tests serve to pinpoint issues in component cohesion. Both types of tests work in tandem to ensure software quality and performance.

The synergy of these testing approaches offers robust software development practices. The combination of unit, integration, and end-to-end testing remains a cornerstone in achieving high-quality software products.

How does e2y ensure comprehensive test coverage for both frontend and backend components?

For comprehensive test coverage, we use a static code analyser, Sonar, to check the code coverage in every addition in the code. This is to ensure that the code is properly covered, with a minimum coverage percentage, as if the proposal of code addition doesn’t adhere to our standard of code coverage, it won’t be merged, and the operator may need to add more test coverage.

What challenges are likely to arise while executing OCC endpoint testing (integration testing)?

  • Working with integration tests in SAP Commerce presents significant challenges. Setting up a dedicated JUnit testing tenant involves a thorough setup of test data, often requiring the creation of large sets of data. These data sets should accurately replicate real-world scenarios, encompassing core model instances like stores, language, currency, etc. 
  • Coordinating setup and cleanup actions for each test while ensuring data accuracy is complicated due to the randomised order of setup blocks. These hurdles collectively highlight the complexities of crafting effective integration tests within SAP Commerce.
  • The time it takes to execute integration tests is also an issue. Running a single test involves compiling the entire project, preparing the JUnit environment, and then cleaning up the environment, which can be quite time-consuming. Fortunately, SAP Commerce offers a solution in the form of the Testweb front end. This tool enables streamlined test execution, system initialisation, and test suite selection.

How does e2y approach testing the frontend components of SAP Commerce applications (unit and integration testing)?

Testing the frontend components of SAP Commerce applications is vital in ensuring the website or application works well for its users. For Composable Storefront components, we use Unit Testing. This involves examining each individual part of the frontend to ensure it functions properly. Like a puzzle, each component is tested to make sure they fit together perfectly. Similarly, when adding new features, Unit testing also makes sure the changes don’t cause problems with previous development. A key factor that makes unit testing a good choice is its execution speed. Since these tests should be free of any unforeseen issues, you will want to run them directly without involving any other system. 

Testing the frontend components is crucial for SAP Commerce applications to provide a smoothuser-friendly experience and to avoid potential issues that could affect users.

Why is testing the frontend important?

  • Better QualityTesting helps find and fix issues, making the frontend more reliable and less likely to have problems for users.
  • Happy Users: Thorough testing makes sure the website or app is easy to use, which leads to an optimised customer experience.
  • Less Problems: Testing early and often helps catch problems before they become big issues, which saves time and money in the long run.

What challenges are likely to arise while testing frontend functionalities, and how can one overcome them?

  • Making Everything Work on Different Browsers: It’s tough to ensure that a website looks and behaves the same on all web browsers. As frontend developers, we need to apply different configurations and tools to handle these differences
  • Responsive Design, Adapting to Different Devices: Designing the website to work well on various devices (like phones and tablets) can be complex, we use CSS media queries and test on multiple devices and screen sizes to ensure responsiveness and that everything looks good.
  • Working with Delays: Some parts of the website might take time to load or respond, which can cause issues during testing. We use specific coding methods to handle these delays and avoid problems.
  • Checking if Everything Works Properly: Testing everything on a large website can be time-consuming. We focus on the most important parts first and make sure they work perfectly.

How is SAP Commerce testing done, including components, interactions, and system-wide functionality with Frontend and Endpoints APIs?

  1. Component Testing: Testing each component or endpoint separately ensures that it will behave as expected when isolated from the rest of the system.
  2. Integration Testing: Once components are individually verified, continue integration testing to assess how these different endpoints interact with each other and the frontend. Mocking tools like WireMock can be employed to simulate certain endpoints while testing others.
  3. End-to-End Testing: This involves testing the entire flow, from the frontend through all involved endpoints, to ensure the entire system functions as expected.

What challenges are likely to arise during end-to-end testing:

  • Complexity: Due to the intertwined nature of components, identifying the root causes of issues can be challenging.
  • Environment Differences: The differences between staging, QA, and production environments can introduce inconsistencies.
  • Flakiness: End-to-end tests are often more susceptible to being “flaky” or intermittently failing than unit tests.

What role does test automation play in the testing process:

Test automation plays a pivotal role in ensuring rapid feedbackrepeatability, and scalability. These tests can be executed regularly, ensuring regression issues are caught early. They can also be easily scaled to cover a broad spectrum of test scenarios and can be included in CI/CD pipelines for continuous feedback.

Image by vector4stock on Freepik