Skip to content

Latest commit

 

History

History
1165 lines (692 loc) · 51.6 KB

UnitTestReport.md

File metadata and controls

1165 lines (692 loc) · 51.6 KB

Unit Testing Documentation template

Authors: Alessandro Versace, Alessandro Landra, Ivan Lombardi, Zhou Chenghan,

Date: 19/5/2021

Version: V1.0

Contents


Black Box Unit Tests

<Define here criteria, predicates and the combination of predicates for each function of each class.
Define test cases to cover all equivalence classes and boundary conditions.
In the table, report the description of the black box test case and the correspondence with the JUnit black box test case name/number>

Method BalanceOperationObj.setBalanceId

Criteria for method BalanceOperationObj.setBalanceId

  • content of input

Predicates for method BalanceOperationObj.setBalanceId

Criterion Predicate
content of input [-inf,0)
[0,inf]

Combination of predicates for method BalanceOperationObj.setBalanceId

content of input Valid/Invalid Description of the test case JUnit test case
[-inf,0) invalid setBalanceId(-1223);
getBalanceId()==-1223;
testBanlanceOperationObjSetBalanced
[0,inf] valid setBalanceId(1223);
getBalanceId()==1223;

Method BalanceOperationObj.setDate

Criteria for method BalanceOperationObj.setDate

  • get the same value with input

Predicates for method BalanceOperationObj.setDate:

Criterion Predicate
get the same value with input yes
no

Combination of predicates for method BalanceOperationObj.setDate

get the same value with input Valid/Invalid Description of the test case JUnit test case
yes valid setDate(2007-4-12);
getDate()==2007-4-12;
->true
testBanlanceOperationObjSetDate
no valid setDate(2007-4-12);
getDate()!=2007-4-12;
->true

Method BalanceOperationObj.setMoney

Criteria for method BalanceOperationObj.setMoney

  • content of input

Predicates for method BalanceOperationObj.setMoney

Criterion Predicate
content of input [-inf, 0.0)
[0.0, inf]

Combination of predicates for method BalanceOperationObj.setMoney

get the same value with input Valid/Invalid Description of the test case JUnit test case
[-inf, 0.0) invalid setMoney(-1.223);
getMoney()==-1.223;
testBanlanceOperationObjSetMoney
[0.0, inf] valid setMoney(1.223);
getMoney()==1.223;

Method BalanceOperationObj.setType

Criteria for method BalanceOperationObj.setType

  • availability of type string

Predicates for method BalanceOperationObj.setType:

Criterion Predicate
availability of type string CREDIT
DEBIT
others

Combination of predicates for method BalanceOperationObj.setType

availability of type string Valid/Invalid Description of the test case JUnit test case
others valid setType("qweqd");
getType()=="DEBIT";
->true
testBanlanceOperationObjSetType
CREDIT valid setType("CREDIT");
getType()=="CREDIT";
->true
DEBIT valid setType("DEBIT");
getType()=="DEBIT";
->true

Method CreditCardObj.setMoney

Criteria for method CreditCardObj.setMoney

  • get the same value with input

Predicates for method CreditCardObj.setMoney:

Criterion Predicate
get the same value with input yes
no

Combination of predicates for method CreditCardObj.setMoney

get the same value with input Valid/Invalid Description of the test case JUnit test case
yes valid setMoney(1.223);
getMoney()==1.223;
->true
testCreditCardObjSetMoney
no valid setMoney(1.223);
getMoney()!=1.223;
->true

Method CustomerObj.setCustomerName

Criteria for method CustomerObj.setCustomerName

  • content of input

Predicates for method CustomerObj.setCustomerName

Criterion Predicate
content of input 0-9, A-Z, a-z, special characters
null

Combination of predicates for method CustomerObj.setCustomerName

content of input Valid/Invalid Description of the test case JUnit test case
0-9, A-Z, a-z, special characters valid setCustomerName("1.2231dsaas!@#");
getCustomerName()=="1.2231dsaas!@#";
testCustomerObjSetCustomerName
null invalid setCustomerName();
getCustomerName()==not null;

Method CustomerObj.setCustomerCard

