EzDevInfo.com

infinitest

A Continuous Test Runner for Java Infinitest infinitest. a continuous test runner for java

eclipse + m2e + junit + infinitest + eclemma?

I have Eclipse for Java Developer 4.3 with m2e, eclemma, infinitest. My project uses Eclipse m2e with junit 4.11.

My intention is to have coverage info updated every time infinitest re-runs the tests affected by last save. Is it possible?

At the moment I'm able to manually run a test with Coverage and see code highlighted, but when I change code infinitest kicks in and coverage highlight disappears.


Source: (StackOverflow)

Infinitest with Android Studio [0.9.3]

I want to use infinitest on android studio.
I installed it whith the plugins browser.
I do not find how to use it.

My project is like this :

enter image description here


Source: (StackOverflow)

Advertisements

How do I use continuous integration with an Eclipse project?

I've been using maven2 and hudson for a while to do my continuous integration, but I find that Eclipse and Maven do not play well together. Sure there's a plugin, but it's cranky to mash the maven project into something that eclipse likes and the build times and unit test are too long. I'm considering switching back to a pure eclipse project with no ant and no maven involved. With the infinitest plugin and possible the JavaRebel agent, it would give me a very fast build-deploy-test cycle. However I'd still like to have automatic and testing as well, so:

How do I use continuous integration with an Eclipse project?

Is there a command line way to do it?

Is there a build server that already supports it natively?


Source: (StackOverflow)

Eclipse: infinitest vs. JUnit: character encoding

I'm using infinitest in Eclipse and I have a strange phenomenon in connection with JUnit.

I have code that uses org.apache.http.HttpResponse.getEntity() and org.apache.http.entity.StringEntity. The JUnit test looks like this:

@Test
public void convertEncodedContentToString() throws UnsupportedEncodingException {
  HttpResponse httpResponseMock = Mockito.mock(HttpResponse.class);

  Mockito.when(httpResponseMock.getEntity()).thenReturn(new StringEntity("huiäöüß@€", HTTP.UTF_8));
  Assert.assertEquals("huiäöüß@€", parser.convertContentToString(httpResponseMock));
}

All source files are stored in UTF-8.

If I let JUnit execute this method, it works fine.

However, if infinitest runs this test it complains that the assertion fails.

ComparisonFailure (expected:<hui[äöüß@€]> but was:<hui[äöüß@€]>) in ResponseBodyParserFactoryTest.convertEncodedContentToString

Obviously there is a character encoding problem.

As infinitest has close to no options I have no idea how to help infinitest to run this test properly. Can anyone please help me out here?


Source: (StackOverflow)

Simple way to test requiring OSGI without lots of artefacts and dependencies

OSGI Testing frameworks - some observations.

I am in the middle of writing a system that makes use of OSGI. However all of the popular testing frameworks (Spring-OSGI, PaxExam) require a lot of artefacts for even the simplest test.

Wishlist / Goals

Ideally i would like a single Test that uses TinyBundle to assemble bundles and gives them to the framework. The framework will then do the heavy lifting of starting the container, deploying, running each test, updating the ui to show results etc.

On the surface it would appear that PAX-EXAM would satisfy this but it has additional requirements, which I have not been able to solve, within Eclipse. My problems are:

  • Each bundle requires a separate project.
  • Each project gets a manifest.mf in the $project/meta-inf/.

Ideally i would like to bundle all my manifests and "internal" classes in separate sub packages of the test rather than having them scattered about in their respective projects.

I have found packaging everything into the one project just does not work when the tests execute even if the bundles provisioned are identical in content. However if i split everything into separate projects stuff just works.

Maven

I wish to avoid maven as this implies that a more complex system that would end up requiring building, deploying into the repo which in the end even when automated just slows things down even more. This would conflict with my use of Infinitest which automagically detects changed classes and just executes the right tests.

Eclipse Project Plugin launch configurations.

This approach requires one to pick the bundles to deploy prior to executing the junit test. This of course only works if one has separate projects with a one to one mapping per bundle. Again this goes against my attempts to consolidate all test dependeny bundles under one project.

How, Can it be done ???

  • How can i achieve this ?
  • Is this practically possible ?
  • Whats the simplest alternative ?

Source: (StackOverflow)

Eclipse: mocking up the platform for testing

