# Manual Integration Test: OData Products App

## DESCRIPTION

Test for the sap.ui.model.odata.type.Unit and sap.ui.model.odata.type.Currency types

## PREPARATION

To check console errors, open the developer tools before starting the application and check with each step that there are no errors and warnings.

### Testing with mock data

Start the Products application with the following URL (adjust host and port if necessary):

- local: http://localhost:8080/test-resources/sap/ui/core/demokit/sample/common/index.html?component=odata.v4.Products&sap-ui-language=EN

### Testing with back end

Configure your IDE to be able to execute the Products application against an ABAP back-end system.
Start the Products application with the URL (adjust host and port if necessary):

- local: http://localhost:8080/test-resources/sap/ui/core/demokit/sample/common/index.html?component=odata.v4.Products&realOData=true&sap-ui-language=EN

## REALIZE and CHECK

### Check whether measures are handled properly regarding decimal places defined for the corresponding unit code

#### Testing with mock data

For testing, you may use the following valid unit codes:

- KG and G (0 decimal places)
- % (0 decimal places)
- DEG (1 decimal places)
- NO (2 decimal places)
- M/L (3 decimal places)
- μG (6 decimal places)

For a complete list of valid unit codes, see the "ExternalCode" property of the objects linked in "Unit Codes" in the test application.

#### Testing with back end

For testing, you may try and use the unit codes listed in "Testing with mock data"; depending on the back end they may however not be available in the back-end customizing. Note: Although %, DEG, NO and M/L are valid, the back end does not accept them as they are no weight units; you see a corresponding error message "Invalid weight unit..." when saving a weight with one of these units upon leaving the weight input field. For a complete list of valid unit codes, see the "ExternalCode" property of the objects linked in "Unit Codes" in the test application.

#### Test measures

- Check: Weights in the table are displayed with the number of decimal places associated with the corresponding unit.
- Change the weight for a product in the table to "12.3 NO" and leave the input field.
- Check: The weight is formatted with the decimal places associated with the entered unit code to "12.30 NO".
- Change the weight to "21".
- Check: The weight is formatted with the decimal places associated with the previous unit code to "21.00 NO".
- Change the weight to "12.345 NO".
- Check: You see a validation error message "Enter a number with a maximum of 2 decimal places" and the weight field shows an invalid data state.
- Change the weight unit to an invalid code such as 'XYZ'.
- Check: You see an error message and the weight field shows an invalid data state.
- Change the weight to "32".
- Check: The weight is formatted with the decimal places associated with the last valid unit code 'NO' to "32.00 NO".

Test the following with mock data only

- Change the weight of the product 'Notebook New' which has no weight yet to "42".
- Check: The weight is formatted to "42" and the field has no invalid data state.
- Change the weight of the product 'Notebook New' to "KG".
- Check: You see an error message and the weight field shows an invalid data state.

### Check whether currencies are handled properly regarding decimal places defined for the corresponding currency code

#### Testing with mock data

Execute the test with "EUR3" which has 3 decimal places in case mock data is used. In addition, you may use the following valid currency codes for testing:

- JPY (0 decimal places)
- EUR and USD (2 decimal places)
- BHD (3 decimal places)

For a complete list of valid currency codes, see the "CurrencyCode" property of the objects linked in "Currency Codes" in the test application.

#### Testing with back end

For testing, you may use the currency codes listed in "Testing with mock data"; depending on the back end they may however not be available in the back-end customizing. For a complete list of valid currency codes, see the "CurrencyCode" property of the objects linked in "Currency Codes" in the test application.

#### Test currencies

- Check: Prices in the table are displayed with the number of decimal places associated with the corresponding currency.
- Change the price for a product in the table to "12.3 USD" and leave the input field.
- Check: The price is formatted with the decimal places associated with the entered currency code to "12.30 USD".
- Change the price to "21".
- Check: The price is formatted with the decimal places associated with the previous currency code to "21.00 USD".
- Change the price to "12.345 USD".
- Check: You see a validation error message "Enter a number with a maximum of 2 decimal places" and the price field shows an invalid data state.
- Change the currency to an invalid code such as 'XYZ'.
- Check: You see an error message and the price field shows an invalid data state.
- Change the price to "32".
- Check: The price is formatted with the decimal places associated with the last valid currency code 'USD' to "32.00 USD".
- Change the price to "42 $".
- Check: The price is formatted with the decimal places associated with the entered currency code to "42.00 USD".

Test the following with mock data only

- Change the price of the product 'Notebook New' which has no price yet to "42".
- Check: The price is formatted to "42.00" and the field has no invalid data state.
- Change the price of the product 'Notebook New' to "EUR".
- Check: You see an error message and the price field shows an invalid data state.

#### Test creation of a new entry

Test the following with mock data only

- Enter a new entity in the 'New Entry' form. Set the product ID to '0123456789ABC'. Select the next input field.
- Check: You see an error message and the product ID field shows an invalid data state. The 'Add' button is disabled.
- Press the 'Clear Row' button.
- Check: The 'Add' button is enabled.
- Check: Every field in the New Entry form is cleared and the error message disappears.
- Enter a new entity in the 'New Entry' form. Set the product ID to 'Do not add'. Set the product name to 'Do not add'. Set the weight to '20 KG'. Set the price to '600 USD'.
- Press the 'Clear Row' button.
- Check: Every field in the New Entry form is cleared.
- Enter a new entity in the 'New Entry' form. Set the product ID to 'H-100'. Set the product name to 'Notebook Basic 16'. Set the weight to '18 KG'. Set the price to '700 USD'.
- Press the 'Add' button.
- Check: Every field in the 'New Entry' form is cleared and a new line is added to the beginning of 'Products' table showing the data you just entered. An error message "Value 'H-100' is not unique" is displayed and the product ID is editable in that line.
- Change the product ID to 'H-1001' and press Tab.
- Check: The product ID is not editable any longer. The other values remain unchanged.