Browse Prior Art Database

A system and method to link specific classes and methods to unit tests

IP.com Disclosure Number: IPCOM000241704D
Publication Date: 2015-May-23
Document File: 4 page(s) / 78K

Publishing Venue

The IP.com Prior Art Database

Abstract

System and method to intelligently link test dependencies to classes which can be inherited by both parent and child classes. Additionally, allows linking tests to classes that are tightly coupled to ensure consistent operation in the overall application.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 51% of the total text.

Page 01 of 4

A system and method to link specific classes and methods to unit tests

Disclosed is a system and method to improve testing code coverage and usefulness of tests. There is a rightful emphasis on writing unit tests to ensure stability and guard against regressions in applications. However, there lacks a rigorous system to ensure that developers don't add a feature or fix a defect that causes unexpected behavior elsewhere in the application. There are multiple problems with current testing environments that undermine productivity:
1) A new developer might not modify the tests before code delivery, which prevents confidence in the correctness of the new feature or defect fix.

2) A developer may not know which test to modify if they are looking at legacy code.

3) If they do find the right test and fix it, the developer is still unaware of potential effects outside of that set of tests.

Current solutions, like JUnit, fully allow integration tests that can catch these problems, but it's highly dependent on proactive developers and typically is time consuming even with the help of continuous integration (CI) infrastructure. We propose enhancements to test tooling to encourage and enable developers to tests changes and their effect on the overall application. The goal is to improve stability of the build by running all dependent unit tests associated to classes affected by the change before delivery. As an example, in the Java programming language, the test dependency requirement could be implemented as an annotation which will be described in further detail. Some potential benefits are:
1) Prevent the loss of computational resources and time required for continuous integration to build and run the entire application and every test. Additionally limits the resources spent identifying and fixing the damage of a failed CI run.

2) Prevents the developer from just running the tests directly associated with the class they're modifying, ensuring that tests for parent/child classes and other tightly coupled classes are run.
3) The granularity allows developers to run only the tests needed rather than entire integration suites of tests.

An example implementation for Java to integrate with Junit is a two step solution:
1) Mark each class with an annotation designating Junit tests for the class. Example: @Junit PersonTest
Class Person {
String firstName;

String lastName;

public Person(String firstName, String lastName) { this.firstName = firstName;
this.lastName = lastName;

}

public String getFirstName() { return firstName;

}

1


Page 02 of 4

public String getFullName() { return firstName + " " + lastName }
}

by doing this we tell our concept implementation to run the tests in PersonTest every time a change is made to the class Person. An advantage of this simplified linking approach is that a user can link all Junits they believe should be run any time a change is made to the class.


2) Smartly select tests to run which tests the classes dependent on the cla...