Skip to content
Snippets Groups Projects
AcceptanceTests.md 16.85 KiB

Seller

createAuctionTest
Input Description Output
precondition: seller logged in
the Item selected does not exist in the database the method checks if the given Item exist inside the database, in order to create an Auction referring to it: if not, it returns an error to the user the Auction is not created and an error message is showed: "Error: item not existent"
the start or end time are not in the right format (dd/mm/yyyy hh:mm) or the method checks if the given dates are written in the right format: if not, it returns an error to the user the Auction is not created and an error message is showed: "Error: date not in the right format"
the end date is prior the start date the method checks if the given dates are following the right meaning: if not, it returns an error to the user the Auction is not created and an error message is showed: "Error: start date after the end date"
the price and/or the price incrementation are not in the right format (currency) or below zero the method checks if the given prices are correct and written in the right format: if not, it returns an error to the user the Auction is not created and an error message is showed: "Error: price or price incrementation are below zero or written in a wrong format"
all valid the method checks all the precedent parameters: if they are all correct, it creates an Instance of the object Auction and return true it creates an instance of the object Auction and return true
addItemTest
Input Description Output
precondition: seller logged in
the title is null, composed only by numbers, longer than 30 characters or contains a special character the method checks if the given title respects all the parameters: if not, it returns an error to the user the Item is not created and an error message is showed: "Error: title not correct"
the description is null, composed only by number or longer than 500 characters the method checks if the given description respects all the parameters: if not, it returns an error to the user the Item is not created and an error message is showed: "Error: description not correct"
there is less than one image or more than ten the method checks if file uploaded is an image type and counts how many pictures are present: if those parameters are not respected, it returns an error to the user the Item is not created and an error message is showed: "Error: there are problems with the pictures, please check"
category not selected or wrong one selected the method checks if the category selected exist in the database: if not, it returns an error to the user the Item is not created and an error message is showed: "Error: category not correct"
all valid the method checks all the precedent parameters: if they are all correct, it creates an Instance of the object item and return true it creates an instance of the object Item and returns true

User

userLoginTest
Input Description Output
the username and mail field are empty the method checks if both the given username and email are empty: if they are, it returns an error to the user the login will not be done and an error message is showed: "Error: you should provide an username or a password"
the mail field is in the right format (xxx@xxx.xxx) the method checks if the given email respects the right format standard: if not, it returns an error to the user the login will not be done and an error message is showed: "Error: email not in the right format"
the password field is empty the method checks if the given password is empty: if it is, it returns an error to the user the login will not be done and an error message is showed: "Error: password blank"
the username or email are not bonded with the provided password the method checks if the given email or username are bonded witht the password: if not, it returns an error to the user the login will not be done and an error message is showed: "Error: login invalid"
all valid the method checks all the precedent parameters: if they are all correct, it performs the login and returns true the login will be done and the method returns true
becomeSellerTest
Input Description Output
precondition: user logged in
SSN empty the method checks if the given SSN is empty: if it is, it returns an error to the user the Seller istance will not be created and an error message is showed: "Error: SSN blank"
SSN not in the right format (XXX-XX-XXXX) the method checks if the given SSN respects the parameters: if it is, it returns an error to the user the Seller istance will not be created and an error message is showed: "Error: SSN not in the right format"
all valid the method checks all the precedent parameters: if they are all correct, it creates the Seller istance and returns true the Seller istance will be created and returns true
searchItemTest
Input Description Output
precondition: user logged in
the title is null, composed only by numbers, longer than 30 characters or contains a special character the method checks if the given title respects all the parameters: if not, it returns an error to the user the search is not performed and an error message is showed: "Error: title not correct"
category not selected or wrong one selected the method checks if the category selected exist in the database: if not, it returns an error to the user the search is not performed and an error message is showed: "Error: category not correct"
all valid the method checks all the precedent parameters: if they are all correct, it creates the Seller istance and returns true the search is performed and returns true
searchAuctionTest
Input Description Output
precondition: user logged in
the start or end time are not in the right format (dd/mm/yyyy hh:mm) or the method checks if the given dates are written in the right format: if not, it returns an error to the user the Auction is not created and an error message is showed: "Error: date not in the right format"
the end date is prior the start date the method checks if the given dates are following the right meaning: if not, it returns an error to the user the Auction is not created and an error message is showed: "Error: start date after the end date"
the price and/or the price incrementation are not in the right format (currency) or below zero the method checks if the given prices are correct and written in the right format: if not, it returns an error to the user the Auction is not created and an error message is showed: "Error: price or price incrementation are below zero or written in a wrong format"
the title is null, composed only by numbers, longer than 30 characters or contains a special character the method checks if the given title respects all the parameters: if not, it returns an error to the user the search is not performed and an error message is showed: "Error: title not correct"
category not selected or wrong one selected the method checks if the category selected exist in the database: if not, it returns an error to the user the search is not performed and an error message is showed: "Error: category not correct"
all valid the method checks all the precedent parameters: if they are all correct, it creates the Seller istance and returns true the search is performed and returns true

Item

modifyTest
Input Description Output
precondition: user logged in and upgraded as Seller and an Item is selected
the title is null, composed only by numbers, longer than 30 characters or contains a special character the method checks if the given title respects all the parameters: if not, it returns an error to the user the Item is not modified and an error message is showed: "Error: title not correct"
the description is null, composed only by number or longer than 500 characters the method checks if the given description respects all the parameters: if not, it returns an error to the user the Item is not modified and an error message is showed: "Error: description not correct"
category not selected or wrong one selected the method checks if the category selected exist in the database: if not, it returns an error to the user the Item is not modified and an error message is showed: "Error: category not correct"
the Item selected does not exist in the database the method checks if the given Item exist inside the database, in order to create an Auction referring to it: if not, it returns an error to the user the Item is not modified and an error message is showed: "Error: item not existent"
all valid the method checks all the precedent parameters: if they are all correct, it creates the Seller istance and returns true it modifies the data of the selected instance of the object Item and return true
addPictureTest
Input Description Output
precondition: user logged in and upgraded as seller and an Item is selected
there is less than one image or more than ten the method checks if file uploaded is an image type and counts how many pictures are present: if those parameters are not respected, it returns an error to the user the Item is not modified and an error message is showed: "Error: there are problems with the pictures, please check"
all valid the method checks all the precedent parameters: if they are all correct, it creates the Seller istance and returns true it modifies the data of the selected instance of the object Item and return true

AuctionManager

placeBid
Input Description Output
precondition: user logged in and subscribed to the auction
A null value bid the method checks if the input for the bid is a positive integer: if it is not, it does not do any operation and show an error message no operation is done and an error message is showed: "your offer cannot be equal to zero, please try again"
A negative value bid the method checks if the input for the bid is a positive integer: if it is not, it does not do any operation and show an error message no operation is done and an error message is showed: "your offer cannot be a negative number, please try again"
A decimal value bid the method checks if the input for the bid is a positive integer: if it is not, it does not do any operation and show an error message no operation is done and an error message is showed: "your offer cannot be a decimal number, please try again"
A integer value bid the method checks if the input for the bid is a positive integer: if it is, it multiply it for the increment set by the user who is selling, it computes the actual price, sets the user which owns the bid as current winnter and returns true price is computed, the user is set as winner and returns true