Software Testing

?
  • Created by: wreje035
  • Created on: 14-10-18 21:48
Dimensions of software quality:
Correctness - does the system meet the users needs. Usability - how much effort. Maintainability - effort to fix improve or add. Performance. Testability, Reliability, Reusability
1 of 31
Verification?
Are we building the product right? Code reviews, Software testing.
2 of 31
Validation?
Are we building the right product? Acceptance tests.
3 of 31
What is Software Testing?
The process of checking that a system: meets the required spec, is usable by intended users, executes without errors, handles problems gracefully. Program testing can be used to show the presennce of bugs, but never the absence.
4 of 31
Types of testing:
Code Reviews / Functional Testing / Structural Testing / Component Testing / Integration Testing / System Testing / Aceptance / Unit
5 of 31
Code Review?
Devs review each others work - formal or informal. Pair/peer programming. Trade off reduced productivity vs reduced maintenance costs. Encourages devs to stick to conventions and quality standards. Can use pull request from a fork.
6 of 31
Functional Testing?
Black Box Testing. Inputs are checked against expected outputs. Internal code knowledge is not known. Used to test that features perform as expected under typical conditons. Can be used to VALIDATE a system using test cases.
7 of 31
Structural Testing?
White Box Testing: Uses knowledge of internal code implementation to select inputs that can cause every possible execution path of a feature to be exercised. Tests boundary/edge cases. More likely to uncover bugs. Lots more effort. Can VERIFY system
8 of 31
Component Testing:
Testing a component in isolation. Use DRIVERS to create data sets (fixtures) with known values to test with. Call methods with inputs. Evaluate the responses.
9 of 31
Eg of component testing:
Create test studnet with known details, save it to the DAO, get the student, check returned student against test student.
10 of 31
What if the component we're testing depends on other components?
eg GUI depends on DAO. Give the components STUBS or MOCKS to use in place of real components usually used. Each mock checks that the component interacted with it appropriately.
11 of 31
Integration Testing:
Testing two or more components together. Useful when teams have been working on components individually. Eg GUI vs JDBC and GUI vs collections DAO.
12 of 31
System Testing:
Testing installation and deployment. Testing Security. Performance Testing. Stress Testing. Testing back up and recovery. Disaster recovery process.
13 of 31
Acceptance Testing:
Validation Testing - are we building what the customer wants? Use cases decided on with the customer and used for functional testing. Customer can be given a preview version to test in their own environment.
14 of 31
Unit Testing:
Testing smallest unit of modularity - a class in java. Uses automated testing frameworks.Dev of class writes its tests. Structural - should exercise all known execution paths.
15 of 31
Rules for testing?
Tests should be self contained and independent of each other. Tests shouldnt make assumptions about the systems state. On initialisation - set up required state. Tests should clean up after themselves. On completion, undo any changes made.
16 of 31
Rules for testing
Test your tests. Intentionally break code to ensure tests actually catch errors. When reporting a bug, its a good idea to provide a unit test that reliably reproduces it. If your codes hard to test, it needs refactoring.
17 of 31
Automated Testing?
Use a unit testing framework like JUnit to crate unit tests for structural testing. Use mocking frameworks like Mockito to create stubs/mocks for component testing. Create a test stuit that runs all these to test the entire system wiht a single click
18 of 31
Advantages of automated testing?
Gives us a safety net - we know quickly if we accidently break something. Tests are automatic. Fix, run and manually test, auto test whole system, commit.
19 of 31
Test Driven Development
Create tests before implementing feature. Plan create test, run tests, implement feature, run tests. Its about producing code thats CLEAN AND SIMPLE, EASIER TO TEST, WELL ENCAPSULATED, UNLIKELY TO BE VERBOSE, EASIER TO MAINTAIN
20 of 31
Benefits of TDD
You'll always have comprehensive test coverage. Tests become part of the documentation.
21 of 31
Agile methodoligies and TDD
Functional Tests are described as User Stories. Each user story has its own test(s) that ensre the story is actually implemented, and correct. Tests can be used as acceptance tests.
22 of 31
Behaviour Driven Development?
A specialised and improved TDD. BDD replaces test with behaviour to emphasise that testing is just part of the process. Forces devs to do TDD the right way. Describes the system from the stakeholders point of view. VERIFY behaviour
23 of 31
JUnit testing: For saving a student
Set up the state for testing (testing studentDAO class) (create students). Clean up after test is complete (delete students). Save, retrieve, assert equals (check student matches one we saved)
24 of 31
Junit tests
new instance of the TestCase class is created for each @test method. The @before method runs before each test method. The @after method runs after each test method. Each test should run in isolation. JUnit specifies a set of assert methods for verify
25 of 31
GUI Testing:
Object orientation makes GUI testing hard. Encapsulation hides the GUI componenetns from our tests. AssertJ makes it easier. Can access GUI components using their properities. We can verify comps are displaying correct data.
26 of 31
AssertJ
AssertJ provides a robot that will type and click things.Tell the robot to run through each test case.
27 of 31
Problems with AssertJ
Our data is stored in a database - we could easily choose data that already exists. Tests may be non determinisitic. We're relying on side effects in the DAO to test the GUI. This violates all the rules of component testing!
28 of 31
Component testing with Mockito:
We SHOULD be testing the GUI in isolation. We can create a mock DAO - mock provides implementation of methods the GUI needs.We use the mock to verify that the GUI interacted with the DAO in the expected way.
29 of 31
Java is verbose!
Use frameworks like AssertJ and Mockito to reduce code written.
30 of 31
Unit Testing vs Automated Testing
Unit: dev of each unit (class) provides code to test it. Lets devs test things that arent finished. Frameworks (JUnit) can aggregate and execute tests. Unit testing and automated testing now mean the same!
31 of 31

Other cards in this set

Card 2

Front

Verification?

Back

Are we building the product right? Code reviews, Software testing.

Card 3

Front

Validation?

Back

Preview of the front of card 3

Card 4

Front

What is Software Testing?

Back

Preview of the front of card 4

Card 5

Front

Types of testing:

Back

Preview of the front of card 5
View more cards

Comments

No comments have yet been made

Similar ICT resources:

See all ICT resources »See all Software Testing resources »