Validation Constraints in ImpEx
You can define validation constraints in ImpEx files, making it easy to reload constraints after initializing the database.
Validation constraints are persisted to the database. If you frequently reinitialize the database during the development and testing phase of your project, there is a danger that you could erase any stored constraints. To ease the effort of restoring validation constraints, it is a good idea to define and load them using ImpEx files.
Define a Validation Constraint Using ImpEx
Define and load validation constraints using ImpEx files.
Prerequisites
public void testValidationConstraintAfterImpex() {
loginToBackOffice();
modifyABandToHaveNegativeAlbumSales();
if (VersionHelper.getVersion().equals(Version.V2205) || VersionHelper.getVersion().equals(Version.V2211))
waitFor("div","You have 1 Validation Messages");
else
waitFor("div","You have 1 Validation Errors");
assertTrue( waitFor("span","Album sales must not be negative"));
}
Before you begin this step, run the test to confirm that it fails by executing this command:
cd $HYBRIS_HOME_DIR/hybris123; mvn -Dtest=com.hybris.hybris123.runtime.tests.Hybris123Tests#testValidationConstraintAfterImpex test
cd %HYBRIS_HOME_DIR%\hybris123 & mvn -Dtest=com.hybris.hybris123.runtime.tests.Hybris123Tests#testValidationConstraintAfterImpex test