Criteria for method CustomerObj.setCustomerCard

  • content of input

Predicates for method CustomerObj.setCustomerCard

Criterion Predicate
content of input 0-9, A-Z, a-z, special characters
null

Combination of predicates for method CustomerObj.setCustomerCard

content of input Valid/Invalid Description of the test case JUnit test case
0-9, A-Z, a-z, special characters valid setCustomerCard("1.2231dsaas!@#");
getCustomerCard()=="1.2231dsaas!@#";
testCustomerObjSetCustomerCard
null invalid setCustomerCard();
getCustomerCard()==not null;

Method CustomerObj.setId

Criteria for method CustomerObj.setId

  • content of input

Predicates for method CustomerObj.setId

Criterion Predicate
content of input [-inf,0)
[0,inf]

Combination of predicates for method CustomerObj.setId

content of input Valid/Invalid Description of the test case JUnit test case
[-inf,0) invalid setId(-1223);
getId()==-1223;
testCustomerObjSetId
[0,inf] valid setId(1223);
getId()==1223;

Method CustomerObj.setPoints

Criteria for method CustomerObj.setPoints

  • content of input

Predicates for method CustomerObj.setPoints

Criterion Predicate
content of input [-inf, 0.0)
[0.0, inf]

Combination of predicates for method CustomerObj.setPoints

get the same value with input Valid/Invalid Description of the test case JUnit test case
yes valid setPoints(1223);
getPoints()==1223;
->true
testCustomerObjSetPoints
no valid setPoints(1223);
getPoints()!=1223;
->true

Method LoyaltyCard.setCardId

Criteria for method LoyaltyCard.setCardId

  • content of input

Predicates for method LoyaltyCard.setCardId

Criterion Predicate
content of input 0-9, A-Z, a-z, special characters
null

Combination of predicates for method LoyaltyCard.setCardId

content of input Valid/Invalid Description of the test case JUnit test case
0-9, A-Z, a-z, special characters valid setCardId("1.2231dsaas!@#");
getCardId()=="1.2231dsaas!@#";
testLoyaltyCardSetCardId
null invalid setCardId();
getCardId()==not null;

Method LoyaltyCard.setPoints

Criteria for method LoyaltyCard.setPoints

  • content of input

Predicates for method LoyaltyCard.setPoints

Criterion Predicate
content of input [-inf,0)
[0,inf]

Combination of predicates for method LoyaltyCard.setPoints

content of input Valid/Invalid Description of the test case JUnit test case
[-inf,0) invalid setPoints(-1223);
getPoints()==-1223;
testLoyaltyCardSetPoints
[0,inf] valid setPoints(1223);
getPoints()==1223;

Method OrderObj.setBalanceId

Criteria for method OrderObj.setBalanceId

  • content of input

Predicates for method OrderObj.setBalanceId

Criterion Predicate
content of input [-inf,0)
[0,inf]

Combination of predicates for method OrderObj.setBalanceId

content of input Valid/Invalid Description of the test case JUnit test case
[-inf,0) invalid setBalanceId(-1223);
getBalanceId()==-1223;
testOrderObjSetBalanceId
[0,inf] valid setBalanceId(1223);
getBalanceId()==1223;

Method OrderObj.setProductCode

Criteria for method OrderObj.setProductCode

  • content of input

Predicates for method OrderObj.setProductCode

Criterion Predicate
content of input 0-9, A-Z, a-z, special characters
null

Combination of predicates for method OrderObj.setProductCode

content of input Valid/Invalid Description of the test case JUnit test case
0-9, A-Z, a-z, special characters valid setProductCode("1.2231dsaas!@#");
getProductCode()=="1.2231dsaas!@#";
testOrderObjSetProductCode
null invalid setProductCode();
getProductCode()==not null;

Method OrderObj.setPricePerUnit

Criteria for method OrderObj.setPricePerUnit

  • content of input

Predicates for method OrderObj.setPricePerUnit

Criterion Predicate
content of input [-inf, 0.0)
[0.0, inf]

Combination of predicates for method OrderObj.setPricePerUnit

