Category Archives: Unit Testing

Database Unit Testing Made Easy with Visual Studio Team Systems

While brushing up on my knowledge of software testing concepts, I came across quite an amusing definition of testing; “To tell somebody that he is wrong is called criticism. To do so officially is called testing” . A programmer usually resents it when a tester finds a defect in his code. We programmers thoroughly unit test our code before handing it off to a tester, because we take pride in developing a bug free application. Some programming languages (C# , VB, ASP.NET) afford themselves to be unit testing easily, because the application is developed within Visual Studio and can readily leverage its unit testing framework.

Visual Studio allows you to create Database projects, and database developers have started embracing it since Visual Studio Team Systems 2008 Database Edition GDR. This offers a robust framework for database developers to identify bugs with their database objects (schemas, stored procedures, functions, etc) by unit testing their database (T-SQL) code, before handing it over to the tester.  Before we jump into the specifics of database unit testing with Visual Studio, the next couple of paragraphs warm us up to the topic by covering a few basic concepts of software testing.

Software testing, undoubtedly plays a important role in the life cycle of most IT Projects. The Goal of any type of software testing is to identify defects to be fixed, so that the product meets requirements and has a deterministic and predictable output. Depending on the testing method employed, testing can be implemented at any time in the development process. Different software development models will focus the test effort at different phases in the development process. Newer development models, such as Agile, often employ test driven development and place an increased portion of the testing in the hands of the developer, before it reaches a formal team of testers.

Software testing methods are traditionally divided into white and black-box testing. These two approaches are used to describe the point of view that a test engineer takes when designing test cases. Unit Testing falls under the category of  white box testing, where the  the tester has access to the internal data structures and algorithms, including the code that implements these. This is in contrast with the black-box testing method, which  treats the software as a “black box”—without any knowledge of internal implementation. A black box tester is usually not a programmer, and  aims to only test the functionality of software according to the applicable requirements. Since the black-box tester has no knowledge on the underlying code, he may find bugs that a programmer misses. However, the same principle can sometimes lead to writing inefficient or incomplete test cases.

Unit Testing is a key component of Test driven development (TDD). Unit Tests are usually written by Developers while they work on the code, to ensure that a specific  of piece of code (Function, Class, Stored procedure, etc) is working as expected. Unit Testing helps to identify defects in the earlier stages of the software development life cycle, where they are cheaper to fix. Unit Testing can prove especially challenging in the world of database development, because of the need for a consistent test environment.

Database Unit Tests are used to establish a baseline state for a database and then to verify any subsequent changes that you make to database objects.  The Unit Testing Framework in Visual Studio (starting with VSTS 2005) helps database developers create, manage and execute Unit Tests for a Database. The Microsoft.VisualStudio.TestTools.UnitTesting namespace supplies classes that provide unit testing support. This namespace contains many attributes that identify test information to the test engine regarding data sources, order of method execution, program management, agent/host information, and deployment data. It also contains custom unit testing exceptions.

You will need the Database Edition GDR of VSTS 2008 or the Ultimate (or Premium) Editions of VSTS 2010 to create, modify and run database unit tests. You can run database unit tests with Professional Edition on VSTS 2010, but cannot create or modify them. Before you can start running database unit tests in VSTS, you must first create a Database Project and then create a test project. The next step is to write sets of Transact-SQL tests that exercise your database objects. Executing these tests in your isolated development environment helps you to verify whether those objects are behaving correctly before you check them in to version control. As changes are made to the database schema, you can use these tests to verify whether the changes have broken existing functionality. A detailed step by step walk through for creating and running database unit tests can be found  here on MSDN .

In a typical database unit test, a Transact-SQL test script runs and returns an instance of the ExecutionResult class. The instance of this class contains a DataSet, the execution time, and the rows affected by the script. All of this information is collected during execution of the script. These results can be evaluated within the Transact-SQL script by using the RAISERROR function, or they can be evaluated by using test conditions. Visual Studio Premium provides a set of the following predefined test conditions for you to use;

  • Data Checksum
  • Empty Resultset
  • Execution Time
  • Expected Schema
  • Inconclusive
  • Not Empty Resultset
  • Row Count
  • Scalar Value

You can also create negative unit tests to verify expected failures in a stored procedure. A detailed description of the database unit test conditions can he found  here on MSDN .
Visual Studio lets you create test lists to organize unit tests into groups. Test lists are also used to;

  • Run multiple unit tests as a group
  • Run tests as a part of a Build
  • Enforce check-in policy

Visual Studio 11 (currently Beta) comes with a host of unit testing enhancements. Some of the new features include the Unit Test Explorer and Support to Third Party Test Frameworks. More details can be found here on  Peter Provost’s MSDN Blog post .
Visual Studio not only continues to offer a robust framework for implementing database projects, but also makes a compelling case to use it for unit testing database code. It helps us programmers get one step closer to developing a bug free application.
I am presenting a 60 minute session on this topic at the St.Louis Days of Dot Net Conference, Aug 2nd – 4th 2012, where I    will not only cover the basis of unit testing concepts and terminology, but also discuss how unit testing helps ensure and document the quality and accuracy of database deliverables. I will also will run through a demo of creating and running database unit tests using VSTS 2010 . I have spoken on the same topic in the past at the St.Louis SQL Server User Group meeting on June 12th 2012.

References:

  • Software Testing Principles, Terminology & Definitions – http://en.wikipedia.org/wiki/Software_testing

    Unit Testing Framework in Visual Studio -

    • http://msdn.microsoft.com/en-us/library/ms243147(v=vs.80).aspx
    • http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.unittesting(v=vs.80).aspx
  • Database Unit Testing with Visual Studio –
    • http://msdn.microsoft.com/en-us/library/dd172118.aspx
    • http://msdn.microsoft.com/en-us/library/aa833283.aspx
  • Unit Test Conditions in Database Unit Tests -    http://msdn.microsoft.com/en-us/library/aa833423
  • Test Lists – http://msdn.microsoft.com/en-us/library/ms182461.aspx
  • Visual Studio 11 (Beta) Unit Testing updates -    http://blogs.msdn.com/b/visualstudioalm/archive/2012/03/08/what-    s-new-in-visual-studio-11-beta-unit-testing.aspx
  • Software  Testing Jokes-

       http://softwaretestingfundamentals.com/software-testing-jokes/

    source:http://sqlwithsanil.com/2012/07/08/database-unit-testing-made-easy-with-visual-studio-team-systems/

  • Did you like this? Share it:

    Continuous Integration and Testing :Unit and Integration Tests With Maven and JUnit Categories

    Introduction

    This example shows how to split unit and integration tests using Maven and JUnit categories.
    It is especially useful for existing test suites and can be implemented in minutes.

    Why use this?

    My previous post showed how we to use a maven profile to split unit and integration tests.
    http://johndobie.blogspot.co.uk/2011/06/seperating-maven-unit-integration-tests.html
    This has been a very well read post and I like how it uses seperate directories. However this example show a much simpler technique that can easily be applied to legacy test suites.
    It offers most of the benefits of the original, and sits more comfortably in the Maven world.

    Code

    The code for the example is here.

    svn co https://designbycontract.googlecode.com/svn/trunk/examples/maven/categor...
    mvn clean install

    JUnit Categories

    As of JUnit 4.8 you can define your own categories for tests. This enables you to label and group tests.

    This example shows how easy it is to separate unit and integration test using the @Catgegory annotation.

    http://kentbeck.github.com/junit/javadoc/latest/org/junit/experimental/categories/Categories.html

    Define the Marker Interface

    The first step in grouping a test using categories is to create a marker interface.

    This interface will be used to mark all of the tests that you want to be run as integration tests.

    public interface IntegrationTest {}

    Mark your test classes

    Add the category annotation to the top of your test class. It takes the name of your new interface.

    import org.junit.experimental.categories.Category;
    @Category(IntegrationTest.class)
    public class ExampleIntegrationTest{

    @Test
    public void longRunningServiceTest() throws Exception {

    }
    }

    Categories can be used to mark classes or methods. Really in my opinion you should only mark a class.

    If you have both unit and integration tests in a single class then split it.

    Configure Maven Unit Tests

    The beauty of this solution is that nothing really changes for the unit test side of things.

    We simply add some configuration to the maven surefire plugin to make it to ignore any integration tests.


    org.apache.maven.plugins
    maven-surefire-plugin
    2.11


    org.apache.maven.surefire
    surefire-junit47
    2.12




    **/*.class

    com.test.annotation.type.IntegrationTest


    There are 2 very important parts. The first is to configure surefire to exclude all of the integrations tests.

    com.test.annotation.type.IntegrationTest

    Surefire will run all of your tests, except those marked as an integration test.

    The other important part is to make sure the surefire plugin uses the correct JUnit provider. The JUnit47 provider is needed to correctly detect the categories.



    org.apache.maven.surefire
    surefire-junit47
    2.12


    Running the unit tests

    To make sure this works correctly we can run the unit tests

    mvn clean test

    You can see from the output below that the unit test is run, but not the integration test.

    -------------------------------------------------------
    T E S T S
    -------------------------------------------------------
    Running com.test.EmptyUnitTest
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec

    Results :

    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------

    Configure Maven Integration Tests

    Again the configuration for this is very simple.

    We use the standard failsafe plugin and configure it to only run the integration tests.


    maven-failsafe-plugin
    2.12


    org.apache.maven.surefire
    surefire-junit47
    2.12



    com.test.annotation.type.IntegrationTest




    integration-test



    **/*.class





    The configuration uses a standard execution goal to run the failsafe plugin during the integration-test phase of the build.

    The following configuration ensures only the integration tests are run.

    com.test.annotation.type.IntegrationTest

    And again the JUnit provider must be correctly configured.



    org.apache.maven.surefire
    surefire-junit47
    2.12


    That’s it!

    Running the integration tests

    We can now run the whole build.

    mvn clean install

    This time as well as the unit test running, the integration tests are run during the integration-test phase.

    -------------------------------------------------------
    T E S T S
    -------------------------------------------------------
    Running com.test.AnotherEmptyIntegrationTest
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec

    Running com.test.EmptyIntegrationTest
    Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 sec

    Results :
    Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
    source:
    http://www.javaworld.com/community/?q=node/8374
    Did you like this? Share it:

    More Than 90% of Developers Believe Unit Testing Is Most Effective For Reducing Bugs

    […]

    80 percent of respondents said that bugs are the responsibility of developers and only 8 percent said it was QA’s. More than 54 percent of respondents noted that they were responsible for bugs in their company’s software. An additional 26 percent of respondents felt that another developer was most responsible for software bugs.

    Finding and fixing bugs takes up a significant portion of developers’ time, according to the survey. 48 percent of respondents said that they spend up to 5 hours each week finding and fixing bugs and 38 percent said they spend up to 10 hours a week on this alone, which is 25 percent of the average work week. An additional 12 percent spend over 10 hours of their week finding and fixing bugs. According to data received from customers using Typemock Team Mate, tracking developers’ actual usage, the amount of time developers spend using the debugger is even higher than they think – around 50-55 percent of their time.

    Today, a company’s value is greatly affected when customers experience bugs in their software. Over 50 percent of respondents noted that, as developers, it is most damaging to their reputation when end users report a bug in the program.

    As the survey shows, unit testing is more crucial than ever and with proper unit testing developers will be more efficient, catch more bugs, and create higher-quality code.

    “As professional programmers, we know that unit testing is the best way to get rid of software bugs,” said Eli Lopian, CEO of Typemock. “Over 90 percent of developers see unit testing as the most effective way to find and fix bugs. We know that unit testing is difficult to start and the rewards are great. This is exactly the problem that Typemock is out to solve – helping beginners, novices, and experts to reach their unit testing/TDD goals. Automated unit testing with Typemock’s Isolator V7 ensures software bugs are caught instantly so they can be corrected immediately.”

    […]

    Read More:

    http://www.darkreading.com/vulnerability-management/167901026/security/news/232800324/more-than-90-of-developers-believe-unit-testing-is-most-effective-for-reducing-bugs.html

    Did you like this? Share it:

    Unit Testing is a Means to an End

    Most professional software developers these days understand the importance and value of writing and using unit tests. A nice summary of some of the oft-touted and oft-realized benefits of unit testing can be found in the StackOverflow.com thread Is Unit Testing worth the effort? [my only very minor criticism is the mixing of more specialized Test-Driven Development (TDD) with the more general unit test concept]. As with most good things, however, even unit testing enthusiasm can go too far. The benefits of unit testing can lead to overly enthusiastic unit testing developers forgetting that unit tests are not the end themselves, but rather are a means to the real end.

    The "end" that most software developers are striving for is delivery of software solutions that make their users’ lives easier and more productive. Unit tests can be extremely valuable in obtaining this end and certainly add to software quality, but the overly zealous unit tester must beware of allowing the unit tests themselves to displace this end goal. It’s all too easy to allow oneself to get so bound up in writing exhaustive and "perfect" unit tests that one puts the true end goal at risk. In the remainder of this post, I look at ways in which developers can allow unit testing to move from helping achieve the desired end to unintentionally displacing the real end and putting it at risk.

    Overreaching Unit Testing

    Steven Sanderson has written "the benefit of unit testing is correlated with the non-obviousness of the code under test." I largely agree with this sentiment as a general guideline. I see little value in unit testing trivial "get" and "set" methods. Some methods are more readily evaluated via code review than via unit test.

    The concept of code coverage can be a useful one as long as it’s not taken too far. Code coverage appears to provide high return for the effort for a while, but there comes a point of diminishing returns when gaining additional code coverage comes at much greater cost and may not be worth that cost. It’s also important to recognize that even the often highly expensive 100% code coverage typically means only all lines of code were executed and does not check all possible paths through the code.

    All Code’s Unit Testability is Not Equal

    The post Selective Unit Testing – Costs and Benefits clearly articulates well the differences in difficulty (cost) and advantages (benefits) of unit testing of different types of code. In cases where the advantages/benefits of a unit test are high and the cost/effort is low, the value of unit testing is obvious. On the opposite extreme, there are types of code that receive little benefit from unit testing.

    Source: http://www.javaworld.com/community/?q=node/8354

    Did you like this? Share it:

    Unit Test For ASP.NET Page With WatiN

    Unit Test For ASP.NET Page With WatiN

    WatiN is a tool from Watir, used to test Web pages. WaitN stands for Web Application Testing in .NET.

    Here we will test a simple ASP.NET page, with which to demonstrate the scene of identity and acceptance (agreement aclearcase / “target =”_blank ”> acceptance). Users enter name in the text box, click “I agree” check box, then press submit button. This is obviously a very simple page. You can use this idea for large pages testing when you are familiar with the working mechanism of WatiN framework.

    Test Agreement Page:

    Add a class library project to solution, as well as test tool (here used MbUnit, but you can use Nunit or VSTS) and WatiN library reference.

    The following test code to ensure that users have already recognised.

    [TestFixture(ApartmentState =

    ApartmentState.STA)]publicclassTestAgreementPage{[Test]

    publicvoidTestCanAcceptUserAgreement(){IE ie =

    newIE(ConfigurationManager.AppSettings["DefaultPageUrl"]);

    ie.TextField(“txtName”).TypeText

    (“Mohammad Azam”);ie.CheckBox(“chkAgree”).Checked =

    true;ie.Button(“btnAgree”).Click(); Assert.AreEqual(“Valid”,

    ie.Span(“lblMessage”).Text);}} .csharpcode, .csharpcode pre

    { font-size: small; color: black; font-family: consolas, “Courier New”, courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op

    { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

    This class has TestFixture Attribute and STA value. Ensure the test runs in the state of STA (Single Threaded Apartment). That is because the test code needs to be loaded IE.

    IE class in WatiN completed the main work. IE class opens IE, refers html control by name or id. ie.TextField(“txtName”).TypeText(“Mohammad Azam”) refers id “txtName” text box. After browser is loaded, WatiN will enter “Mohammad Azam” to “txtName” text box. You could see this process during the test. After that, id “chkAgree” check box will be selected. Finally, WatiN will press the submit button to submit the form.

    Did you like this? Share it:

    The Introduction of Unit Testing

    Unit testing is one of the steps all good developers take when developing an application.

    It involves testing a single method or function to ensure it is behaving as expected. Generally, if a developer plan to develop his or her method they will thoroughly unit test it. However, when changes are made for a new release they will fall apart the process. Then too much time developers test the scenario that was requested without going back to make sure other scenarios didn’t break.

    Fortunately, the unit testing of Visual Studio can help solve this problem. You can build the scripts which are essentially classes that call your code, and then you can execute to determine if the code is working correctly. Once you re-factor your code you can simply run the unit test scripts to insure the code is still functioning properly. For more information about how to create an ASP.NET application, how to unit test the ASP.NET web page and a public class in a class project, and how to execute your unit tests individually or in a group, you can visit china software unitesting.

    Source: http://aspalliance.com/2053_Unit_Testing_Using_Visual_Studio_2010

    Did you like this? Share it:

    12 Unit Testing Tips for Software Engineers

    Unit Testing is one of the pillars of Agile Software Development. First introduced by Kent Beck, unit testing has found its way into the hearts and systems of many organizations. Unit tests help engineers reduce the number of bugs, hours spent on debugging, and contribute to healthier, more stable software.

    In this post we look at a dozen unit testing tips that software engineers can apply, regardless of their programming language or environment.

    1. Unit Test to Manage Your Risk

    A newbie might ask Why should I write tests? Indeed, aren’t tests boring stuff that software engineers want to outsource to those QA guys? That’s a mentality that no longer has a place in modern software engineering. The goal of software teams is to produce software of the highest quality. Consumers and business users were rightly intolerant of buggy software of the 80s and 90s. But with the abundance of libraries, web services and integrated development environments that support refactoring and unit testing, there’s now no excuse for software with bugs.

    The idea behind unit testing is to create a set of tests for each software component. Unit tests facilitate continuous software testing; unlike manual tests, it’s cheap to perform them repeatedly.

    As your system expands, so does the body of unit tests. Each test is an insurance that the system works. Having a bug in the code means carrying a risk. Utilizing a set of unit tests, engineers can dramatically reduce number of bugs and the risk with untested code.

    2. Write a Test Case Per Major Component

    When you start unit testing, always ask What Tests Should I Write?

    The initial impulse is to write a bunch of functional tests; i.e., tests that probe different functions of the system. This is not correct. The right thing is to create a test case (a set of tests) for each major component.

    The focus of the test is one component at a time. Within each component, look for an interface – a set of publicly exposed behavior that component offers. You then should write at least one test per public method.

    3. Create Abstract Test Case and Test Utilities

    As with any code, there will be common things all your tests need to do. Start with finding a unit testing for your language. For example, in Java, engineers use JUnit – a simple yet powerful framework for writing tests in Java. The framework comes with TestCase class, the base class for all tests. Add convenient methods and utilities applicable to your environment. This way, all your tests cases can share this common infrastructure.

    4. Write Smart Tests

    Testing is time-consuming, so ensure your tests are effective. Good tests probe the core behavior of each component, but do it with the least code possible. For example, there is very little reason in writing tests for Java Bean setter and getter methods, for these will be tested anyway.

    Instead, write a test that focuses on the behaviour of the system. You don’t need to be comprehensive; create the tests that come to mind now, then be ready to come back to add more.

    5. Set up Clean Environment for Each Test

    Software engineers are always concerned with efficiency, so when they hear that each test needs to be set up separately they worry about performance. Yet setting up each test correctly and from scratch is important. The last thing you want is for the test to fail because it used some old piece of data from another test. Ensure each test is set up properly and don’t worry about efficiency.

    In cases when you have a common environment for all tests – which doesn’t change as tests run – you can add a static set up block to your base test class.

    6. Use Mock Objects To Test Effectively

    Setting up tests is not that simple; and at first glance sometimes seems impossible. For example, if using Amazon Web Services in your code, how can you simulate it in the test without impacting the real system?

    There are a couple of ways. You can create fake data and use that in tests. In the system that has users, a special set of accounts can be utilised exclusively for testing.

    Running tests against a production system is risky: what if something goes wrong and you delete actual user data? An alternative is fake data, called stubs or mock objects.

    A mock object implements a particular interface, but returns predetermined results. For example, you can create a mock object for Amazon S3 which always reads files from your local disk. Mock objects are helpful when testing complex systems with lots of components. In Java, several frameworks help create mock objects, most notably JMock.

    7. Refactor Tests When You Refactor the Code

    Testing only pays if you really invest in it. Not only do you need to write tests, you also need to ensure they’re up to date. When adding a new method to a component, you need to add one or more corresponding tests. Just like you should clean out unused code, also remove tests that are no longer applicable.

    Unit tests are particularly helpful when doing large refactoring. Refactoring focuses on continuous sculpting of the code to help it stay correct. After you move code around and fix the tests, rerunning all the related tests ensures you didn’t break anything while changing the system.

    8. Write Tests Before Fixing a Bug

    Unit tests are effective weapons in the fight against bugs. When you uncover a problem in your code, write a test that exposes this problem before fixing the code. This way, if the problem reappears, it will be caught with the test.

    It is important to do this since you can’t always write comprehensive tests right away. When you add a test for a bug, you’re filling in the gap in your original tests in a disciplined way.

    9. Use Unit Tests to Ensure Performance

    In addition to guarding correctness of the code, unit tests can help ensure the performance of your code doesn’t degrade over time. In many systems slowness creeps in as the system grows.

    To write performance tests, you need to implement start and stop functions in your base test class. When appropriate you can use a time-particular method or code and assert that the elapsed time is within the limits of the desired performance.

    10. Create Tests for Concurrent Code

    Concurrent code is notoriously tricky and typically a source of many bugs. This is why it’s important to unit test concurrent code. The way to do this is by using a system of sleeps and locks. You can write in sleep calls in your tests if you need to wait for a particular system state. While this is not a 100% correct solution, in many cases it’s sufficient. To simulate concurrency in a more sophisticated scenario, you need to pass locks around to the objects you’re testing. In doing so, you will be able to simulate concurrent system, but sequentially.

    11. Run Tests Continuously

    The whole point of tests is to run them a lot. Particularly in larger teams where dozens of developers are working on a common code base, continuous unit testing is important. You can set up tests to run every few hours or you can run them on each check-in of the code or just once a day (typically overnight). Decide which method is the most appropriate for your project and make the tests run automatically and continuously.

    12. Have Fun Testing!

    Probably the most important tip is to have fun. When I first encountered unit testing, I was skeptical and thought it was just extra work. But I gave it a chance, because smart people who I trusted told me that it’s very useful.

    Unit testing puts your brain into a state which is very different from coding state. It is challenging to think about what is a simple and correct set of tests for this given component.

    Once you start writing tests, you’d wonder how you ever got by without them. To make tests even more fun, you can incorporate pair programming. Whether you get together with fellow engineers to write tests or write tests for each other’s code, fun is guaranteed. At the end of the day, you will be comfortable knowing your system really works because your tests pass.

    source: http://www.readwriteweb.com/archives/

    12_unit_testing_tips_for_software_engineers.php

    Did you like this? Share it:

    JUnit project asked to change license for sake of NetBeans IDE

    Oracle has been making what seem to some as drastic changes in the way it handles the open source projects it inherited from Sun Microsystems. The open source community has watched with anything from bemusement to outright shock at some of the actions Oracle has taken without apparent rhyme or reason. But if you look close enough, the reason will usually make itself clear soon enough.

    Last Thursday, Jaroslav Tulach, NetBeans Platform Architect for Oracle, posted a public message on the JUnit Yahoo! groups that asked the JUnit developers to consider switching from testing framework’s current Common Public License to something that would be more compatible with the rest of the NetBeans IDE.

    "We have new lawyers. Our new lawyers seem to be concerned about the JUnit license. True, JUnit’s use of Common Public License is unique and sort of archaic. I don’t know about any other (important) project using this license anymore," Tulach wrote.

    If you read the entire note to the JUnit team, Tulach doesn’t really come across as threatening or intimidating in any way. If anything, he seems a bit sheepish to have to come to the developers of an essential part of NetBeans (and any important Java development) and ask them to make the change.

    He did, unfortunately, lay it out for the JUnit team: because of the CPL’s incompatibility with NetBeans, Oracle’s lawyers were concerned enough to pull JUnit from NetBeans unless JUnit would move to a more modern license, like the Eclipse Public License. The EPL is widely regarded as the natural successor to the CPL, particularly after the Eclipse Foundation retired the CPL in 2009.

    "Right now we are holding our release and getting ready to remove JUnit from our standard installation. Silly, I know, JUnit is necessary part of any serious Java development, but there is not much we can do," Tulach continued, again, with that slightly embarrassed tone.

    The solution for Tulach, on behalf of Oracle and the "about 800,000 active users of NetBeans IDE," was straightforward: change the license from CPL to EPL.

    I contacted one of the key JUnit developers, David Saff, about the request last week, and was encouraged by the brief reply. Saff informed me that the JUnit team was very busy at present, and they would try to get some sort of answer to Tulach and Oracle as soon as they could. I got the sense that Saff was still in discovery mode, and not trying to evade the question.

    Nor was Kent Beck, one of JUnit’s founders, who directly replied to Tulach in the same Yahoo! message thread.

    "Thank you for the message. It is not practical to change the license for JUnit because of the difficult of identifying and notifying contributors. Commercial licenses are available and have been sold through Three Rivers Consulting, Inc. [Beck's employer] with terms crafted to meet your needs. Please have your lawyers contact me for details," Beck wrote.

    The tone of all of these conversations sounds like everyone is pretty cool with working through this issue, which is a nice change from other recent Oracle interactions with open source projects. I think everyone at Oracle who interfaces with open source projects should take a lesson from Tulach’s approach. He recognized that something important needed to be changed, but he didn’t come in with all guns blazing and demand that this will be done and that will be done or else your project shalt be excommunicated.

    What is Oracle’s problem with the CPL license? Likely the clause in Section 7 of the CPL that the Eclipse Foundation dropped when they succeeded the CPL with the EPL:

    "If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient’s patent(s), then such Recipient’s rights granted under Section 2(b) shall terminate as of the date such litigation is filed."

    Sentence one, which I emphasized above, was dropped for the EPL. The anti-patent clause was clearly not amenable to Oracle’s business plan, since this is essentially a patent land mine: if the software holder sues a contributor, then any patent licenses going the other way (from the contributor to the software owner) would be rendered null. Think of it as mutual assured destruction.

    That this was Oracle’s beef is not speculation–Tulach confirmed it when he replied to Beck’s initial response: "I am glad we have an option to pay for a better license, especially one without the patent clause."

    As the JUnit figures out what to do next, it was enlightening to see this change, because it gives a glimpse of what’s going on at Oracle. There are teams of lawyers going through all of the open source projects and making sure Oracle is as protected as possible. In some cases, such as this one I think, the outcome will be mutually agreed upon. But for others, like Hudson/Jenkins and OpenOffice.org/LibreOffice, Oracle’s intransigence seems to be contributing to project forking.

    Which, while a PR bump in the road, still gives Oracle what it wants: all its legal ducks in a row.

    source: http://www.itworld.com/open-source/134577/oracle-continues-protectionist-stance-open-source

    Did you like this? Share it: