This week's giveaway is in the Testing forum.
We're giving away four copies of TDD for a Shopping Website LiveProject and have Steven Solomon on-line!
See this thread for details.
Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Chris Harris

Ranch Hand
+ Follow
since Sep 21, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chris Harris

Hi,

I am currently thinking about working towards becoming a "Certified JBoss Developer" and could do with some advice.

As you may know the in order to get certified need:

Prerequisites
To prepare for the JBoss for Advanced J2EE Developers course, and to ensure that you have all the necessary skills to be successful, it is highly recommended that you satisfy 1 of 2 options: (1) Attend a JBoss for Java Developers training course prior to registering for the Advanced course; (2) Pass the Middleware Placement Exam

Course Requirements

JBoss for Advanced J2EE Developers

Exam

The certification exam is available to students of the JBoss for Advanced J2EE Developers course within 12 months from completion of the training. The exam is available from our online provider for a fee of 100USD/100EUR per attempt. There are 75 multiple choice questions that must be completed within 24 hours of starting the exam.

Are any of you a certified JBoss developer? If so is it worth it?

What type of questions is in the "Middleware Placement Exam"? Are they similar to the question in SCBCD?

Thanks,

Chris

Posted by Ilja Preuss:

The problem is speed - those tests tend to be quite slow. Especially if you do test driven development, where you want to run the tests every couple of minutes, it makes a big difference wether the suite takes a couple of seconds or a couple of minutes.



I agree with this and would also like to add the advantage that if you mock the database then you no longer have to spend the time setting up the database before each test.

My tests are also run within the ant build script. This is done so that all tests are run before it is given to a customer. The distribution team would not be too happy if they had to setup a database just to build the application.


Posted by Ilja Preuss:

There is no roadmap, and I don't think you will see much changes on core JUnit at all in the future. It's meant to be small and lightweight, it is doing what it should do, it's robust - what changes does it need?



As you see from my previous posts I would like to update the existing JUnit framework. This update would separate System Testing from Unit testing and it would also be nice if it had some mocking features.

Chris.
17 years ago
Do you happen to have a link to the Junit roadMap? I would be interested to see if they are also planning to go down the AOP route.

Thanks,

Chris.
17 years ago
Satya,

Well done.

Time for some

Hope to see you around the ranch.

Chris.
17 years ago
Using the SimpleDateFormat class you can parse you two Strings to make a Date object. With this Date object try calling getTime(). Here is an Example.




Hope that helps.

Chris.
17 years ago
Dhanesh,

From reading you description my understanding it that you need to parse a String into a Date.

A simple way of doing this is to use java.text.SimpleDateFormat. Once you have a Date you can then format in into any new String format you want. Or you could just get a long that represents the data and time.

Let me know if I have misunderstood you problem.

Chris.
17 years ago
Thanks your the leting me know. I see they are thinking of using AspectWerkz which is a AOP I have no tried. Think I am going to give it a go.

Thanks again,

Chris.
17 years ago
Hi all,

I don't know if this is the best place to ask but here goes.

With the drive for AOP growing is there any plans for a AOP standard? There are a number of diffrent AOP frameworks avaliable each with diffrent syntax. I have does a quick search over the JSR but not found anything.

Thanks

Chris.
17 years ago

I believe the common way of doing this is to put the setup stuff into an abstract super class TestCase which all the concrete TestCases inherit. The AOP approach could be a bit cleaner, though.



Yeah, I have used the setup to do this in the past but found that it can be messy if multiple test within the same TestCase need to use different setups. For example if you want to set up the mock object with different values for two test the can no longer use the setup to populate the mock object.

Chris.
17 years ago

Ok, then what would your aspect do when encountering a unit test? Replace real database connections with mocked up database connections? Otherwise a good idea, but the behavior of the mocked up database connection object is not something you can specify with a global aspect -- it's something that varies per test.



My thinking was that the Unit Test aspect would only fail tests if an attempt was made to access an external resource. I agree that it is not possible to create a global aspect that could do all mock creation for you.

Recently I have changed my total approach to mocking. In order to explain the approach I think it may be easier to understand the reasons:

When I first started to mock object, like most people I developed my own mock classes. I soon found that in order to create a mock class that could be used in all my tests would take time to develop fully.

In order to reduce the develop time I started to look around for mock frameworks and discovered MockCreator. I find this a great tool and am sure it has saved my hours as I get MockCreator to generate all my mock classes. However I have recently discovered that some of the team members are no longer creating unit tests as they find that MockCreator takes a time while to set up all expectations. In my option this set up time is justified as it forces that all expectation are defined or the test fails. However as people are no longer creating unit test I had to think a better approach.

In order to help the team mock objects I have wrapped the generate classes from MockCreator into my own mock classes. For example:



Then in tests I use ConfigReaderMock to mock all reading from the configuration file. Example



Hope you are able to understand all that. That is my current testing strategy. However I feel that this could be improved separating the mock population out of the test:



The idea would be to use an AOP framework to intercept the call to testMyTest. Before the method is call I would call mockMyTest within NewMyTestMock.

Thanks,

Chris.
17 years ago
Oh how embarrassing I missed ADJT on the bottom of the page. :roll:

Thanks

Chris
Hi all,

Can some help as I am unable to find an eclipse IDE plugging for AspectJ. I do feel stupid asking as AspectJ was developed by the eclipse so there must be a way of using it within the IDE.

Thanks

Chris

I am not sure that this would do much good. If the developers are dull, they will simply test less or find a workaround for the limitation. If they are not, they will feel patronized.



Possibly, however after thinking in more about it I think AOP could work well here. My thinking is that System Testing and Unit Test are just different aspects of Testing.

There are a number of rules that distinguish the different between a System Tests and a Unit Test. I don't see any reason why a framework could not enforce the rules.

As you say a developer would find workarounds that would allow them to break the rules. However this is always going to be the cause with some people as there are people who want to do as little as possible.

Firstly I agreed that some developer may find it patronizing however thinking a little more about I disagree. The aim of the behind enforcing the rules within the framework would ultimately make there job easier.

Chris.
17 years ago
When I first start this topic I was wondering about system testing frameworks that exists. After reading your comments I still believe that using JUnit to do system testing and unit test can be confusing for some people.


(Declaimer I thought of this idea while writing this message ). In order to reduce the confusion that there is about when people are writing Junit test to do system tests and writing Junit test to do unit test it may be worth thinking of extending the Junit framework. This extension would involve creating two separate TestCase Types. One for system test and another for unit test. Then using AOP; fail test if the test are using the UnitTestCase and attempt to use an external resource.

Hmm is this even possible?

Any thoughts on this?

Thanks

Chris.
17 years ago
Lasse,

Yeah, I've heard about such a trend... If 70% writes system tests, approximately 20% writes poor unit tests, and 10% writes good unit tests.



What do you class as a poor unit test?

There a tests that may not cover all the functionality but I would not count this as poor unit tests, only that there are tests missing.

Chris.
17 years ago