-
Notifications
You must be signed in to change notification settings - Fork 0
Project Report Deliverable 2
Goal of this deliverable: Implement the feature for add equipment bundle.
We had to use BDD and TDD for the implementation of the features. The AddEquipmentBundle.feature was already fully implemented in Gherkin and Cucumber for us. We used this code to implement AddEquipmentBundleStepDefinitions.java. While testing, the test runner will go through AddEquipmentBundle.feature to test the different cases. In the step definitions, we defined what each step has to do. Thus, the methods we wrote in AddEquipmentBundleStepDefinitions.java would get executed whenever the key line preceding them gets invoked. We wrote code in the step definitions so that what is described in the AddEquipmentBundle.feature can get executed.
To do so, we also implemented supplemental methods. In the step definitions, we added a @After tearDown to make sure the test cases run in isolation. In DiveSafeApplication.java, we implemented a setter to create a Dive Safe instance in the application with the specific parameters we need.
We then used TDD to implement the controller with AddEquipmentBundle.feature and AddEquipmentBundleStepDefinitions.java as references.
We implemented the feature for adding equipment bundles in the BundleController.java, more specifically in the addEquipmentBundle method. First, we implemented the code necessary in addEquipmentBundle to create a bundle with bundle items inside. It was then put in a try-catch to catch runtime errors.
Finally, while referring to DiveSafe-constraints.txt, AddEquipmentBundle.feature and AddEquipmentBundleStepDefinitions.java, we used TDD so that all the tests can pass and all the constraints are respected. Many if are written to catch invalid inputs and duplicates and return the corresponding error message. We used CucumberFeaturesTestRunner.java to ensure all the tests relating to our feature/part are passed.