Assignment 2: User Stories, Test-Driven Development, & Firebase
Assignment Instructions
Prerequisites: To complete this assignment, you will need experience with User stories, Test- driven development, and Firebase. Relevant topics were discussed in the Lectures 3, 4, 5, and 6. Several relevant tutorials (e.g., Android Basics, TDD, Firebase) were also delivered in the past few weeks. Please consult these relevant materials from Brightspace, especially in Lectures and Tutorials sections. Please make sure that you have these tools and libraries installed on your machine and they are working properly:
Android Studio 4.1.2+
Copyright By PowCoder代写 加微信 powcoder
Git, GitLab
JUnit and Espresso Frameworks, and Firebase
Assignment Repository: https://git.cs.dal.ca/masud/csci3130-winter2022-a2
Note: To access the assignment repository, you must log in to your GitLab account.
Assignment Deadline: Feb 04, 2022 5:00 PM.
Expectation: A single PDF document with a naming structure of BannerID-CSCI3130- A2.pdf should be submitted to Brightspace by the deadline:
Document format and naming structure are followed (01 mark).
Fork the assignment repository to your Dalhousie GitLab account. Then clone the forked repository (under your GitLab account) to your local machine using Git. If this step is not followed properly, 03 marks will be penalized.
Must change your repository permission to private (Must be done!) (01 mark).
Must add user prof3130 as a maintainer of your repository. Markers will use this account for
evaluation. They will not be able to mark the rest if you fail to invite prof3130 (01 mark).
Must add GitLab link of your forked repository to the answer PDF (01 mark).
Q1: Answers in the PDF (06 marks)
Q2: Modified code and commits in GitLab and screenshots in the PDF (15 marks)
Q3: Modified code and commits in GitLab and screenshots in the PDF (10 marks)
Q4: Answers in the PDF (05 marks)
Total = 40 marks.
Winter 2022: CSCI 3130 – Introduction to Software Engineering Assignment 2 Page 1 of 4
Q1 (06 marks): In Agile methodology, software requirements are captured as user stories. The completion of any user story is determined using one or more user acceptance tests.
Let us consider, you are developing a mobile application for Evan’s seafood shop using Agile methodology. The Evan’s shop sells delicious seafood near the waterfront at Dartmouth. (Many of you might have already tasted them). They badly need a mobile application with interesting e-commerce features to stay competitive in the market. The mobile application is expected to (a) respond to search queries from its users (a.k.a., customers) on the availability of certain dishes, and (b) detect the current location of its users. Read the following user stories and design two acceptance tests for each of them. (You will get 01 mark as bonus if you can come up with three acceptance tests for all three user stories).
US-I: As a shop owner, I want to be able to add new seafood items to the application so that my customers can find and order them. (02 marks).
US-II: As a customer, I want to be able to search for available seafood in the shop so that I can place online orders (02 marks).
US-III: As a customer, I want the software to detect my current location automatically so that I can estimate the shipping costs for my online orders (02 marks).
Q2 (15 marks): Read the user stories, acceptance tests, and complete the engineering tasks using extreme programming (XP) and test-driven development (TDD).
Job description: Let us consider, you have recently joined ABC company as a software developer and you have been assigned to a medium-sized Android project by your boss. It is an e-commerce application that supports online buying and selling of products (e.g., computer accessories). To your surprise, you found that the application has special offers and discounts to attract the students from Dalhousie University. However, the students will need to provide their Net ID (e.g., xy123456) and Dalhousie email (e.g., to register with the application. Currently, the application is in its early stage of development, and the client has selected a few critical user stories for the current iteration.
ABC company adopts pair-programming and TDD, and you have been paired with a fel- low developer. During the planning game, your fellow developer already analyzed the user sto- ries, corresponding user acceptance tests, and wrote a few failed test cases using JUnit (check JUnitTest.java) and Espresso frameworks (check EspressoTest.java). In this assignment, you will fork the assignment repository and add your code to pass these failed tests. Your code must
pass both JUnit tests and Espresso tests whenever applicable.
US-I: As a Dalhousie user, I want to create an account in the application so that I can buy and sell my products online.
UAT-I: Given that the application is deployed on a phone or an emulator, when a user runs the application first time, the user is presented with a screen showing two text boxes (requesting a Net ID and an email address respectively) and a press button labeled with REGISTER. The corresponding Espresso test checkIfRegistrationPageIsVisible() is already passing. Run this test and check if it is indeed passing (i.e., learning example).
Winter 2022: CSCI 3130 – Introduction to Software Engineering Assignment 2 Page 2 of 4
UAT-II: Given a running application, when an empty Net ID is entered and the register button is clicked, then the application shows an appropriate error message. The corre- sponding JUnit and Espresso tests called checkIfNetIDIsEmpty() are already passing. Run these tests and check if they are indeed passing (i.e., learning example).
UAT-III: Given a running application, when an invalid Net ID is entered and the button is clicked, then the application shows an appropriate error message. Add your code to pass both tests – checkIfNetIDIsValid() and checkIfNetIDIsInvalid(). Once done, make a separate commit with an appropriate message to GitLab and attach a screenshot of the four passing tests (2 JUnit + 2 Espresso) to the answer PDF (04 marks).
UAT-IV: Given a running application, when an invalid email address is entered and the register button is clicked, then the application shows an appropriate error message. Add your code to pass all three tests – checkIfEmailIsValid(), checkIfEmailIsInvalid(), and checkIfEmailIsNotDALEmail(). Once done, make a separate commit with an appropriate message to GitLab and attach a screenshot of the six passing tests (3 JUnit + 3 Espresso) to the answer PDF (06 marks).
UAT-V: Given a running application, when a valid Net ID and a valid email address are entered and the registration button is pressed, then the user is presented with a new screen showing “Welcome [Net ID]! A welcome email was sent to [email address].” Add your code (a) to pass the Espresso test – checkIfMoved2WelcomePage() and (b) to show the welcome message using the welcomeLabel. Once done, make a separate commit with an appropriate message to GitLab and attach a screenshot of the passing Espresso test and the welcome screen to the PDF (05 marks).
Q3 (10 marks) Account registration involves saving user credentials into a database. Q2 does not store the credentials in the database. In this question, you will first store these credentials into a Firebase database and then retrieve them. Read the following requirements and modify the existing assignment code to implement the engineering tasks.
T1: Once a valid Net ID and a valid email address are entered and the register button is clicked, both credentials should be saved into a Firebase database. The assignment code provides a few hints but does not store the information yet. Modify this code and add necessary items to implement the functionality. Once implemented, make a separate commit with an appropriate message to GitLab and attach a screenshot to the PDF that shows the stored credentials in your Firebase database (05 marks).
T2: Once the RETRIEVE CREDENTIALS button from WelcomeActivity is clicked, the retrieved Net ID and email address from the database should be shown as a Toast or AlertDialog message. Make a separate commit with an appropriate message to GitLab and attach a screenshot of the shown message to the PDF (05 marks).
Q4 (05 marks): Read the following story, understand the design problem, and provide your so- lution. The question will require experience in object-oriented programming. Online research is allowed for this question. However, you must cite your sources properly that are used to answer this question.
A tale of a freshman software engineer: After graduating from Dalhousie university, Joe has recently joined a reputed software company called XYZ. The company exercises pair-programming,
Winter 2022: CSCI 3130 – Introduction to Software Engineering Assignment 2 Page 3 of 4
Figure 1: Code snippet from XYZ codebase
i.e., the development tasks are completed in pairs. Since Joe is a newcomer, he has been paired with an experienced developer, Jane. One fine morning, during pair-programming, they encounter a piece of code (shown in Figure 1) in their company codebase.
Apparently, the code looks fine, i.e., an application attempts to send an email using an email- sending service. However, due to long work experience, Jane immediately understood that there is a design problem in this code. The client code is not supposed to initialize its dependencies. Unfortunately, Joe is still not clear about the problem. One phrase he heard from Jane is that we need to use Dependency Injection in this code to fix the design problem. Can you help them with your answers and insights? (Online resources might be required to answer this question and if used, they must be acknowledged properly).
(a) Can you explain how dependency injection will address the design issue in this code? (03 marks)
(b) Can you re-design this code using any of the dependency injection techniques? (02 marks)
Version: January 23, 2022
Winter 2022: CSCI 3130 – Introduction to Software Engineering Assignment 2 Page 4 of 4
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com