SE4452A software verification and validation

Assignments # 2

Q1. Review the following

  • High level description of Purchase Order application, attached below
  • The java script code file ‘purchaseOrder.js’ located located at OWL SE 4452A 001 Resources/Assignments/Assignmnet-2

Then use the required specifications attached below to develop effective functional (black box) unit test suite for the project to include:

Q1. a. [15%] Equivalence classes testing

Q1. b. [15%] Boundaries values testing

Q1. c. [15%] Decision table testing

Q1. d. Use mocha, jasmine or any other framework to run the test cases for the “purchaseOrder” code as follows

  1. [45%] provide test case suites code for the above test cases (a, b and c) embedded with appropriate comments and description.
  2. [10%] Isolate the unit tests when applicable using stubs.
  • [15% Bonus] Provide the analysis report of the test and fix the errors when applicable.

Purchase Order Requirements Specifications

The main purpose of the system is to assess the qualified status of the purchase orders based on the client account status, credit status and the product availability as follows.

All orders will be ‘accepted’ with shipping date notification if: o The client has very good account status o The client account status and credit status is good

  • The client account status below good but have good credit status and the product status is available.

All orders will be in ‘pending’ status which is accepted but the shipping date is not specified, if o The client has fair account status, good credit status and the product status limited or sold-out.

  • The client has poor account status, good credit status and the product status is limited.

All orders will be ‘under_review’ which the company needs to do some financial reviews for the client, if: o The client has good account status and credit status is bad. o The client has fair account status and credit status is bad and the product status is available.

All orders will be ‘rejected’ which the company can’t locate this order, if:

  • The client has fair account status; credit status is bad and the product status is limited or sold-out. o The client has poor account status; credit status is good and the product status is sold-out. o The client has poor account status and credit status is bad.

The following are the main variables that are used in the product ordering system with their description, types and cardinalities:

{`
  1. The client structured as {accountAge, accountBalance, creditScore} o accountAge integer >=0 and <=100 o accountBalance integer >=-100 and <=1B o creditScore integer >=0 and <=800
  2. The store structure is array of products {name, quantity} o name string
`}

o quantity integer >=0 and <=100

{`
  1. orderStatus: is the system response to the order request. It is one of the following set: {‘accepted’, ‘pending’, ‘under_review’, ‘rejected’}
  2. accountStatus: is the calculated client’s account status. It is one of the following set: {‘very good’, ‘good’, ’fair’, ‘poor’}
  3. creditStatus: is the calculated client’s credit status. It is one of the following set: {‘good’, ‘bad’}
  4. productStatus: reflects the product quantity status. It is one of the following set: {‘sold-out’, ‘limited’, ‘available’}
  5. storeThreshold: is the threshold for the limited quantity of the products in the store. It is Integer >=0 and <=100
  6. creditCheckMode is the factor used to determine the creditStatus. It is one of the following set:
`}

{`{‘restricted’, ‘default’}`}

Figure 1 below depicts the logic architecture of the Purchase Order system.

se4452a software verification and validation

Figure 1. Purchase Order Logical Architecture

The project includes the following function and requirements:

AccountStatus(account)

Generates and returns the status of the client account (AccountStatus) based on accountFactor:

accountFactor = ageFactor * balanceFactor

It takes the client accountAge and returns the equivalent ageFactor per the following:

It takes the client account balance(accountBalance) and returns the equivalent factor (balanceFactor) per the following:

accountBalance

balanceFactor

Balance < -100 or Balance> 1B

-1

Balance >= -100 and Balance < =0

6

Balance > 0 and Balance < 1000

16

Balance >= 1k and Balance < 50k

30

Balance >= 50k and Balance < 100k

70

Balance >= 100k and Balance <= 1M

200

Balance >1M

500

  1. creditStatus(client, creditCheckMode)

It takes the client credit score (creditScore) and returns the credit status based on the credit check mode (creditCheckMode)

It returns the status of the product in store based on store threshold (storethreshold)

productQuantity

productStatus

0

sold-out

< storethreshold

limited

> = storethreshold

available

  1. “orderHandling(client,product,store,storeThreshold,creditCheckMode)”

Receives the order from the client for a product (name) in specific store with specific storeThreshold and creditCheckMode, then returns the orderStatus based on the following conditions:

orderStatus

Conditions

‘accepted’

‘very good’ accountStatus

‘good’ accountStatus and creditStatus

‘poor’ or ‘fair’ accountStatus, ‘good’ creditStatus and ‘available’ productStatus.

‘pending’

‘fair’ accountStatus, ‘good’ creditStatus and ‘limited’ or ‘sold-out’ productStatus.

‘poor’ accountStatus, ‘good’ creditStatus and ‘limited’ productStatus.

‘underReview’

‘good’ accountStatus and ‘bad’ creditStatus

‘fair’ accountStatus, ‘bad’ creditStatus and ‘available’ productStatus

‘rejected’

‘fair’ accountStatus, ‘bad’ creditStatus and ‘limited’ or ‘sold-out’ productStatus.

‘poor’ accountStatus, ‘good’ creditStatus and ‘sold-out’ productStatus.

‘poor’ accountStatus and ‘bad’ creditStatus