get the same value with input Valid/Invalid Description of the test case JUnit test case
[-inf, 0.0) invalid setPricePerUnit(-1.223);
getPricePerUnit()==-1.223;
testOrderObjSetPricePerUnit
[0.0, inf] valid setPricePerUnit(1.223);
getPricePerUnit()==1.223;

Method OrderObj.setQuantity

Criteria for method OrderObj.setQuantity

  • content of input

Predicates for method OrderObj.setQuantity

Criterion Predicate
content of input [-inf,0)
[0,inf]

Combination of predicates for method OrderObj.setQuantity

content of input Valid/Invalid Description of the test case JUnit test case
[-inf,0) invalid setQuantity(-1223);
getQuantity()==-1223;
testOrderObjSetQuantity
[0,inf] valid setQuantity(1223);
getQuantity()==1223;

Method OrderObj.setStatus

Criteria for method LoyaltyCard.setStatus

  • content of status

Predicates for method LoyaltyCard.setStatus

Criterion Predicate
content of status payed
completed
issued
others

Combination of predicates for method OrderObj.setStatus

content of status Valid/Invalid Description of the test case JUnit test case
payed valid setStatus("payed");
getStatus()=="payed";
testOrderObjSetStatus
completed valid setStatus("completed");
getStatus()=="completed";
issued valid setStatus("issued");
getStatus()=="issued";
others invalid setStatus("iqnwiqdun12");
getStatus()=="issued";

Method OrderObj.setOrderId

Criteria for method LoyaltyCard.setOrderId

  • availability of orderID

Predicates for method LoyaltyCard.setOrderId

Criterion Predicate
availability of orderID [-inf, 0)
[0, inf]

Combination of predicates for method OrderObj.setOrderId

availability of orderID Valid/Invalid Description of the test case JUnit test case
[0, inf] valid setOrderId(1223);
getOrderId()==1223;
testOrderObjSetOrderId
[-inf, 0) invalid setOrderId(-123);
getOrderId()==-123;

Method ProductTypeObj.setQuantity

Criteria for method ProductTypeObj.setQuantity

  • content of input

Predicates for method ProductTypeObj.setQuantity

Criterion Predicate
content of input [-inf,0)
[0,inf]

Combination of predicates for method ProductTypeObj.setQuantity

content of input Valid/Invalid Description of the test case JUnit test case
[-inf,0) invalid setQuantity(-1223);
getQuantity()==-1223;
testProductTypeObjSetQuantity
[0,inf] valid setQuantity(1223);
getQuantity()==1223;

Method ProductTypeObj.setLocation

Criteria for method ProductTypeObj.setLocation

  • content of input

Predicates for method ProductTypeObj.setLocation

Criterion Predicate
content of input 0-9, A-Z, a-z, special characters
null

Combination of predicates for method ProductTypeObj.setLocation

content of input Valid/Invalid Description of the test case JUnit test case
0-9, A-Z, a-z, special characters valid setLocation("1.2231dsaas!@#");
getLocation()=="1.2231dsaas!@#";
testProductTypeObjSetLocation
null invalid setLocation();
getLocation()==not null;

Method ProductTypeObj.setNote

Criteria for method ProductTypeObj.setNote

  • content of input

Predicates for method ProductTypeObj.setNote

Criterion Predicate
content of input 0-9, A-Z, a-z, special characters
null

Combination of predicates for method ProductTypeObj.setNote

content of input Valid/Invalid Description of the test case JUnit test case
0-9, A-Z, a-z, special characters valid setNote("1.2231dsaas!@#");
getNote()=="1.2231dsaas!@#";
testProductTypeObjSetNote
null invalid setNote();
getNote()==not null;

Method ProductTypeObj.setProductDescription

Criteria for method ProductTypeObj.setProductDescription

  • content of input

Predicates for method ProductTypeObj.setProductDescription

Criterion Predicate
content of input 0-9, A-Z, a-z, special characters
null

Combination of predicates for method ProductTypeObj.setProductDescription

content of input Valid/Invalid Description of the test case JUnit test case
0-9, A-Z, a-z, special characters valid setProductDescription("1.2231dsaas!@#");
getProductDescription()=="1.2231dsaas!@#";
testProductTypeObjSetProductDescription
null invalid setProductDescription();
getProductDescription()==not null;

