I'm new to Siesta and currently facing some problems with the siesta setup.
I have an existing application with the following structure:
commons: code base used for various clients
large: code specifically for tablet clients
small: code specifically for smartphone clients
no i wanted to make some unit tests with siesta.
I setup the siesta toolkit as follow:
test
- siesta
--lib (containing the siesta-all.js and some css files)
--tests (containing the test files)
--index.html
--index.js
my index.html looks as follow:
<!DOCTYPE html>
<html>
<head>
<!-- Siesta UI must use ExtJS 4.2.0 (you can specify any other ExtJS version in your "preload" config) -->
<link rel="stylesheet" type="text/css" href="https://cdn.sencha.io/ext-4.2.0-gpl/resources/css/ext-all.css">
<link rel="stylesheet" type="text/css" href="lib/resources/css/siesta-all.css">
<!-- Siesta UI must use ExtJS 4.2.0 (you can specify any other ExtJS version in your "preload" config) -->
<script type="text/javascript" src="https://cdn.sencha.io/ext-4.2.0-gpl/ext-all.js"></script>
<script type="text/javascript" src="lib/siesta-all.js"></script>
<script type="text/javascript" src="index.js"></script>
</head>
<body>
</body>
</html>
var Harness = Siesta.Harness.Browser.ExtJS;
Harness.configure({
title : 'XY - Test Suite',
preload : [
// version of ExtJS used by your application
'../../touch/resources/css/sencha-touch.css',
'../../resources/css/xy.css',
// version of ExtJS used by your application
'../../touch/sencha-touch-all-debug.js',
'../../touch/sencha-touch-all.js',
]
});
Harness.start(
'test_bibliothek/100_sanity.t.js',
'test_bibliothek/200_ajax.t.js',
'test_bibliothek/UtilsTest.js'
);
StartTest(function(t) {
t.diag("WeatherUtils");
Ext.Loader.setPath({
'Ext.ux': 'commons/extensions/ux',
});
t.it('getApproximateValue', function(t){
var utils = Ext.create('Ext.ux.WeatherUtils');
var x = utils.getApproximateValue(weatherDataEnum.CLOU, 0);
t.expect(x.toBe(1));
});
t.done(); // Optional, marks the correct exit point from the test
});
Failed loading synchronously via XHR: 'commons/extensions/ux/WeatherUtils.js'; please verify that the file exists. XHR status code: 404
I guess i am doing something wrong in general. WeatherUtils is a singleton class in my application. since i want to do unit tests, i do not want to have the whole application running. the methods should get testet isolated. however i guess i'm missing an important setup part of siesta. what is the correct way to get access to methods, classes, controllers etc. of my application?
I did not find any tutorials which fit my level of knowledge with sencha touch testing.
cheers