You can filter nosetests using regular expressions on test names.
Provided all stage tests are named consistently, you can do the following:
#nosetests -v -m '.*_stage.*';
You can filter nosetests using regular expressions on test names.
Provided all stage tests are named consistently, you can do the following:
#nosetests -v -m '.*_stage.*';
Eclipse’s organize-import loves to strip out your org.junit.Assert.*
But you can tell it to auto-complete them via:
– Editor > Content Assist > Favorites
– add org.junit.Assert.*;
You can even add hamcrest, math and other commonly used test libs there!
Valgrind is an apt-and-play (or rpm-and-play) tool for finding memory leaks in your sw.
I recommend using it for code-reviewing and before deploying!
Just run it agains # ls -d /tmp
# valgrind --leak-check=full --track-origins=yes ls -d /tmp
The output is [extract]
==27666== Memcheck, a memory error detector
==27666== Command: ls -d /tmp
/tmp
==27666== HEAP SUMMARY:
==27666== in use at exit: 12,653 bytes in 8 blocks
==27666== total heap usage: 1,396 allocs, 1,388 frees, 77,395 bytes allocated
==27666==
==27666== 120 bytes in 1 blocks are definitely lost in loss record 7 of 8
==27666== at 0x4024C1C: malloc (vg_replace_malloc.c:195)
==27666== by 0x40CFACD: getdelim (in /lib/tls/i686/cmov/libc-2.10.1.so)
==27666== by 0x405B73A: ??? (in /lib/libselinux.so.1)
==27666== by 0x4064BFC: ??? (in /lib/libselinux.so.1)
==27666== by 0x40530C7: ??? (in /lib/libselinux.so.1)
==27666== by 0x400D8BB: ??? (in /lib/ld-2.10.1.so)
==27666== by 0x400DA20: ??? (in /lib/ld-2.10.1.so)
==27666== by 0x400088E: ??? (in /lib/ld-2.10.1.so)
==27666==
==27666== LEAK SUMMARY:
==27666== definitely lost: 120 bytes in 1 blocks
==27666== indirectly lost: 0 bytes in 0 blocks
==27666== possibly lost: 0 bytes in 0 blocks
==27666== still reachable: 12,533 bytes in 7 blocks
==27666== suppressed: 0 bytes in 0 blocks
==27666== Reachable blocks (those to which a pointer was found) are not shown.
==27666== To see them, rerun with: --leak-check=full --show-reachable=yes
==27666==
==27666== For counts of detected and suppressed errors, rerun with: -v
==27666== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 25 from 8)
Funnily we found ONE leak ;)
==27666== LEAK SUMMARY:
==27666== definitely lost: 120 bytes in 1 blocks
==27666== indirectly lost: 0 bytes in 0 blocks
ad it’s in
==27666== 120 bytes in 1 blocks are definitely lost in loss record 7 of 8
==27666== at 0x4024C1C: malloc (vg_replace_malloc.c:195)
==27666== by 0x40CFACD: getdelim (in /lib/tls/i686/cmov/libc-2.10.1.so)
==27666== by 0x405B73A: ??? (in /lib/libselinux.so.1)
...
==27666== by 0x400088E: ??? (in /lib/ld-2.10.1.so)
but this time we shouldn’t care too much: ls is a one-shot command!
Comments welcome!
Maven is a nice build tool helper for java projects. A cool feature is the way to specify if some dependencies are
That’s an example in my pom.xml:
<!– I need to embed javamail in my package –>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
<!– while Log4j is provided by the application server –>
<dependency>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
<version>1.2.14</version>
<scope>provided</scope>
</dependency>
<!– and Hypersonic Database is used for testing–>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.1</version>
<scope>test</scope>
</dependency>
“insanity is to keep repeating the same thing and expecting different results”
This Einstein quote comes to my mind each time I’ve to face functional testing (aka repetitive clicking on each webapp link). SeleniumHQ is a framework that automatize this job. It’s based on 2 components:
Example: let’s create a test to verify our login application
Selenium will run a firefox instance for you, and you’ll see the browser repeating the action you recorded!
Obviously you can use selenium to stress your webapp too!!! A quickstart is here..