I am developing an Eclipse plugin and have tests for it. Some are regular JUnit tests, some are PDE tests (i.e. require starting an eclipse instance to be able to access eclipse internals).

I wonder if it would be a good idea to try to turn some of the PDE test into regular tests, by creating mock objects for the platform. It would be a lot of work, but I think it would save time because the tests will run faster and we will also be able to use Infinitest for more tests.

I would appreciate any feedback, so that I can make up my mind about how to proceed.

Thanks in advance!

best regards, Vlad


Source: (StackOverflow)

is there an inside-Eclipse continuous-integration tool for javascript that looks like infinitest?

When I program in Java, I have recently discovered the free unit-testing tool Infinitest, and installed it as an Eclipse Plugin. The GUI is minimalistic and looks like this statusbar at bottom of picture:

screenshot infinitest

(The bar is green when all tests pass, and it is red if tests fail.)

Is there a similar tool that inserts a status bar into Eclipse like this, but works for unit tests written in Javascript?

I would also be interested in solutions that work for any other language but can be adapted for javascript. And the test runner does not necessarily have to be an eclipse plugin. I'm interested in having seamless workflow with instant feedback from the test runner (just as in Infinitest). Whenever I save a script file, the testrunner gets triggered.


Source: (StackOverflow)

Infinitest does not run @Before{Method,Class} methods when more than one TestNG group is used

I created a sample Eclipse project that demonstrates that Infinitest skips setup methods annotated with Before{Method,Class}, see https://github.com/jaeckel/InfinitestSampleProject. Because of this my tests fail when Infinitest executes them although they work when executed by Eclipse's TestNG plugin. The behaviour can be reproduced by this test case.

Is this a bug? If yes, how can it be fixed? I had a quick look at the infinitest source but that did not reveal anything yet on how to fix it. I created an issue for this and talked to the owner of the project. But so far, no one came back to me.


Source: (StackOverflow)

Infinitest fails but Maven works

