Get help with testing, discuss unit testing strategies etc.


Post by Erik2012 »

Hey,

I have a problem referencing the ext-all-debug.js, ext-all.css, siesta-all.js, siesta-all.css three directories above the location of the test-harness.html and test-harness.js. Three directories upon them the extjs-4.1.3 and the siesta sources are saved. I have to use this structure because I do not want to add new sources to our subversion directory where the application I want to test with Siesta is placed.
<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="../../../extjs-4.1.3/resources/css/ext-all.css">
        <link rel="stylesheet" type="text/css" href="../../../siesta-1.1.7-trial/resources/css/siesta-all.css">
        
        <!-- Ext JS library -->
        <script type="text/javascript" src="../../../extjs-4.1.3/ext-all-debug.js"></script>
        
        <script type="text/javascript" src="../../../siesta-1.1.7-trial/siesta-all.js"></script>
        
        <script type="text/javascript" src="test-harness.js"></script> 
    </head>
    
    <body>
    </body>
</html>
When I test the behaviour moving only one directory up with ../extjs-4.1.3/ext-all-debug.js it works fine. When I move one directory more up, it fails and the test-harness.html is not able to load. Firebug says
ReferenceError: Siesta is not defined var Harness = Siesta.Harness.Browser.ExtJS; (test-harness.js).

Exact pathes like D:/rd/myapp/extjs-4.1.3 does not work either. Is there a way to do what I want or am I forced to place my sources there where my app.html file is placed? I am working in an ExtJS 4.1.3 mvc structure. In the examples it works with one time ../.
var Harness = Siesta.Harness.Browser.ExtJS;

Harness.configure({
    title       : 'MVC Test Suite',
    loaderPath  : { 'MyApp' : 'app' },
    
    preload : [
        "../../../extjs-4.1.3/resources/css/ext-all.css",
        "../../../extjs-4.1.3/ext-all-debug.js"
    ]
    
});

Harness.start(
	/*{
        group               : 'Sanity',
        items               : [
            'tests/sanity.js'
        ]
    },*/
    {
        group               : 'UI Tests',
        
        // need to set the `preload` to empty array - to avoid the double loading of dependencies
        preload             : [],
        
        items : [
            {
                hostPageUrl         : 'index.html',
                url                 : 'tests/grid.js'
            }
        ]
    }
);
Thank you
Erik

Post by Erik2012 »

Hey sorry,

I know my issue. I am working with jetty. Jetty is not able to adress files above the directory webapps. Webapps is the place where the deployments are located so it can not work.

Post by mats »

Are you able to work around this to get it working?

Post by nickolay »

Hi,

Not sure, this is something specific to your setup probably. Do you see the failed 404 requests for referenced files in Firebug? Are the permissions set correctly in your webserver? I guess web server has a "root" folder for your localhost and does not allow to reference files outside of it.

Post by Erik2012 »

Yes I was able to workaround it. I created a new directory where my tests are stored. Then I wrote some scripts which fetch all the data I need to perform the tests and copy them (app, extjs, resources directory etc.) into my new created folder. In my SVN only the files for testing are comitted like test-harness.html and .js and the tests themselfes. After that I start my Jetty, perform the tests and shut them down again.
Now I have a new question which is specific to continuous integration. This process I would like to perform on our buildserver jenkins. On this I run my tests, I know this is working from the logging. But how can I tell jenkins to read the junit conform .xml which is created. I told jenkins to execute my script copying the files and starting/stopping jetty server. I do not know how to perform the post build step where to analyse the created .xml which was created by --report-format JUnit --report-file foo.xml. My script doing this is checked in in svn. Jenkins offers the option to publish Junit test results, but this results only exists after my main build step where I execute my script.

Thank you for adivising
Erik

Post by nickolay »

Sorry, I have no experience with Jenkins. The script will generate a report file, also its exit code is 0 if all tests passed and non-zero otherwise.

Post by Erik2012 »

I do it that way. I execute a batch on jenkins which generate my test_result.xml. Jenkins provides an option where I am able to specify that a xml file with these specification is located on top level at Jenkins workspace. The option is named as a post build step, publish Junit Test results. Then Jenkins is able to analyse the phantomJS Junit report.

Thanks for your time
Erik

Post by nickolay »

Any chance you could describe your Jenkins setup in some kind of blog post for other users to learn? We'd happily extend your siesta license in return :)

Post Reply