Docsity

Regression Testing and Automated Checking in CSIS 110 - Prof. Brian F. Hanks, Study notes of Javascript programming

Toggle sidebar
bg1
CSIS 110 – Lecture 35
Announcements
Read: Chapter 6, sections 6.1 through 6.4
Quiz: Friday, December 2
Register for classes!
Guest speaker tonight
- Dan Ourada, Mercury Payment Systems, 6PM, Sage 140
Regression Testing:
Last time we started creating automated tests to make regression testing easier. What's
regression testing?
Regression testing is the process of re-running tests that have already passed to ensure
that changes to the code didn't introduce errors in parts of the code that used to work.
Why is it a good idea?
Experience has shown that a software bugs are frequently introduced when a programmer
fixes a different problem.
Automated Checking of Test Results
We saw we can create automated tests in BlueJ easily. We can create a Test class that is
associated with the class we are developing, and then we can record tests. BlueJ writes
the code for us.
Go back and open you diary-testing-junit-v1 project.
What is common about all of the tests that we created?
We create a Day object and at least one Appointment object in each of them.
We can define a Fixture that does this for us. Let’s look at what I mean.
Create a Day Object and an Appointment Object. Now, under the DayTest class menu,
select Object Bench to Test Fixture. What happened?
The objects seemed to disappear. Go look at the source code for the DayTest class.
pf2

Partial preview of the text

Download Regression Testing and Automated Checking in CSIS 110 - Prof. Brian F. Hanks and more Study notes Javascript programming in PDF only on Docsity!

CSIS 110 – Lecture 35

Announcements Read: Chapter 6, sections 6.1 through 6. Quiz: Friday, December 2 Register for classes! Guest speaker tonight

  • Dan Ourada, Mercury Payment Systems, 6PM, Sage 140 Regression Testing: Last time we started creating automated tests to make regression testing easier. What's regression testing? Regression testing is the process of re-running tests that have already passed to ensure that changes to the code didn't introduce errors in parts of the code that used to work. Why is it a good idea? Experience has shown that a software bugs are frequently introduced when a programmer fixes a different problem. Automated Checking of Test Results We saw we can create automated tests in BlueJ easily. We can create a Test class that is associated with the class we are developing, and then we can record tests. BlueJ writes the code for us. Go back and open you diary-testing-junit-v1 project. What is common about all of the tests that we created? We create a Day object and at least one Appointment object in each of them. We can define a Fixture that does this for us. Let’s look at what I mean. Create a Day Object and an Appointment Object. Now, under the DayTest class menu, select Object Bench to Test Fixture. What happened? The objects seemed to disappear. Go look at the source code for the DayTest class.

There are now a couple of instance variables, and the setup method creates instances of the Day and Appointment objects. The setup method gets called automatically whenever we run a test, before the test is executed. Let's go and record another test. Notice that when I do this, a Day and Appointment object appear in the Object bench before I can start recording new actions. I don't have to do this part myself – BlueJ's testing framework did this for me. Application Testing Let's go back and look at your assignment for this Friday. You need to define test cases that look for defects, and you need to try to identify the defects as much as possible. So, if you have a complex test case such as "Use the Keyword "windowpane" and the cleartext "The bomb is hidden in the basement", you will have a couple of problems:

  • You have to work out the what the expected result is, which is not that easy to do by hand, so you might make a mistake.
  • If you find an error, it's really difficult to tell what the problem is. Is it a problem with the keysquare or the encryption? If it’s the encryption, which step is wrong? So, you want to create test cases that are simple to write, and when the result is not what you expect, you can more precisely identify the possible cause. I strongly recommend this approach:
  1. Creating test cases for testing the keysquare part of the program first
  2. When you think you have tested that thoroughly, define test cases for the encryption part. By this time, you should know some keywords that you can use that create good keysquares. Let's create one test case for the keysquare part of the program. What is a simple test case? OK, so for your lab time today you can work on the project.