How rgupta95/genaitesting works
Main Components
• Core Testing Logic Module: This is primarily housed under src/main/java/com/idea/genai. It includes business logic such as text processing (e.g., textToVector and cosine similarity calculations using Lucene’s StandardAnalyzer).
• BDD Test Layer: Located under src/test. This layer includes:
• Cucumber feature files (in src/test/resources/features) that outline various testing use cases (e.g., GenAIUseCases.feature and LlamaUseCases.feature).
• Step definitions (in src/test/java/com/idea/genai/stepdefinitions) that implement the test scenarios.
• The CucumberRunnerTest which ties the testing framework together.
• External Libraries & Frameworks:
• Langchain4j for interfacing with generative AI models.
• Serenity for test reporting and BDD support.
• Maven for build and dependency management.
• Lucene (inferred from the textToVector method) for tokenization and vector computations.
Relationships and Interactions
• Data Flow: Begin with test scripts (Cucumber features) triggering test executions via Serenity's test runner (represented by CucumberRunnerTest). The test layer’s step definitions call the underlying core testing logic in the main Java package.
• Configuration: Represent build and configuration files (e.g., pom.xml, serenity.properties, and serenity.conf). These files facilitate integration of the various components and standardize execution flows.
Important Architectural Patterns
• Layered Separation: The architecture clearly segregates test definitions (BDD/Cucumber test layer) from the core business logic. This separation enhances test maintainability and allows independent evolution of business logic.
• Modular Design: Each module (core logic, Cucumber step definitions, external integrations) interacts through well-defined interfaces, keeping responsibilities distinct.
• Integration with Third-Party Libraries: The project efficiently integrates multiple external frameworks (Serenity for BDD, Langchain4j for AI integration, Lucene for text processing) to achieve its goal.
Relevant Technologies
• Java & Maven: Fundamental to technology and build management.
• Langchain4j: Serves as the bridge between the testing framework and underlying generative AI models.
• Serenity & Cucumber: Provide the infrastructure for BDD and test reporting.
• Lucene: Provides the terms vectorization via StandardAnalyzer.
• Any test-specific configuration files (like serenity.conf, logback-test.xml) should be marked to show how they customize the behavior of tests.