搜索此网站
Welcome!
Waiting List
Calendar
Slide Decks & Videos
Learning Outcomes
No Copying Policy
Grading
Project
Labs
AutoTest
Specification
Checkpoint 0
Checkpoint 1
Checkpoint 2
Resources
Exam Practice
UBC CPSC310-20W1: Intro to SE
CHECKPOINT 0
CHECKPOINT 0: TDD INDIVIDUAL CHECKPOINT
Test-driven development (TDD) is one modern technique for building software. As the name suggests, engineers write tests for every requirement in the specification before they create the implementation. This makes it much easier to ensure the final product has at least a base level of testing.
In terms of the course project, adopting TDD will ensure you understand all the requirements of the specification before getting buried in the details of your implementation. This is important because implementing code that doesn’t meet the requirements will increase the amount of work you need to do for the project.
In this checkpoint you will be reading a specification and writing a set of tests against that spec. To evaluate the completeness of your test suite for the spec we will execute your suite against our own system to measure how well your tests cover our implementation.
GETTING THE STARTER CODE
First you will need to log into Classy. Within 24 hours you should have a repository provisioned on. You’ll then need to log in to GitHub Enterprise with your CWL account to view and clone your repo (you should have also been emailed a link). For this course, you will be using Git to manage your code. A description of how to use Git is given in our brief Git Tutorial. Before starting, ensure that you have prepared your computer according the instructions found in the README of your provisioned repo.
REQUIREMENTS
For this checkpoint, you will read the Checkpoint 1 specification, extract detailed requirements, and then turn the requirements you identified into a set of tests. Specifically, you will be writing unit tests for the four methods of the InsightFacade class in ./src/controller/InsightFacade.ts. You should not modify any files under the src/ directory. These tests will form the basis of your personal test suite for the remainder of the project.
Your grade will be computed using the following formula which is explained below:
(coverage percentage)^2
As you can see, your grade for this checkpoint is entirely based on how much of the reference solution your tests cover. Because it can be relatively easy to cover up to 80% of the reference implementation but difficult to cover all 100%, the percentage of covered lines will be squared when computing your grade.
Because you have no way of checking how much of the reference solution your are covering on your local computer, you will need to rely on AutoTest to determine your progress. This service is rate limited so you will want to start early.
DEVELOPING YOUR SOLUTION
We will be using the Mocha Test Environment with Chai Expectations for testing. You should add additional tests to test/InsightFacade.spec.ts and execute them with yarn test. Since InsightFacade is not correctly implemented in the starter code, any tests you add should FAIL.
Specifically, your tests should fail when you run them locally against the invalid implementation of InsightFacade provided in the starter code. Note that in this project, tests pass by default if you don’t include or check assertions in your tests. Therefore, you must make sure you have explicitly defined asserts for every code path in every test and that the asserts check the correct conditions.
To fully test the addDataset method, you’ll need to generate additional zip files with differing content. We recommend you place all of your test zip files in test/data and follow the test structure already in place in InsightFacade.spec.ts. Specifically, you can add your additional zip files to the datasets object and then test addDataset against each of your zip files by duplicating the “Should add the courses dataset” test.
When writing tests for the performQuery method, you will find that the tests have a common structure: define a query to test and the corresponding results and check that performQuery returns the correct results for the given query. To simplify this process (and to ensure that InsightFacade.spec.ts file doesn’t become cluttered) we have included the ability to define test queries and results in separate files. These files are used to automatically generate tests that check whether the query returns the correct results. Thus, in addition to writing tests in InsightFacade.spec.ts using it(), you can also write tests for performQuery by creating new JSON files in test/queries. See the provided example queries already included to get a sense of the JSON structure. As you add more valid JSON files to files/queries you’ll see that the number of tests that are run increases which is a sign that things are working as expected.
You can also feel free to make tests that don’t use these provided structures when making your tests, for example if you think of a scenario that you don’t feel is easy to test using our starter code.
There is a reference UI to help with generating query test results.
GETTING YOUR GRADE
This will be an individual checkpoint (the only one in the project). We will check for copied code on all submissions so please make sure your work is your own. Your project is automatically graded every time you push to GitHub with the command git push. Your grade will be the maximum grade you received from all submissions (commits in git terminology) made before the hard deadline. While we compute your grade on every submission, you will only be able to request to see your grade once every 6 hours. You can request your grade by mentioning @autobot #c0 in a commit comment. Refer to the AutoTest page for additional details.
Please note the project restrictions specified here.
RESOURCES
▪ Git Tutorial
▪ TypeScript/JavaScript Tutorial
▪ Asynchronous Development Tutorial
▪ Promises Tutorial
FAQ
Q. Lots of this is new to me (especially TypeScript), how should I get caught up?
A. I would start with taking a look at the resource files first, and the links inside them. Google as always is an excellent resource, as most things used in this course are fairly popular and well documented. And don’t worry, we expect much (if not most) of this to be new, and that’s factored in to the challenge of the initial assignments.
Q. I’ve logged in to GitHub, but don’t have a repo?
A. Make sure to logged into github.students.cs.ubc.ca with your csid, not github.com or github.ubc.ca. Repo provisioning is done in batches. If you still don’t have a repo then, please make a Piazza post with your csid. Also take a look at your profile and see if you see the CPSC310-2019W-T2 organization, you may have a ‘team’ (of one) in that owns the repo.
Q. I’m currently not able to register in a lab, what should I do?
A. If there’s no lab that doesn’t conflict with your schedule that has space, you will need to talk to academic advising to have them put you into a lab. In the meantime for the first week, you should go to a lab even if you are not registered in it.
Q. How should I create expected output for performQuery?
A. You can use your reference UI and copy the result output.
Q. My coverage on the bot just dropped significantly, but is good locally?
A. In almost all cases, this means you have a zip file locally that you didn’t commit but reference in your spec file. When the bot tries to load it an error will be thrown, and none of your queries will be run.
页面更新时间:
Google 网站
举报不良行为