Posts Tagged ‘Testing’

Code Coverage for JavaScript Unit Testing

Tuesday, April 17th, 2012

This is a cross-post from WebStorm & PhpStorm blog, originally posted by Sergey Simonchik.

Measuring JavaScript code coverage naturally complements unit testing. It provides a clear picture of which parts of your code remain untested, and helps you focus additional tests on the uncovered code.

From now on, users of JsTestDriver can measure code coverage visually, right in the editor with JsTestDriver plugin for IntelliJ IDEA. Make sure you have installed 11.1.2 EAP with the latest version of the plugin. (more…)

New Coverage View in IntelliJ IDEA 11.1

Friday, March 30th, 2012

IntelliJ IDEA 11.1 introduces a new way of browsing the gathered coverage information through a dedicated Coverage View.

This view aggregates the coverage details over a configured scope in one place. It provides ability to sort data by coverage percentage, what can be used for detection of code which is not enough covered by tests.

As always quick navigation, scroll from/to source, flatten packages mode are available in Coverage View for an easy work with the results. It also allows generating HTML report right from the view.

Please note, that the view is also available for Python, Ruby and PHP coverage plugins.

The new feature is already available in IntelliJ IDEA 11.1 released a few days ago. We appreciate any feedback. Please don’t hesitate to submit any found issues to our tracker.

Testing Tip: Run Test Method from Abstract Test Class

Monday, February 13th, 2012

Sometimes you have an abstract test class with test methods where the inheritors set up different environment. As it is impossible to run an abstract class you had to enumerate inheritors manually, choose corresponding methods and run these methods one by one.

Now (since IntelliJ IDEA 11.1) it is possible to run tests right from the abstract base class and simply choose inheritors from the popup.

This works for JUnit and for TestNG tests.

Spring 3.1: Testing with @Configuration classes and profiles

Friday, December 16th, 2011

Latest Spring 3.1 features can be easily found in IntelliJ IDEA 11 release.

If you’ve already started testing your applications with @Configuration classes and environment profiles, tell us how it works for you in IntelliJ IDEA.

New in 10.5: Create and open tests for Groovy classes faster

Tuesday, April 26th, 2011

We’ve added a couple of new productivity features in IntelliJ IDEA 10.5 to make working with Groovy tests two bits more pleasant:

1. Now you can create tests for Groovy classes the same way you do in Java. You just need to invoke Create Test intention on the header of the class.

2. To navigate to an existing test from a class you can invoke Go to Test action (Ctrl+Shift+T by default).

Make sure to try it in the latest IntelliJ IDEA 10.5 EAP build.

Android unit-testing support

Wednesday, September 15th, 2010

With IntelliJ IDEA X you can write unit tests for your Android application using Android Testing Framework. Android unit tests are located in a separate test module, so first you need to add it (i.e. named tests) to your project, which must already contain an Android module (or module with Android facet) (i.e. named MyAndroidApp). Then, specify this tested module:

IntelliJ IDEA will automatically create a sample test class for your main activity (i.e. MyActivityTest). It’s handy that you can launch tests directly from editor. Note that it is important to choose an item with Android-specific icon for launching tests by Android Tests run configuration rather than using a default JUnit configuration:

Also, after adding a test module to project, IntelliJ IDEA automatically creates run configuration for launching all tests in module:

Note, that scope of a dependency between Test module and Application module should be Provided.

Generate dependencies for Spring TestContext Framework

Friday, August 6th, 2010

IntelliJ IDEA 10 gives you an easy way of generating bean dependencies for Spring Test Contexts.
Simply hit Alt+Insert in your Spring Test to invoke the “Generate…” popup, select the “Bean dependency…” action to run and choose the beans you like.

IntelliJ IDEA actually runs a live template inside to complete the code generation. It creates @Autowired field and adds @Qualifier if more than one bean of the desired type is configured in test contexts.

In addition, you can try “Add @Qualifier” quick fix for an incorrect @Autowired class members

It runs a live template and generates the @Qualifier annotation.

Try it in IntelliJ IDEA X EAP and let us know what you think.

Spring testing support in IntelliJ IDEA 10

Wednesday, August 4th, 2010

Please try IntelliJ IDEA X (EAP) with new Spring testing related support. There is a number of things to note:

1. @ContextConfiguration support with completion, navigation, usages search and error highlighting

2. @TransactionConfiguration

3. All Spring related inspections, quick fixes and annotators are supported for corresponding TestContext Framework configurations.

Tried IntelliJ IDEA 10 EAP already? Let us know what you think!

Develop with pleasure!
The JetBrains Team

No More Missing TestNG Tests

Wednesday, March 25th, 2009

I often forget to add newly created tests to the testng.xml, which is used in our TeamCity build, and by the time I realize that they don’t run something is surely went wrong. What a bummer! Not any more, fortunately — IntelliJ IDEA makes sure no tests are missing. All it takes is to enable the Undeclared test inspection under TestNG in the Errors section of the Settings dialog.
Undeclared Test Warning