How does JUnit integration work?

How does the TeamCity/JUnit integration work exactly? Is it based on JUnit test output or something else? I want to get TeamCity to recognize WebTest tests. My original thought was to use service messages in my WebTest files, but I'd be happier if I could get TeamCity to automatically recognize the tests. Any tips would be appreciated.

Thanks!

8 comments
Comment actions Permalink

TeamCity patches JUnit task and provides its own formatter which acts like test listener. With WebTest task I think currently the only way to get test results is to use service messages.

--
Pavel Sher

0
Comment actions Permalink

Is whatever API the patched JUnit target uses to integrate with TeamCity publicly available? I was wondering if I could modify the WebTest target to do something similar.

0
Comment actions Permalink

I think something like service messages will better suite your needs: http://www.jetbrains.net/confluence/display/TCD3/BuildScriptInteractionwithTeamCity#BuildScriptInteractionwithTeamCity-testReporting

--
Pavel Sher

0
Comment actions Permalink

I began trying to use service messages with TeamCity today. I seem to have run into a snag.

I did some searching to see if anyone had already written Ant tasks to generate service messages, and found that there is a problem with the Ant echo task and service messages (http://www.intellij.net/forums/thread.jspa?messageID=5217545&#5217545 and http://jetbrains.net/tracker/issue/TW-5059)

I thought I'd try writing a couple quick custom ant tasks that write output using System.out.println(). This seems to have the same problem as the echo task. It sees my tests, but when I try to use the testFailed service message, TeamCity doesn't recognize it.

Has anyone gotten service messages working from an Ant build (without something like Oleg's work around mentioned in the thread I linked above)? TW-5059 is currently scheduled to be fixed in "Next Version Pool". Is that TC 4.0 or a later release?

Thanks!

0
Comment actions Permalink

If you plan to create tasks like testStarted, testFinished, testFailure then it won't work. What will work tasks like testSuccessful or testFailed because they will output all required messages in a single block. The block is what TeamCity creates when it sees Ant task and all messages produced by this task are going to that block. Messages like ##testStarted and ##testFailure must be in the one block, that is why they will not work if you create separate Ant task for them.

How are you going to parse WebTest output? To my opinion it is simpler to write a Java class which will take WebTest report and produce required service messages. It seems that Ant tasks will not help you much.

--
Pavel Sher

0
Comment actions Permalink

That's a great idea! I never even thought about parsing the WebTest report after the tests have run. It should pretty pretty simple, as WebTest generates an XML summary report.

Thanks!

0
Comment actions Permalink

Hi Nate, did you get anywhere creating this class? If not I was going to work on one to parse the webtest output.

Daniel    

0
Comment actions Permalink

Sorry for the delay...I never got a chance to work on thhis.  I've switch jobs, and we aren't using WebTest at the moment, so I won't be working on it anytime soon.  Good luck!

0

Please sign in to leave a comment.