Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] unit tests? how or where are those with eclipse plugins dev.?

Hi Johan,

Unit tests are usually created in the separate plugin/fragment projects - the tests are usually splitted into multiple projects to control dependencies.

In DLTK the tests projects are committed to the tests/ subfolder under the language component, e.g. org.eclipse.dltk/javascript/tests. There is a single org.eclipse.dltk.javascript.core.tests project with javascript tests at the moment.

In the tests project there is AllTests class to create suites for all of the tests.

You can add your tests to the existing project or create a new one if needed. If you are creating a new project - please post the details so we will add it to the build system, etc.

To launch the tests you should right click the AllTests class
and Run as -> JUnit plugin test.

Btw, the current javascript completion tests started failing on the last week - would you please look into?

Regards,
Alex

Johan Compagner wrote:
Hi,

last week i had to implement a algorithm that was a perfect candidate to first make a unit test
and based on that make the real code

Now i was wondering if i could also check that unit test in somewhere?
i created quickly a src-test dir in the plugins project but how is this done in eclipse ?
is there some kind of standard?

the unit test i had:

    public void testIdResolving() throws Exception {

assertEquals("forms.xxx.yyy", HostCollection.parseId("forms.xxx.yyy")); assertEquals("forms.xxx.yyy", HostCollection.parseId("forms.xxx.yyy()"));
        assertEquals("forms.xxx.yyy", HostCollection
                .parseId("forms.xxx().yyy()"));
        assertEquals("forms.xxx.[].yyy.[]", HostCollection
                .parseId("forms.xxx[].yyy[]"));
assertEquals("forms.[].yyy", HostCollection.parseId("forms[xxx].yyy")); assertEquals("forms.[].yyy", HostCollection.parseId("forms[xxx()].yyy"));
        assertEquals("forms.[].yyy", HostCollection
                .parseId("forms[xxx(1)].yyy"));
        assertEquals("xxx", HostCollection.parseId("forms[xxx"));
        assertEquals("", HostCollection.parseId("forms[xxx("));
        assertEquals("a", HostCollection.parseId("forms[xxx(a"));
        assertEquals("xxx", HostCollection.parseId("forms[xxx(1)"));
        assertEquals("xxx.yyy", HostCollection.parseId("forms[xxx(1).yyy"));
assertEquals("forms.[]", HostCollection.parseId("forms[xxx(1).yyy]"));

assertEquals("forms.[]", HostCollection.parseId("forms[xxx(1).yyy]]")); assertEquals("forms.[]", HostCollection.parseId("forms[xxx(1)).yyy]")); assertEquals("forms.[]", HostCollection.parseId(")forms[xxx(1)).yyy]"));

    }


------------------------------------------------------------------------

_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


Back to the top