CSE 300 Software Engineering CSE 300 CSE 300

  • Slides: 8
Download presentation
CSE 300 - Software Engineering CSE 300

CSE 300 - Software Engineering CSE 300

CSE 300 - Software Engineering Discussion Items • JQuery in Practice • Test Driven

CSE 300 - Software Engineering Discussion Items • JQuery in Practice • Test Driven Development 2 by Manish Shrotriya

CSE 300 - Software Engineering JQuery in Practice • JQuery is a wrapper object

CSE 300 - Software Engineering JQuery in Practice • JQuery is a wrapper object over DOM objects and provides cross browser compatible, easy and uniform manipulation capability. • $() or JQuery() is a selector function that allows to retrieve desired DOM objects in an array, based on selection criteria. • $. functions are static, stand alone utility functions like: ▪ $. each is used to iterate over an array. ▪ $. get and $. post is used to send get Ajax requests. ▪ $. load appends a given html under the selected html elements. 3 by Manish Shrotriya

CSE 300 - Software Engineering Test Driven Development • Test Plans: ▪ Test Plan:

CSE 300 - Software Engineering Test Driven Development • Test Plans: ▪ Test Plan: list of all tests to validate the correctness of a program. ▪ Test: Each test: ◦ ◦ ◦ declares all prerequisites for a function specifies the expected results specifies input for the expected results runs the target with the defined input checks the actual output against the desired or expected output. 4 by Manish Shrotriya

CSE 300 - Software Engineering Test Driven Development • Manual testing: ▪ We write

CSE 300 - Software Engineering Test Driven Development • Manual testing: ▪ We write a Test plan having details about every test, execute each test using given steps from the plan and update it with the result. • Automated testing: Test method/function corresponding to each test in test plan. It will: ▪ ▪ Create all input or pre conditions required by the target method. Define expected output Run the target method Check output against the expectation 5 by Manish Shrotriya

CSE 300 - Software Engineering Test Driven Development • Test Driven Development: ▪ Create

CSE 300 - Software Engineering Test Driven Development • Test Driven Development: ▪ Create a design and test plan based on requirements. ▪ Write test method for each target class/method. It will fail. ▪ Write code in target method to make test pass. • Test Driven Design: ▪ Create a starting point. It is typically a simple or very first piece of functionality based on requirements. ▪ Write test method for this functionality. It will fail. ▪ Write code in target method to make test pass. Write tests for all necessary classes before adding any methods to them. 6 by Manish Shrotriya

CSE 300 - Software Engineering Test Driven Development • TDD cycle: ▪ ▪ ▪

CSE 300 - Software Engineering Test Driven Development • TDD cycle: ▪ ▪ ▪ Write a test based on requirements Run the test, and watch it fail Write the simplest code you can to make the test pass. Run the test and watch it pass Improve the code as required to make it perform well, be readable and reusable, but without changing its behavior ▪ Repeat the Cycle 7 by Manish Shrotriya

CSE 300 - Software Engineering Test Driven Development • TDD Benefits: ▪ Scope check-

CSE 300 - Software Engineering Test Driven Development • TDD Benefits: ▪ Scope check- we write code only to pass a tests. ▪ Keeps design simple, Loosely coupled, highly cohesive code is easy to test. If you can’t write a test for a piece of code, that code shouldn’t exist. ▪ Builds trust with team members, managers, and stakeholders. Code that passes the test is acceptable any time. Safety net ensures it would maintain it's quality. ▪ Rhythm of test, code, refactor—a rhythm that is at once productive, sustainable, and enjoyable. 8 by Manish Shrotriya