This project is a proof of concept for declarative domain testing using Java and Maven. It includes various modules and tests for handling DBLP domain and generating Recommendations domain.
- Java 17 or higher
- Maven (included in the project as a wrapper)
src/main/java: Contains the main application source code.src/test/java: Contains the test source code.src/test/resources: Contains resources used in tests.experiments/: Directory for experiment files.logs/: Directory for log files when execute DBLPExperimentsExecutorcache/: Directory for cache files (only when use cache=true in @DeclarativeTest)libs/: Directory for external libraries.
To run the recommendation tests, follow these steps:
-
Build the Project: Ensure that the project is built using Maven. Run the following command in the project root directory:
./mvnw clean test-compile
-
Run the Recommendation Tests: Execute the recommendation tests using Maven. Run the following command in the project root directory:
./mvnw test -Dtest=RecommendationsTest
This will run all the tests related to recommendations.
To execute the DBLP experiments using DBLPExperimentsExecutor, follow these steps:
-
Build the Project: Ensure that the project is built using Maven. Run the following command in the project root directory:
./mvnw clean test-compile
-
Run the Executor: Execute the
DBLPExperimentsExecutorclass. You can do this from the command line or your IDE. For command line, use:./mvnw test -Dtest=DBLPExperimentsExecutor
This will run the experiments and generate the results in the logs/ directory.
In this project, you can control the caching behavior of declarative tests using the @DeclarativeTest annotation. By default, caching is disabled, but you can enable or disable it as needed.
To disable caching for a declarative test, set the cache attribute to false:
@DeclarativeTest(cache = false)To enable caching for a declarative test, set the cache attribute to true:
@DeclarativeTest(cache = true)Actually, the cache is not used in this repository tests, but you can enable it by changing the cache attribute in the @DeclarativeTest annotation.
This allows you to control whether the test results should be cached, which can be useful for improving performance during repeated test executions.
In directory cache/ you can see the cache files generated by the tests.
To generate the codeStructureRules file for the DBLP and Recommendations domains, you need to execute the main methods of the RecommendationsCodeStructureFileGenerator and DBLPCodeStructureFileGenerator classes, respectively. These methods require two parameters: the first is the Provider and the second is the output path.
-
Generate
codeStructureRulesfile for the Recommendations domain:./mvnw exec:java -D"exec.mainClass"="edu.upc.fib.inlab.imp.kse.declarative_domain_testing_poc.recommendations.factory.RecommendationsCodeStructureFileGenerator" -D"exec.args"="edu.upc.fib.inlab.imp.kse.declarative_domain_testing_poc.recommendations.factory.RecommendationsDomainModelProvider ." -D"exec.classpathScope"="test"
-
Generate
codeStructureRulesfile for the DBLP domain:./mvnw exec:java -D"exec.mainClass"="edu.upc.fib.inlab.imp.kse.declarative_domain_testing_poc.dblp.factory.DBLPCodeStructureFileGenerator" -D"exec.args"="edu.upc.fib.inlab.imp.kse.declarative_domain_testing_poc.dblp.factory.DBLPDomainModelProvider ." -D"exec.classpathScope"="test"
These files are not necessary to run the tests, but they can be useful to understand the structure of the domain and the rules that are being used in the tests.
- Dependencies: All dependencies are managed through Maven. Ensure that your
pom.xmlfile is correctly configured.
For any further questions or issues, please refer to the project documentation or contact the project maintainers.