Method ProductTypeObj.setBarCode

Criteria for method ProductTypeObj.setBarCode

  • content of input

Predicates for method ProductTypeObj.setBarCode

Criterion Predicate
content of input 0-9, A-Z, a-z, special characters
null

Combination of predicates for method ProductTypeObj.setBarCode

content of input Valid/Invalid Description of the test case JUnit test case
0-9, A-Z, a-z, special characters valid setBarCode("1.2231dsaas!@#");
getBarCode()=="1.2231dsaas!@#";
testProductTypeObjSetBarCode
null invalid setBarCode();
getBarCode()==not null;

Method ProductTypeObj.setPricePerUnit

Criteria for method LoyaltyCard.setPricePerUnit

  • content of input

Predicates for method LoyaltyCard.setPricePerUnit

Criterion Predicate
content of input [-inf, 0.0)
[0.0, inf]

Combination of predicates for method LoyaltyCard.setPricePerUnit

get the same value with input Valid/Invalid Description of the test case JUnit test case
[-inf, 0.0) valid setPricePerUnit(-1.223);
getPricePerUnit()==-1.223;
testProductTypeObjSetPricePerUnit
[0.0, inf] valid setPricePerUnit(1.223);
getPricePerUnit()==1.223;

Method ProductTypeObj.setId

Criteria for method ProductTypeObj.setId

  • content of input

Predicates for method ProductTypeObj.setId

Criterion Predicate
content of input [-inf,0)
[0,inf]

Combination of predicates for method ProductTypeObj.setId

content of input Valid/Invalid Description of the test case JUnit test case
[-inf,0) invalid setId(-1223);
getId()==-1223;
testProductTypeObjSetId
[0,inf] valid setId(1223);
getId()==1223;

Method ProductTypeObj.verifyString

Criteria for method ProductTypeObj.verifyString:

  • number of parts of position
  • first part length
  • first part characters
  • second part length
  • second part characters
  • third part characters

Predicates for method ProductTypeObj.verifyString:

Criterion Predicate
number of parts of position =3
<3
>3
first part length =3
<3
>3
first part characters 0-9
'a'-'z' and 'A'-'Z'
special characters
second part length 0
>=1
second part characters 0-9
'a'-'z' and 'A'-'Z'
special characters
third part characters 0-9
'a'-'z' and 'A'-'Z'
special characters

Combination of predicates for method ProductTypeObj.verifyString

