Home » Modeling » TMF (Xtext) » validation invocation from the generator.Main
| | | | |
Re: validation invocation from the generator.Main [message #772672 is a reply to message #772668] |
Fri, 30 December 2011 10:34 |
|
Hi,
no this works good as well.
public class DummyTest extends AbstractXtextTests {
private Main generator;
@Override
protected void setUp() throws Exception {
super.setUp();
with(MyDslStandaloneSetup.class);
generator = get(Main.class);
}
@Test
public void testIt() {
generator.runGenerator("test.mydsl");
}
}
but be careful, sometimes you destroy emf registries (e.g. the one for the validator)
accitentially in your tests. there where some bugs arround this too.
can you share a complete test case?
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
| | | | | |
Re: validation invocation from the generator.Main [message #772754 is a reply to message #772744] |
Fri, 30 December 2011 13:50 |
|
On 12/30/2011 02:34 PM, Lorenzo Bettini wrote:
> On 12/30/2011 12:41 PM, Christian Dietrich wrote:
>> P.s: with abstract xtext tests e.g. only one test method will work.
>> two will not.
>
> Christian, I feel so stupid: I was running the test with a valid input
> file, instead of the input file with errors... :)
>
> so the problem is not there anymore... though I don't understand your
> current answer...
probably it's related to this: on another junit test, instead of using
AbstractXtextTests I'm using this class
@SuppressWarnings("all")
@InjectWith(XtypesInjectorProvider.class)
@RunWith(XtextRunner.class)
public class GeneratedJavaCodeTest ...
and I noted that by running a single test method my Java validator is
used, while running all test methods my Java validator is not used... I
don't have any setup method here...
is it related to what you said?
thanks in advance
Lorenzo
--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
| | | |
Goto Forum:
Current Time: Fri Apr 26 18:10:42 GMT 2024
Powered by FUDForum. Page generated in 0.04384 seconds
|