HI Sarthak,

> On 5 Oct 2017, at 18:03, Sarthak Gupta <[email protected]> wrote:
> 
> Hello,
> I am testing my project application-glossary. My tests are failing again
> https://pastebin.com/Ww28QHzB. Can anyone please help me?
> 
> In general, how to read and use stack traces for debugging/removing errors?
> I am not pretty good at this. I mean, in this stack trace also there are so
> many errors with the same name like "XWikiLogOutputStream". Which line to
> look?  How to find where am I going wrong?

It’s hard to help you with the log. What it says;

* The test failed
* The reason is that Selenium timed out waiting for an element to be present:

        • 
testNewGlossaryAndInNestedSpace(org.xwiki.glossary.test.ui.GlossaryTest)  Time 
elapsed: 16.821 sec  <<< ERROR!
        • org.openqa.selenium.TimeoutException:
        • Livetable isn't ready after the timeout has expired.

* There’s a an error in the xwiki logs but I doubt that it’s causing the test 
failure:

17:24:25.794 [Thread-13] ERROR o.x.t.i.XWikiLogOutputStream - 2017-10-05 
17:24:25,792[http://localhost:8080/xwiki/bin/skin/resources/uicomponents/search/searchSuggest.js?h=250790626]
 WARN  c.x.x.d.XWikiDocument          - A reference to XWikiGuest user as been 
set instead of null. This is probably a mistake.


<side explanation about XWikiLogOutputStream>

“XWikiLogOutputStream” is just the class that logs the result of executing 
XWiki: we start automatically XWiki from a Java class in the test and we 
collect the results and print them in the console. If you’re interested to see 
how it works:

* In your code 
https://github.com/xwiki-contrib/application-glossary/blob/master/application-glossary-test/application-glossary-test-tests/src/test/it/org/xwiki/glossary/test/ui/GlossaryTest.java#L42
 you extend AbstractTest
* In AbstractTest there is a @BeforeTest annotation on init(). This is executed 
by JUnit. It starts XWiki:

@BeforeClass
public static void init() throws Exception
{
…
// Start XWiki
persistentTestContext.start();
…
}

* It calls startXWiki() in by calling start_xwiki.sh 
https://github.com/xwiki/xwiki-platform/blob/0effdbb54f0a4e689e0bbfdc5cb91c8abb1db3a4/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-integration/src/main/java/org/xwiki/test/integration/XWikiExecutor.java#L268
* The started process’s STDOUT and STDERR are captured here: 
https://github.com/xwiki/xwiki-platform/blob/0effdbb54f0a4e689e0bbfdc5cb91c8abb1db3a4/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-integration/src/main/java/org/xwiki/test/integration/XWikiExecutor.java#L239

PumpStreamHandler streamHandler = new PumpStreamHandler(new 
XWikiLogOutputStream(XWikiLogOutputStream.STDOUT),
    new XWikiLogOutputStream(XWikiLogOutputStream.STDERR));

XWikiLogOutputStream uses the following logger to log what it captures:
https://github.com/xwiki/xwiki-platform/blob/8793d8438ebfb7cfe40d9b4ce31d9f791f563187/xwiki-platform-core/xwiki-platform-test/xwiki-platform-test-integration/src/main/java/org/xwiki/test/integration/XWikiLogOutputStream.java#L47

That’s why you see XWikiLogOutputStream in the logs…

</side explanation about XWikiLogOutputStream>


So I don’t know what’s wrong with your test. Check the screenshot (you’ll see a 
reference to it in the logs):

17:24:48.504 [main] INFO  org.xwiki.test.ui.TestDebugger - Screenshot for 
failing test [GlossaryTest-testGlossary] saved at 
[/home/sarthak/Desktop/Workspace1/application-glossary/application-glossary-test/application-glossary-test-tests/target/screenshots/GlossaryTest-testGlossary.png].

This is what Selenium was seeing when it failed. That can help you understand 
why some element wasn’t visible.

To help you further I’d need to execute your tests. I don’t have the time right 
now. Since the glossary app is very close to the FAQ app, I’d suggest you try 
to run the FAQ app tests, see if they work for you and try to mimick what they 
do.

Thanks
-Vincent



> 
> application-glossary <https://github.com/xwiki-contrib/application-glossary>
> 
> Thanks
> Sarthak Gupta

Reply via email to