You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cassandra.apache.org by Jan Kotek <di...@kotek.net> on 2016/06/09 16:26:00 UTC

Unit tests in IDE

Hi,

I would like to run and debug unit tests directly in Intellij Idea.
Current Ant runner does not work for me.

I studied the problem a bit. Tests use java-agent that complicates it a
bit. Also I would like to make minimal changes. So far my approach is:

- Run special test case under regular Ant

- It saves JVM parameters generated by Ant (properties, JVM args, java
agents, classpath) into text file

- Invoke Ant target to convert this text file into Run Configuration
for IDE

- Click Run in Idea... :-)

I would be happy to polish it a bit more. Would you merge such patch?

Regards,
Jan Kotek

Re: Unit tests in IDE

Posted by Jan Kotek <di...@kotek.net>.
It does, I missed that, thanks

On Thu, 2016-06-09 at 11:53 -0500, Josh McKenzie wrote:
> Does ant generate-idea-files
> <https://wiki.apache.org/cassandra/RunningCassandraInIDEA> cover
> this?
> 
> On Thu, Jun 9, 2016 at 11:26 AM, Jan Kotek <di...@kotek.net> wrote:
> 
> > 
> > Hi,
> > 
> > I would like to run and debug unit tests directly in Intellij Idea.
> > Current Ant runner does not work for me.
> > 
> > I studied the problem a bit. Tests use java-agent that complicates
> > it a
> > bit. Also I would like to make minimal changes. So far my approach
> > is:
> > 
> > - Run special test case under regular Ant
> > 
> > - It saves JVM parameters generated by Ant (properties, JVM args,
> > java
> > agents, classpath) into text file
> > 
> > - Invoke Ant target to convert this text file into Run
> > Configuration
> > for IDE
> > 
> > - Click Run in Idea... :-)
> > 
> > I would be happy to polish it a bit more. Would you merge such
> > patch?
> > 
> > Regards,
> > Jan Kotek
> > 

Re: Unit tests in IDE

Posted by Jan Kotek <di...@kotek.net>.
Hi,
I tried, but there is no way to create test configuration on 3.0 an 3.7
branches.�
Project generated by�generate-idea-files or�generate-eclipse-files only
contains launcher for Cassandra deamon, not unit test.�
And way you described does not deal with JVM settings some unit tests
needs.
Only way to run unit tests from IDE is via Ant, that does not allow
debuging.�
I could create launcher manually and replicate all JVM settings from
Ant runner, but that seems a bit too complex:
https://github.com/apache/cassandra/blob/trunk/build.xml#L1201
Jan
��
On Fri, 2016-06-10 at 09:55 +0800, Mahdi Mohammadi wrote:
> You can create JUnit run configurations in IDEA and run/debug a
> single unit test. You will need to specify class name of the test.
> 
> 
> Best Regards
> 
> On Fri, Jun 10, 2016 at 12:53 AM, Josh McKenzie <jmckenzie@apache.org
> > wrote:
> > Does ant generate-idea-files
> > <https://wiki.apache.org/cassandra/RunningCassandraInIDEA> cover
> > this?
> > 
> > On Thu, Jun 9, 2016 at 11:26 AM, Jan Kotek <di...@kotek.net>
> > wrote:
> > 
> > > Hi,
> > >
> > > I would like to run and debug unit tests directly in Intellij
> > Idea.
> > > Current Ant runner does not work for me.
> > >
> > > I studied the problem a bit. Tests use java-agent that
> > complicates it a
> > > bit. Also I would like to make minimal changes. So far my
> > approach is:
> > >
> > > - Run special test case under regular Ant
> > >
> > > - It saves JVM parameters generated by Ant (properties, JVM args,
> > java
> > > agents, classpath) into text file
> > >
> > > - Invoke Ant target to convert this text file into Run
> > Configuration
> > > for IDE
> > >
> > > - Click Run in Idea... :-)
> > >
> > > I would be happy to polish it a bit more. Would you merge such
> > patch?
> > >
> > > Regards,
> > > Jan Kotek
> > >
> > 

Re: Unit tests in IDE

Posted by Mahdi Mohammadi <ma...@gmail.com>.
You can create JUnit run configurations in IDEA and run/debug a single unit
test. You will need to specify class name of the test.

[image: Inline image 1]

Best Regards

On Fri, Jun 10, 2016 at 12:53 AM, Josh McKenzie <jm...@apache.org>
wrote:

> Does ant generate-idea-files
> <https://wiki.apache.org/cassandra/RunningCassandraInIDEA> cover this?
>
> On Thu, Jun 9, 2016 at 11:26 AM, Jan Kotek <di...@kotek.net> wrote:
>
> > Hi,
> >
> > I would like to run and debug unit tests directly in Intellij Idea.
> > Current Ant runner does not work for me.
> >
> > I studied the problem a bit. Tests use java-agent that complicates it a
> > bit. Also I would like to make minimal changes. So far my approach is:
> >
> > - Run special test case under regular Ant
> >
> > - It saves JVM parameters generated by Ant (properties, JVM args, java
> > agents, classpath) into text file
> >
> > - Invoke Ant target to convert this text file into Run Configuration
> > for IDE
> >
> > - Click Run in Idea... :-)
> >
> > I would be happy to polish it a bit more. Would you merge such patch?
> >
> > Regards,
> > Jan Kotek
> >
>

Re: Unit tests in IDE

Posted by Josh McKenzie <jm...@apache.org>.
Does ant generate-idea-files
<https://wiki.apache.org/cassandra/RunningCassandraInIDEA> cover this?

On Thu, Jun 9, 2016 at 11:26 AM, Jan Kotek <di...@kotek.net> wrote:

> Hi,
>
> I would like to run and debug unit tests directly in Intellij Idea.
> Current Ant runner does not work for me.
>
> I studied the problem a bit. Tests use java-agent that complicates it a
> bit. Also I would like to make minimal changes. So far my approach is:
>
> - Run special test case under regular Ant
>
> - It saves JVM parameters generated by Ant (properties, JVM args, java
> agents, classpath) into text file
>
> - Invoke Ant target to convert this text file into Run Configuration
> for IDE
>
> - Click Run in Idea... :-)
>
> I would be happy to polish it a bit more. Would you merge such patch?
>
> Regards,
> Jan Kotek
>