Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will write a series of unit tests to test a function called (written for you) that is passed a sequence of digits as a

image text in transcribedimage text in transcribed

You will write a series of unit tests to test a function called (written for you) that is passed a sequence of digits as a that represents a credit card number. This function will return if is a valid credit card number, otherwise, it will return Depending on the credit card issuer, the length of a credit card number can range between 10 and 19 digits. The first few digits of the number are the issuer prefix. Each credit card issuer has an assigned range of numbers. For example, only Visa credit card numbers may begin with 4, while American Express card numbers must begin with either a or Sometimes, credit card providers are assigned multiple ranges. For example, MasterCard card numbers must start with the numbers between 51 through 55 or through (both ranges are inclusive). The last digit of the number is referred to as the check digit and acts as a checksum. Most credit cards calculate this check digit using the Luhn algorithm (see resources below for how this is calculated). In order to limit the scope of this assignment, we are going to limit the number of credit card issuers to 3 : Visa, MasterCard, and American Express. Each has its own prefixes and length requirements. - Visa Prefix(es): 4 - Length: 16 - MasterCard Prefix(es): 51 through 55 and 2221 through 2720 - Length: 16 - American Express Prefix(es): 34 and 37 Length: 15 Your task is to create a series of tests that attempt to reveal bugs in the implementation. As this is black box testing, you will not have access to the source so you must use what you have learned this week to generate test cases. You will be submitting your code to Gradescope, which will auto grade your tests. In order to get full credit on the assignment, you will need to locate all 10 bugs in the code (refer to the rubric for full details). Some are easier than others. Bug 5 is easy to miss without using Partition Testing and Bug 6 requires using what you know about common errors to design your tests. You are free to determine how you generate your test cases. You may do it completely manually or use an automated tool like the TSLgenerator. No matter how you generate your test cases, in your file testing file I I, you need to include a comment for each test case describing: - What the test case (i.e. credit card number) is meant to verify - How you determined what to use as the test case Here is an example: \# Verifies if Master Cards with valid lengths and invalid check bits returns False \# Picked using Category Partition Testing def test11(self): self.assertFalse(credit_card_validator("...")) You also need to ensure you have test cases that do a good job covering the input domain. This means that at the very least, you need to have a test case for each of the prefix ranges listed above. Please submit allyour tests, even the ones that do not find bugs. Remember, you are practicing writing a testing suite, which can be used to test the code again if changes are made. There may be a situation where a previously passing test fails when someone updates

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Datalog Engines In Databases

Authors: Bas Ketsman ,Paraschos Koutris

1st Edition

1638280428, 978-1638280422

More Books

Students also viewed these Databases questions