TestNG test ok when run separately in Eclipse but fails when running 'mvn clean test'

31 views
Skip to first unread message

mike

unread,
Jul 7, 2016, 3:27:19 AM7/7/16
to testng-users
Hi,

I am running a testng test from within Eclipse and it works just fine.

It loads a couple of xml files under src/test/resources/se/mycompany/cdg

Loading takes place in:


@BeforeTest
    public void setup() throws Exception {
        //load data
        loadFiles();
       

    }
private void loadFiles() {
        String[] fragments = new String[] {
                "/se/mycompany/cdg/RouteA.xml",
                "/se/mycompany/cdg/RouteB.xml",
                "/se/mycompany/cdg/RouteC.xml",
                "/se/mycompany/cdg/RouteD.xml" };
        for (String fragment : fragments) {
            model.parse(readFileAsInputStream(file));
        }
    }

private InputStream readFileAsInputStream(String fileName) {
        return this.getResourceAsStream(fileName);
 }



When I execute the test using maven I can see:

Running TestSuite
Configuring TestNG with: TestNG652Configurator
java.io.BufferedInputStream@3cc72e8f
java.io.BufferedInputStream@3597c56f
java.io.BufferedInputStream@5872ae98
java.io.BufferedInputStream@7765da10

#The buffer and data i loaded in the above parts



Then later in the log I see this again:

Configuring TestNG with: TestNG652Configurator

After the second TestNG652Configurator
the test is executed here.

Any ideas?

br,

//mike





⇜Krishnan Mahadevan⇝

unread,
Jul 7, 2016, 6:26:06 AM7/7/16
to testng...@googlegroups.com
Mike,

I am a bit confused on your query. Are you saying that things dont work fine when you run your test via the maven surefire plugin ?
Or are you concerned about the additional things that are getting printed on the console ?

If its the formal (i.e., things dont work), then please help share what is your expectation ?

If its the latter (i.e., the extra output), then you can safely ignore them. Those outputs are all related to the Maven surefire plugin running your tests.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

mike

unread,
Jul 7, 2016, 7:00:14 AM7/7/16
to testng-users
Hi Krishnan,

Are you saying that things dont work fine when you run your test via the maven surefire plugin ?
  Yes!

 

Or are you concerned about the additional things that are getting printed on the console ?

Not really but wanted to know if they could be related to why it fails in the maven surefireplugin.


If its the formal (i.e., things dont work), then please help share what is your expectation ?

I expect the testcase, executed separately, in Eclipse and successful to be that when running all testcases using 'mvn clean test'.

br,

//mike

⇜Krishnan Mahadevan⇝

unread,
Jul 7, 2016, 7:14:07 AM7/7/16
to testng...@googlegroups.com
Mike,

Would it be possible for you to please help do the following ?

1. Share a reproducible simple test which we can execute to recreate the experience you are seeing ?
2. What is the expected output that you are looking for.



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

--

mike

unread,
Jul 8, 2016, 6:30:03 AM7/8/16
to testng-users


Den torsdag 7 juli 2016 kl. 13:14:07 UTC+2 skrev Krishnan:
Mike,

Would it be possible for you to please help do the following ?

1. Share a reproducible simple test which we can execute to recreate the experience you are seeing ?
 
I manged to setup debug of test case running maven from within Eclipse. I had a problem in a toString() method implmenetation containing a list of children. I had a cycling dependency that gave this problem. It is now removed.

Thanks for the attention Krishnan! I really appreciate it.

//mikael
Reply all
Reply to author
Forward
0 new messages