Help please so lost trying to figure this out! DO NOT paste the Python Unittest example as I have already reviewed these

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Help please so lost trying to figure this out! DO NOT paste the Python Unittest example as I have already reviewed these

Post by answerhappygod »

Help please so lost trying to figure this out! DO NOT paste thePython Unittest example as I have already reviewed these and stillcan't figure this out.
Python Black Box Testing
For this assignment, you will be writing unit tests based on thefollowing specifications/requirements.
You will write a series of unit tests to test a function calledcredit_card_validator (written for you) that is passed a sequenceof digits as a string that represents a credit card number. Thisfunction will return True if it is a valid credit card number,otherwise, it will return False.
Depending on the credit card issuer, the length of a credit cardnumber can range between 10 and 19 digits. The first few digits ofthe number are the issuer prefix. Each credit cardissuer has an assigned range of numbers. For example, only Visacredit card numbers may begin with 4, while American Express cardnumbers must begin with either a 34 or 37. Sometimes, credit cardproviders are assigned multiple ranges. For example, MasterCardcard numbers must start with the numbers between 51 through 55 or2221 through 2720 (both ranges are inclusive).
The last digit of the number is referred to asthe check digit and acts asa checksum. Most credit cards calculatethis check digit using the Luhnalgorithm (see resources below for how this iscalculated).
In order to limit the scope of this assignment, we are going tolimit the number of credit card issuers to 3: Visa, MasterCard, andAmerican Express. Each has its own prefixes and lengthrequirements.
Your task is to create a series of tests that attempt toreveal bugs in the implementation. Asthis is black box testing, you will not have access to the sourceso you must use what you have learned this week to generate testcases.
You will be submitting your code to Gradescope which will autograde your tests. In order to get full credit on the assignment,you will need tolocate all 6 bugs in thecode (refer to the rubric for full details). Some are easier thanothers. Bug 5 is easy to miss without using Partition Testingand Bug 6 requires using what you know aboutcommon errors to design your tests.
You are free to determine how you generate your test cases. Youmay do it completely manually, or use an automated tool like theTSLgenerator. No matter how you generate your test cases, in yourfile testing file (tests.py), you need to include acomment for each test case describing:
Here is an example:
You also need to ensure you have test cases that do a good jobcovering the input domain. This means that at the very least, youneed to have a test case for each of theprefix ranges listed above.
Please submit all your tests, even the ones that do not findbugs. Remember, you are practicing writing a testing suite, whichcan be used to test the code again if changes are made. There maybe a situation where a previously passing test fails when someoneupdates credit_card_validator.
Finally, your test suite needs to be free of linting errorsusing the PEP8 standard; this will be important later when workingon shared repositories. If you are unfamiliar with linting, pleasesee the resources below. The easiest way to accomplish this is toensure that there are no "squiggly" lines under your code inPyCharm (You will need to change PyCharm's default line length to79 to match PEP8). You can also use the PEP8 Online tool below tocopy and paste your code to verify it has no errors.
Restrictions
For this assignment, you are prohibited from using RandomTesting. Yes, Random Testing is a type of Black Box Testing, butyou will be working with this approach in a later module(Exploration: Random Testing). You will not receive points for anybugs triggered by Random Testing. This means that you cannot usecode to generate the test cases, you need to come up with themyourself. Please restrict yourself to using other Black Box Testingtechniques: Error Guessing, Partition Testing, and Boundary ValueTesting.
Hints
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply