Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CodeProExperiences:
- When I first installed CodePro in my Eclipse Helios (JEE) it crashed every time I did a right click. Eclipse is fragile when you have many components installed, for example the JBoss Tools and Seam, which aren't really 100% stable. My colleague was especially interested in Remote Interface tests but abandonded this plan altogether.
- Ok, so my first impression was that it was yet another buggy Eclipse plugin and that it sucked but I decided to give it another try, this time with a pure and clean Eclipse installation.
- Well, it worked. The Unit Test generation is nothing impressive, it basically just creates skeletons and you have a fancy GUI to add methods, provide arguments and specify assertions. Sadly, you cannot specify assertions for every test. As I stated already, the tests can be used as skeletons but they aren't really impressive and not to my liking. However, they generate a really high code coverage (90% in my testcases).
- But in my opinion, there's so much manual work involved that it makes little difference if you generate the tests or if you write them completely by yourself. Sometimes the generated tests are ridiculous, I guess I had too high expectations when I heard that the great Google had created a tool for such a thing.
- So, the test generation couldn't statisfy my high expectations. They can be a help here and there to achieve a really high coverage but personally I wouldn't use it, because when you're finished with the test there's next to nothing left from the skeleton that Code Pro generated.
- That doesn't mean CodePro is completely useless, it does have some nice features. The metrics are nice for a quick overview and can be fed your own rules. I like such things. And the code coverage visualization is nice to have, too. I'll keep it as a plugin.
- At last, I should point out that this is only my subjective opinion. Maybe other people like the test generation or have a better use for it.
- Below you'll find some examples of the generated tests:
- @Test
- public void testSwap_1()
- throws Exception {
- int[] array = new int[] {0};
- int idx1 = 1;
- int idx2 = 1;
- Sort.swap(array, idx1, idx2);
- // add additional test code here
- // An unexpected exception was thrown in user code while executing this test:
- // java.lang.ArrayIndexOutOfBoundsException: 1
- // at Sort.swap(Sort.java:26)
- }
- //WHY DID IT GENERATE THE SAME TEST TWICE? It generated 16 tests for quicksort in total.
- @Test
- public void testQsort_15()
- throws Exception {
- int[] array = new int[] {};
- int le = 1;
- int ri = 1;
- Sort.qsort(array, le, ri);
- // add additional test code here
- }
- /**
- * Run the void qsort(int[],int,int) method test.
- *
- * @throws Exception
- *
- * @generatedBy CodePro at 24.09.11 17:33
- */
- @Test
- public void testQsort_16()
- throws Exception {
- int[] array = new int[] {};
- int le = 1;
- int ri = 1;
- Sort.qsort(array, le, ri);
- // add additional test code here
- }
- //useless
- @Test
- public void testValueAsString_2()
- throws Exception {
- TestsWithStrings fixture = new TestsWithStrings();
- Object object = new Object();
- String result = fixture.valueAsString(object);
- // add additional test code here
- assertEquals("java.lang.Object@52a56fa5", result);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement