Used for performing auto tests on various modules. All modules are not installed to local repository.
This is a Maven multi-module project containing the following test modules:
- commons - Common test utilities module
- dbmatrix - The same scenarios on every test database (not in the default build, run by hand, see below)
- chart - Chart testing module
- css - CSS style testing module
- docker - Docker related testing module
- mv - MV testing module
- olap - OLAP testing module
- tabular - Tabular testing module
- vpm - VPM testing module
- vsexport - VS export testing module
- vsothers - VS other features testing module (contains multiple test modes)
- vsscript - VS script testing module
- ws - Worksheet testing module
The project requires a license key to run tests. You can configure it in the following ways:
Pass the license key directly via command line:
# Windows PowerShell
.mvnw.cmd test -pl vsscript -Dinetsoft.license.key="your-license-key"
# Linux/Mac bash
./mvnw test -pl vsscript -Dinetsoft.license.key="your-license-key"Set the license key as an environment variable:
# Windows PowerShell
$env:INETSOFT_LICENSE_KEY = "your-license-key"
.mvnw.cmd test -pl vsscript
# Windows CMD
set INETSOFT_LICENSE_KEY=your-license-key
mvnw.cmd test -pl vsscript
# Linux/Mac bash
export INETSOFT_LICENSE_KEY="your-license-key"
./mvnw test -pl vsscriptFirst, clean all projects, then package the commons module to your local Maven repository:
.\mvnw.cmd clean
.\mvnw.cmd package -pl commonsThe following modules have only one test mode and can be executed directly:
# Worksheet tests
.\mvnw.cmd test -pl ws
# Chart tests
.\mvnw.cmd test -pl chart
# CSS tests
.\mvnw.cmd test -pl css
# OLAP tests
.\mvnw.cmd test -pl olap
# Tabular tests
.\mvnw.cmd test -pl tabular
# VPM tests
.\mvnw.cmd test -pl vpm
# VS export tests
.\mvnw.cmd test -pl vsexport
# VS script tests
.\mvnw.cmd test -pl vsscriptThe vsothers module contains multiple test modes. Use the -P parameter to specify the profile:
# VSCalc tests
.\mvnw.cmd test -pl vsothers -Pvscalc
# VSCrosstab tests
.\mvnw.cmd test -pl vsothers -Pvscrosstab
# VSFreehand tests
.\mvnw.cmd test -pl vsothers -Pvsfreehand
# VSPara tests
.\mvnw.cmd test -pl vsothers -Pvspara
# OtherAssembly tests
.\mvnw.cmd test -pl vsothers -PotherassemblyThe mv module also has one profile per test mode. Without -P only topmv runs.
.\mvnw.cmd test -pl mv -Ptopmv
.\mvnw.cmd test -pl mv -Psubmv
.\mvnw.cmd test -pl mv -Pincrementalmv
.\mvnw.cmd test -pl mv -Pvpm
.\mvnw.cmd test -pl mv -Pothers
.\mvnw.cmd test -pl mv -Pwsmvwsmv runs one path through a worksheet MV (WSMV_Path_Spec): it turns ws.mv.enabled on, creates the MV for the worksheet only, checks that the viewsheet reads it, and updates it incrementally. Like IncrementalDataChange_Spec it changes the H2 file, see below.
The profiles share the MV storage under mv/target. When running several of them one after another locally, delete mv/target before each one, or rows left by the previous profile make results differ.
The others profile runs every spec class in its own JVM (mv.reuseForks=false). With -Dmv.compare=nomv or both, the whole profile in one JVM fills the 2 GB heap at VSActions_Spec and stops in XSwapper.waitForMemory. Add -Dmv.reuseForks=true to run it in one JVM; set it to false to do the same in another profile.
-Dmv.compare selects how the MV results are checked:
golden(default): compare withexpectData.nomv: in the cases that callMVTest.executeVSWithoutMV(intopmv,submv,vpmandothers), run the viewsheet before its MV is created and compare every exported file with the result read from the MV (MVTest.compareWithoutMV), instead ofexpectData. The files without MV end with__NoMV.txt. The other cases, and the files of an incremental update, are still compared withexpectData.both: both checks.
.\mvnw.cmd test -pl mv -Ptopmv "-Dmv.compare=nomv"nomv only shows that the MV does not change the result. A bug shared by the MV and the database paths gives the same wrong result twice, and only expectData finds it. It is not used in incrementalmv: MV delete conditions and incremental updates make the MV hold different rows than the database on purpose. Incremental results are compared with expectData, except in IncrementalDataChange_Spec, which compares them with an MV rebuilt on the final data (MVTest.compareWithRebuild) or with the rows it expects.
IncrementalDataChange_Spec (in incrementalmv) creates and drops tables in the H2 database docker/src/test/resources/H2Data/mvorder1.mv.db, and H2 rewrites the file even though the tables are dropped. Restore it before committing:
git checkout -- docker/src/test/resources/H2Data/dbmatrix runs the same scenarios on every test database server (Oracle, MySQL, Derby, PostgreSQL, SQL Server, DB2, Informix, and ClickHouse and H2 for their own samples) and compares the result pushed down to SQL with the same operation computed in memory. Today it holds worksheet specs (WSMultiDB_Spec: cross-database samples and dialect checks; WSPair_Spec, WSPairDst_Spec: pushed / in-memory pairs). Viewsheet specs for the same comparison will be added here. The cases and test points (case × database, column type × operator) are listed in dbmatrix/README.md; update it when cases change.
It is slow (more than an hour) and needs all database servers, so it is not part of the default build (mvnw test without -Pdbmatrix does not build it) and its GitHub workflow (DBMatrix Module Tests, test-dbmatrix.yml) only runs when started by hand. Run it:
- once for each new stylebi version, and before a release;
- when stylebi changes SQL generation, a database dialect (
sqlhelper.xml, the SQL helpers), what is pushed down to the database, conditions, date grouping, joins or aggregates; - when a bug found by these specs is fixed (update the baseline or remove the
WSPair_SpecALLOWEDentry; the spec fails on an entry that no longer differs); - after changing the test database servers or their data.
.\mvnw.cmd test -Pdbmatrix -pl dbmatrix
# only some databases of the pair specs
.\mvnw.cmd test -Pdbmatrix -pl dbmatrix "-Dtest=WSPair_Spec,WSPairDst_Spec" "-Dpair.dbs=MySQL,Oracle"Its worksheets are in dbmatrix/src/test/resources/config/dbmatrix-storage.zip, generated by the scripts in .claude/workflow-shared/datatest-gap/ (zip chain in its README; ws_dbmatrix_split.py derives the ws zip from it).
DateComparison_Spec (chart) and Crosstab_DateComparsion_Spec (vsothers, run with -Pvscrosstab) use DcViewsheetTest instead of ViewsheetTest:
- an export failure fails the test (it is only printed in
ViewsheetTest); - when no file names are given, every
.txtand.pngfile under the case'sexpectDatafolder must have been exported by the run; exportAsPDFexports the(Home)bookmark by default.
To update the baselines, add -Dupdate.baseline=true. The exported files are copied into the module's src/test/resources/expectData and nothing is compared. Review the result with git diff.
# update the data (txt) baselines of one case
.\mvnw.cmd test -pl chart "-Dtest=DateComparison_Spec#Quarter_SameWeek" -Dupdate.baseline=true
# also overwrite existing png baselines
.\mvnw.cmd test -pl chart "-Dtest=DateComparison_Spec#Quarter_SameWeek" -Dupdate.baseline=true -Dupdate.baseline.png=trueA .txt baseline is always written. A .png baseline is only written when it is missing, unless -Dupdate.baseline.png=true is set, because pngs rendered on another platform differ on pixels. A baseline that is no longer exported is not deleted: remove it by hand. Run mvnw clean before a run after removing baselines, otherwise the old copy in target/test-classes/expectData is still checked.
# Clean specific module
.\mvnw.cmd clean -pl vsothers -Pvscalc
# Generate test resources (debug mode)
.\mvnw.cmd generate-test-resources -pl vsothers -Pvscalc -X
# Package (skip tests)
.\mvnw.cmd package -DskipTests -pl wsAfter tests complete, you can view test results in the following ways:
Test reports are located in the target/spock-reports directory of each module:
<module-name>/target/spock-reports/index.html
For example:
ws/target/spock-reports/index.htmlvsothers/target/spock-reports/index.html
Open the index.html file in a browser to view detailed test reports.
JUnit format test reports are located in the target/surefire-reports directory of each module:
<module-name>/target/surefire-reports/
This directory contains:
TEST-*.xml- JUnit XML format test results*.txt- Test output logs
# Create new branch from main
git checkout -b feature/your-feature-name# Add files to staging area
git add <file-name>
# Or add all changes
git add .
# Commit changes
git commit -m "Describe your changes"# Push branch to remote
git push -u origin feature/your-feature-nameAfter pushing your branch, on your Git hosting platform (GitHub, GitLab, etc.):
- Go to the repository page
- You'll usually see a prompt "Compare & pull request", click it
- Or manually:
- Click the "Pull Requests" tab
- Click "New Pull Request"
- Select your branch and target branch (usually
main) - Fill in PR title and description
- Add reviewers (if needed)
- Click "Create Pull Request"
- commons Module: Must package the
commonsmodule before running any tests - Test Resources: Ensure test resource files (config files, test data) are correctly placed
- Java Version: Project requires Java 21
- Memory Settings: Some tests may require large memory. If encountering out-of-memory errors, adjust JVM parameters
The project supports using Testcontainers to automatically start database containers for testing. This is controlled by the use.testcontainers parameter.
Add the -Duse.testcontainers=true parameter when running tests:
# Windows PowerShell
.mvnw.cmd test -pl vsothers -Pvscalc -Duse.testcontainers=true
# Linux/Mac bash
./mvnw test -pl vsothers -Pvscalc -Duse.testcontainers=trueWhen use.testcontainers=true, you need to add the following entries to your system's hosts file to map database hostnames to localhost.
Example:
127.0.0.1 mysql_server
127.0.0.1 db2_server
Note: The actual hostnames depend on the databases used in your specific tests. Please refer to your test case configurations to determine which host entries are required.
Edit the file C:\Windows\System32\drivers\etc\hosts with administrator privileges.
Edit the file /etc/hosts with sudo:
sudo nano /etc/hostsBy default, Testcontainers is disabled (use.testcontainers=false). Tests will use pre-configured database connections instead of starting containers.
Docker environment testing configuration is pending (@TODO)