I have Sprint Tool Suite 3.3 and the latest version of Infinitest installed. According to Infinitest, many of my classes have errors, but yet Maven builds just fine. Here is an example of some errors that the Problems tab in STS show:

  • InvalidDataAccessResourceUsageException (Table "ADDRESSTYPEREF" not found; SQL statement:...SeedAddressTypes.java /... line 34 Infinitest Test Failure
  • AssertionFailure (null id in com..model.base.Menu entry (don't flush the Session after an exception occurs)) in TestMenuBuilderIT.sortByTopMenu TestMenuBuilderIT.java

All the tests that show an error are integration that use Java Config for the EmbeddedDatabase:

public class TestMenuBuilderIT extends BaseItegration {
@Autowired
private MenuRepository menuRepository;
     @Test 
     public void sortByTopMenu() {
          List<Menu> testMenu = menuRepository.findAll();  <== offending line
...
}

And the configuration class:

@RunWith( SpringJUnit4ClassRunner.class )
@ContextConfiguration( loader = AnnotationConfigContextLoader.class, classes = { JpaConfig.class } )
public abstract class BaseItegration {
..
}

@Configuration
@EnableTransactionManagement
@ComponentScan( basePackages = { ...} )
@ImportResource( { "classpath:applicationContext.xml"} )
public class JpaConfig {

@Bean
public DataSource dataSource() {
return new EmbeddedDatabaseBuilder().setType( EmbeddedDatabaseType.H2 ).setName( "testdb" )
.addScript( "classpath:embeddedDatabase.sql" ).build();
}

I don't see why this would work fine in Maven, but Infinitest has these DB related errors. I could not find any documentation saying that JavaConfig wouldn't work with Infinitest. I am able to right click and run each test "As A Unit Test" successfully.

Does anyone know what might cause this?


Source: (StackOverflow)

Infinitest 5.1.93 not compatible with Springsource Tool Suite 2.8 (Eclipse Indigo)?

In a Spring Roo project the tests fail but only when initiated from Infinitest running in Springsource Tool Suite 2.8.0 (STS). As Infinitest 5.1.93 fails to load the Spring context file all tests fail. When I run the same tests myself inside STS they all go green.

I reconfirmed that nothing else was wrong in this project by importing the project to the previous STS 2.7.x instead. Infinitest run the tests green under STS 2.7.x as expected.

Is Infinitest 5.1.93 currently not compatible with Eclipse Indigo and Springsource Tool Suite?

I currently use jdk1.5.

P.S. I initially wrote "Eclipse Juno" so corrected the question to Indigo. See comments below. D.S.


Source: (StackOverflow)

Infinitest : No such method when using temporary folder

I have a problem with Infinitest:

I'm working with a junit temporary folder :

@Rule
public TemporaryFolder testFolder = new TemporaryFolder();

then I'm trying in the test method to create a temp sub-folder in this temp folder, and work with it :

@Test
public void shouldCheckFolders() throws InputDataException, IOException {
    File subFolder = testFolder.newFolder("subFolder");

    // ... anything for the test
}

When running the test using maven Clean install, no problem, I have a success. When using Eclipse : Run As -> Junit test, no problem : everything is green.

But Infinitest has an error :

NoSuchMethodError (org.junit.rules.TemporaryFolder.newFolder(Ljava/lang/String;)Ljava/io/File;) in LeTest.shouldCheckFolders    

Any idea ? is it possible to work with temporary folder and InfiniTest ?

I'm using Spring Tool Suite, based on Eclipse Mars 4.5.0 with Infinitest 5.1 and Junit 4.10.


Source: (StackOverflow)

Is there a JVM command-line option to change directory?

In short, I want to know, is there a JVM command-line option to change the starting working directory? If it's important, I'm running jdk1.6.0_24.

Background:

I am using a tool called Robolectric for Eclipse to test Android applications on the host PC without emulation. Robolectric requires a test project be created, but the tests themselves to be run from the Android project under test. This is accomplished by from Eclipse, setting the run configuration to the project under test in the setting: "Run all tests in the selected project, package or source folder."

I want to do this from the JVM command line options, if possible, because another tool I use, Infinitest, doesn't allow you to specify the working directory of the tests. It does, however, let you specify JVM command-line options.

Workaround:

Until I find a better workaround, a successful kluge has been to copy the AndroidManifest.xml and res folder from the Android project.


Source: (StackOverflow)

Firing function on assert failure

I am working on complicated code generation using CodeModel available in Java. I have managed to setup my unit tests in such a way so that a test generates small but functionally complete Java code which gets compiled in memory and generated class(es) is/are loaded from memory. Everything in general is reasonably quick if I don't output generated code.

Since the generator code is not aware of generated classes, I use reflection to fire methods on generated class which works well. These methods also can fail as I use reflection to make sure methods did expected work by checking state of the object.

My problem is I don't want to log the generated code every time test is run. But I want to see the generated code if test fails. There are lot of tests and since I use infintest, my eclipse becomes slower as infinitest keeps accumulating the output from various tests.

Can I set up junit so that it calls my function if test fails? e.g.

boolean compileSuccessful = compile();
Assert.assertTrue("Ooops, you generated bad code", compileSuccessful);

If above assertion fails, I want to ouput generated code and see what went wrong.


Source: (StackOverflow)

Infinitest with Java Tests in Intellij 14 unable to instantiate or pull in out of module dependencies

I want to start using Infinitest for continuous integration at the developer level, so far it's the only one that does a little of what I want, which is scream at me when I make changes to tests that fail without having to MANUALLY run the test.

The problem is, my file structure and project is huge and have crazy dependencies (whether this is a sign of poor design or not I have no control over, I must deal with it for now). If I run the tests conventionally via intellij it works fine and passes, but when infinitest runs it gets errors like "could not initialize

My question is is there anyting in infinitest.args or anything that I can get it to run correctly? Also are there better / similar alternatives? Infinitest has a great idea but the small details aren't hashed out. Any help would be nice, thanks!


Source: (StackOverflow)

Ignoring tests in Infinitest

I am automating system tests using Silk4J. Silk4J is based on JUnit. In addition I am testing my helper classes using pure JUnit tests.

Now I need to tell Infinitest which tests shall be considered for running immediately. I will choose the unit tests only, not the system tests, of course.

The Infinitest preferences have no options. How to tell Infinitest which tests to run (or which tests not to run)?

I have read Is it possible to specify which tests to choose from?, which seems to be a perfect match, but it didn't work for me. The given link returns HTTP 404. I don't have enough reputation to comment nor to start a bounty for updating the question.


Source: (StackOverflow)