Documentation

Introduction

RandomTest.net enables integration tests in the following way:

  • Random input is applied for application to deliver runtime coverage
  • Probe (part of RandomTest.net) is integrated with tested system and sends all crashes to RandomTest server instance
  • Server component collects all events (crashes, warnings, exceptions) and produces report for developers

Development State

You’ll find current development status below:

 

language environment probe driver server
C/C++ Linux +
PHP any + +
Java Servlet (JBoss) +
JavaScript window.onerror + (limited stacktrace!)

RandomTest server

You have to place randomtest-server.php on your web server with PHP enabled. Ensure var subdirectory is writable by the user of web server (typically www-data).

With correct installation you will see the following output (URL might depend on your deployment setup):

wget -qO - http://localhost/randomtest-server.php
RandomTest.net report

PHP probe

Installation is very simple. Add the following lines in “common” file for your application (customize URL if necessary):

setenv("RANDOMTEST_URL", "http://localhost/randomtest-server.php");
require("randomtest-probe.php");

Resulting stacktraces will look like:

[Undefined offset: 10]
test1.php:6 randomtest_error_handler()
test1.php:15 fun_A()
test1.php:19 fun_B()

C/C++ probe

Before launching analyzed program you have to load RandomTest shared library (probe) and point to server URL that will collect all events:

export RANDOMTEST_URL=http://localhost/randomtest-server.php
export LD_PRELOAD=randomtest-probe.so
./my-program

You will see the following stacktrace format on the server:

[test1.exe sigsegv_handler]
./test1.exe: MyClass2::myMethod2(char const*)
./test1.exe: MyClass1::myMethod1(int)
./test1.exe: main()
/lib/i386-linux-gnu/libc.so.6: __libc_start_main()
./test1.exe() : ??

Java/Servlet probe

You have to install error handler in your web.xml file:

     <!-- randomtest infrastructure -->
    <servlet>
        <display-name>RandomTestErrorHandler</display-name>
        <servlet-name>RandomTestErrorHandler</servlet-name>
        <servlet-class>com.randomtest.RandomTestErrorHandler</servlet-class>
        <init-param>
            <param-name>RANDOMTEST_URL</param-name>
            <param-value>http://localhost/randomtest-server.php</param-value>
        </init-param>
        <!-- To show any config problems instantly -->
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>RandomTestErrorHandler</servlet-name>
        <url-pattern>/RandomTestErrorHandler</url-pattern>
    </servlet-mapping>

    <!-- Error types to be handled by randomtest -->
    <error-page>
        <error-code>404</error-code>
        <location>/RandomTestErrorHandler</location>
    </error-page>
    <error-page>
        <exception-type>java.lang.Throwable</exception-type >
        <location>/RandomTestErrorHandler</location>
    </error-page>

The following exception format is recorded:

javax.servlet.ServletException: Exception details
	at com.randomtest.test.ExceptionTest.doGet(ExceptionTest.java:15)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181)
	at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285)
	at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88)
	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
	at java.lang.Thread.run(Thread.java:679)

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>