number of parts of position first part length first part characters second part length second part characters third part characters Valid/Invalid Description of the test case JUnit test case
>3 * * * * * valid verifyString(“12-d“)
->false
testProductTypeObjVerifyString
<3 * * * * * valid verifyString(“12-d-e1ad-dqw“)
->false
* >3 * * * * valid verifyString(“121231-d-e1ad“)
->false
* <3 * * * * valid verifyString(“12-ddiqn-213124“)
->false
* * 'a'-'z' and 'A'-'Z' * * * valid verifyString(“asd-ddiqn-213124“)
->false
* * special characters * * * valid verifyString(“!@3-ddiqn-213124“)
->false
* * * 0 * * valid verifyString(“123--213124“)
->false
* * * * 0-9 * valid verifyString(“123-123d-213124“)
->false
* * * * special characters * valid verifyString(“123-d!@#-213124“)
->false
* * * * * 'a'-'z' and 'A'-'Z' valid verifyString(“123-ddiqn-123asd“)
->false
* * * * * special characters valid verifyString(“123-ddiqn-!@$123“)
->false
=3 =3 0-9 >=1 'a'-'z' and 'A'-'Z' 0-9 valid verifyString(“123-ddiqn-213124“)
->true

Method ProductTypeObj.searchProductByBarCode

Criteria for method ProductTypeObj.searchProductByBarCode:

  • existence of barcode in location map

Predicates for method ProductTypeObj.searchProductByBarCode:

Criterion Predicate
existence of barcode in location map yes
no

Combination of predicates for method ProductTypeObj.searchProductByBarCode

existence of barcode in location map Valid/Invalid Description of the test case JUnit test case
yes valid searchProductByBarCode(inventoryMap, barcode)->product name testProductTypeObjSearchProductByBarCode
no valid searchProductByBarCode(inventoryMap, barcode)->Null

Method ProductTypeObj.searchProductDescription

Criteria for method ProductTypeObj.searchProductDescription:

  • existence of description in location map

Predicates for method ProductTypeObj.searchProductDescription:

Criterion Predicate
existence of description in location map yes
no

Combination of predicates for method ProductTypeObj.searchProductDescription

existence of description in location map Valid/Invalid Description of the test case JUnit test case
yes valid searchProductDescription(inventoryMap, description)->list of related products testProductTypeObjSearchProductByDescription
no valid searchProductDescription(inventoryMap, description)->no target contains in it

Method ProductTypeObj.verifyPosition

Criteria for method ProductTypeObj.verifyPosition:

  • existence of p in location map

Predicates for method ProductTypeObj.verifyPosition:

Criterion Predicate
existence of p in location map yes
no

Combination of predicates for method ProductTypeObj.verifyPosition

existence of p in location map Valid/Invalid Description of the test case JUnit test case
yes valid ->true testProductTypeObjVerifyPosition
no valid ->false

Method SaleTransactionObj.setState

Criteria for method SaleTransactionObj.setState

  • content of input

Predicates for method SaleTransactionObj.setState

Criterion Predicate
content of input open
closed
payed

Combination of predicates for method SaleTransactionObj.setState

content of input Valid/Invalid Description of the test case JUnit test case
open valid setState("open");
getState()=="open";
testSaleTransactionObjSetState
close valid setState("close");
getState()=="close";
payed valid setState("payed");
getState()=="open";

Method SaleTransactionObj.setTicketNumber

Criteria for method SaleTransactionObj.setTicketNumber

  • content of input

Predicates for method SaleTransactionObj.setTicketNumber

Criterion Predicate
content of input [-inf,0)
[0,inf]

Combination of predicates for method SaleTransactionObj.setTicketNumber

content of input Valid/Invalid Description of the test case JUnit test case
[-inf,0) invalid setTicketNumber(-1223);
getTicketNumber()==-1223;
testSaleTransactionObjSetTicketNumber
[0,inf] valid setTicketNumber(1223);
getTicketNumber()==1223;

Method SaleTransactionObj.setEntries

Criteria for method SaleTransactionObj.setEntries

  • availability of input entry

Predicates for method SaleTransactionObj.setEntries

Criterion Predicate
availability of input entry yes
no

Combination of predicates for method SaleTransactionObj.setEntries

availability of input entry Valid/Invalid Description of the test case JUnit test case
yes valid setEntries(lst);
getEntries==lst
testSaleTransactionObjSetEntries
no invalid setEntries(lst);
getEntries!=lst

Method SaleTransactionObj.setDiscountRate

Criteria for method SaleTransactionObj.setDiscountRate

  • range of input

Predicates for method SaleTransactionObj.setDiscountRate

Criterion Predicate
range of input [-inf, 0.0)
[0.0, 1.0]
(1.0, inf)

Combination of predicates for method SaleTransactionObj.setDiscountRate

get the same value with input Valid/Invalid Description of the test case JUnit test case
[-inf, 0.0) invalid setDiscountRate(-1.223);
getDiscountRate()==-1.223;
testSaleTransactionObjSetDiscountRate
[0.0, 1.0] valid setDiscountRate(0.223);
getDiscountRate()==0.223;
(1.0, inf) invalid setDiscountRate(1.223);
getDiscountRate()==1.223;

Method SaleTransactionObj.setPrice

Criteria for method SaleTransactionObj.setPrice

  • content of input

Predicates for method SaleTransactionObj.setPrice

Criterion Predicate
content of input [-inf, 0.0)
[0.0, inf]

Combination of predicates for method SaleTransactionObj.setPrice

get the same value with input Valid/Invalid Description of the test case JUnit test case
[-inf, 0.0) valid setPrice(-1.223);
getPrice()==-1.223;
testSaleTransactionObjSetPrice
[0.0, inf] valid setPrice(1.223);
getPrice()==1.223;

Method TicketEntryObj.setBarCode

Criteria for method TicketEntryObj.setBarCode

  • content of input

Predicates for method TicketEntryObj.setBarCode

Criterion Predicate
content of input 0-9, A-Z, a-z, special characters
null

Combination of predicates for method TicketEntryObj.setBarCode

content of input Valid/Invalid Description of the test case JUnit test case
0-9, A-Z, a-z, special characters valid setBarCode("1.2231dsaas!@#");
getBarCode()=="1.2231dsaas!@#";
testTickeyEntryObjsetBarCode
null invalid setBarCode();
getBarCode()==not null;

Method TicketEntryObj.setProductDescription

Criteria for method TicketEntryObj.setProductDescription

  • content of input

Predicates for method TicketEntryObj.setProductDescription

Criterion Predicate
content of input 0-9, A-Z, a-z, special characters
null

Combination of predicates for method TicketEntryObj.setProductDescription

content of input Valid/Invalid Description of the test case JUnit test case
0-9, A-Z, a-z, special characters valid setProductDescription("1.2231dsaas!@#");
getProductDescription()=="1.2231dsaas!@#";
testTickeyEntryObjsetProductDescription
null invalid setProductDescription();
getProductDescription()==not null;

Method TicketEntryObj.setAmount

Criteria for method TicketEntryObj.setAmount

  • content of input

Predicates for method TicketEntryObj.setAmount

Criterion Predicate
content of input [-inf,0)
[0,inf]

Combination of predicates for method TicketEntryObj.setAmount

content of input Valid/Invalid Description of the test case JUnit test case
[-inf,0) invalid setAmount(-1223);
getAmount()==-1223;
testTickeyEntryObjsetAmount
[0,inf] valid setAmount(1223);
getAmount()==1223;

Method TicketEntryObj.setPricePerUnit

Criteria for method TicketEntryObj.setPricePerUnit

  • content of input

Predicates for method TicketEntryObj.setPricePerUnit

Criterion Predicate
content of input [-inf, 0.0)
[0.0, inf]

Combination of predicates for method TicketEntryObj.setPricePerUnit

get the same value with input Valid/Invalid Description of the test case JUnit test case
[-inf, 0.0) valid setPricePerUnit(-1.223);
getPricePerUnit()==-1.223;
testTickeyEntryObjsetPricePerUnit
[0.0, inf] valid setPricePerUnit(1.223);
getPricePerUnit()==1.223;

Method TicketEntryObj.setDiscountRate

Criteria for method TicketEntryObj.setDiscountRate

  • content of input

Predicates for method TicketEntryObj.setDiscountRate

Criterion Predicate
content of input [-inf, 0.0)
[0.0, inf]

Combination of predicates for method TicketEntryObj.setDiscountRate

get the same value with input Valid/Invalid Description of the test case JUnit test case
[-inf, 0.0) valid setDiscountRate(-1.223);
getDiscountRate()==-1.223;
testTickeyEntryObjsetDiscountRate
[0.0, inf] valid setDiscountRate(1.223);
getDiscountRate()==1.223;

Method UserObj.setId

Criteria for method UserObj.setId

  • content of input

Predicates for method UserObj.setId

Criterion Predicate
content of input [-inf,0)
[0,inf]

Combination of predicates for method UserObj.setId

content of input Valid/Invalid Description of the test case JUnit test case
[-inf,0) invalid setId(-1223);
getId()==-1223;
testUserObjsetId
[0,inf] valid setId(1223);
getId()==1223;

Method UserObj.setUsername

Criteria for method UserObj.setUsername

  • content of input

Predicates for method UserObj.setUsername

Criterion Predicate
content of input 0-9, A-Z, a-z, special characters
null

Combination of predicates for method UserObj.setUsername

content of input Valid/Invalid Description of the test case JUnit test case
0-9, A-Z, a-z, special characters valid setUsername("1.2231dsaas!@#");
getUsername()=="1.2231dsaas!@#";
testUserObjVerifyUsername
null invalid setUsername();
getUsername()==not null;

Method UserObj.setPassword

Criteria for method UserObj.setPassword

  • content of input

Predicates for method UserObj.setPassword

Criterion Predicate
content of input 0-9, A-Z, a-z, special characters
null

Combination of predicates for method UserObj.setPassword

content of input Valid/Invalid Description of the test case JUnit test case
0-9, A-Z, a-z, special characters valid setPassword("1.2231dsaas!@#");
getPassword()=="1.2231dsaas!@#";
testUserObjsetPassword
null invalid setPassword();
getPassword()==not null;

Method UserObj.setRole

Criteria for method UserObj.setRole

  • content of input

Predicates for method UserObj.setRole

Criterion Predicate
content of input 0-9, A-Z, a-z, special characters
null

Combination of predicates for method UserObj.setRole

content of input Valid/Invalid Description of the test case JUnit test case
0-9, A-Z, a-z, special characters valid setRole("1.2231dsaas!@#");
getRole()=="1.2231dsaas!@#";
testUserObjsetRole
null invalid setRole();
getRole()==not null;

Method UserObj.verifyUsername

Criteria for method UserObj.verifyUsername:

  • existence of user name in tree map

Predicates for method UserObj.verifyUsername:

Criterion Predicate
existence of user name in tree map exist
not exist

Combination of predicates for method UserObj.verifyUsername

existence of user name in tree map Valid/Invalid Description of the test case JUnit test case
exist valid users.username="abc123"
verifyUsername(users, "abc123")
->true
testUserObjVerifyUsername
not exist valid users.username="abc123"
verifyUsername(users, "dqw124")
->false

Method BarCodeValidator.validate

Criteria for method validate:

  • length of bar code
  • characters of bar code

Predicates for method BarCodeValidator.validate:

Criterion Predicate
length of bar code <12
>=12 and <=14
>14
characters of bar code 0-9
a-z and A-Z
special characters

Combination of predicates for method BarCodeValidator.validate

length of bar code characters of bar code Valid/Invalid Description of the test case JUnit test case
<12 * invalid validate("123123123")
->false
testBarCodeValidatorValidate
>14 * invalid validate("123123123123123123")
->false
* a-z and A-Z invalid validate("1231ascac232")
->false
* special characters invalid validate("1231!@$!1231")
->false
[12, 14] 0-9 valid validate("123123123123")
->true

Method LoyaltyCardCodeValidator.validate

Criteria for method LoyaltyCardCodeValidaor.validate:

  • length of loyaltyCardCode

Predicates for method LoyaltyCardCodeValidator.validate:

Criterion Predicate
length of loyaltyCardCode <10
10
>10

Combination of predicates for method LoyaltyCardCodeValidator.validate

length of loyaltyCardCode Valid/Invalid Description of the test case JUnit test case
<10 valid validate("123")
->false
testLoyaltyCardCodeValidatorValidate
>10 valid validate("12345678901")
->false
10 valid validate("1234567890")
->true

White Box Unit Tests

Test cases definition

<JUnit test classes must be in src/test/java/it/polito/ezshop>
<Report here all the created JUnit test cases, and the units/classes under test >
<For traceability write the class and method name that contains the test case>
Unit name JUnit test case
ReturnTransactionObj.setStateStr testReturnTransactionObjSetStateStr
SaleTransactionObj.setStateStr testSaleTransactionObjSetStateStr
BarCodeValidator.validate testBarCodeValidatorValidate
LoyaltyCardCodeValidator.validate testLoyaltyCardCodeValidatorValidate
CreditCardValidator.validate testCreditCardValidatorValidate
ProductTypeObj.verifyString testProductTypeObjVerifyString

Code coverage report

<Add here the screenshot report of the statement and branch coverage obtained using
the Eclemma tool. >

Loop coverage analysis

<Identify significant loops in the units and reports the test cases
developed to cover zero, one or multiple iterations >
Unit name Loop rows Number of iterations JUnit test case
UserObj.verifyname 2 users.values() testUserObjVerifyUsername
LoyaltyCard.generate 2 10 testModifyCustomer