Configure Guide
System requirements
  • Win/Unix/Other OS supporting JVM and AppServer with servlets profile
  • Java 1.8/higher
  • browser (best to work with FF, Chrome, Yandex.Browser)
  • at least 30 Mb of free disk space plus consider test results artifacts volumes (images, videos, e.t.c)
Main config
set ENV variable and point to the main properties file before web app load.
Set BALI_PROPERTIES_PATH=C:\\projects\\Bali\\conf\\bali.properties

bali.properties content

points to key config - projects.xml and paths to the dirs to store different work artifacts.

// path to project declaration config of executable&resources
bali.projects.config=C:\\projects\\Bali\\conf\\projects.xml
// for unix systems modify up to your actual path like: /home/user/projects/Bali/conf/projects.xml
// And same for every path option follows below.


// path to Bali web-app root
bali.core.dir=C:\\projects\\Bali\\

// path to suites dir
bali.suites.path=C:\\projects\\Bali\\conf\\suites\\

// path to storage of options dir
bali.options.dir=C:\\projects\\Bali\\conf\\options\\

// path to storage of test results dir
bali.results.dir=C:\\projects\\Bali\\results\\

// path to web driver

webdriver.chrome.driver=C:\\selenium\\chromedriver.exe

// path to outgoing mail server
bali.smtp.host=abc.com
Projects config (projects.xml)
Describes projects meta information.

Project is defined by the adapter class, properties for it and resource pools ones.
There are commong properties like name, parentproject and project specific ones,
defined in detailconfig tag.

< ?xml version="1.0" encoding="UTF-8"? >
< config >

< !-- project is source for runnable items and resource pools-->
< !-- current one is configured to provide Browser's resource pool only, used in child projects -->

< project >

< !-- adapter class, responsible for creating runnable tests tree or resource pool-->
< !-- check runner plugin guide for details-->

< adapter >org.kkonoplev.bali.runner.junit.JUnitProjectAdapter< /adapter>

< !-- project config contains common sections to be in each project
and additional detailconfig section to be parsed by adapter on runtime -->

< config >

< !-- uniq project name -->
< name >commons < /name >

< !-- detailconfig section is project specific to be parsed by adapter's ProjectDetailsParser interface -->
< detailconfig >
< binfolder > C:\projects\BrowserResource\bin\ < /binfolder >
< libfolder > C:\projects\BrowserResource\lib\ < /libfolder >
< /detailconfig >

< !-- declare resources pool to be used by tests -->
< ResourcePool >
< !-- factory class, implementing ITestExecResourceFactory interface and used for creation of pools instances-->
< factoryclass>org.kkonoplev.bali.selenium.browser.BrowserFactory

< !-- commands to be invoked in factory to generate required resource objects on instance -->
< !-- add 3 firefox Browser to pool -->

< loadcmd >3,,false,chrome< /loadcmd >
< !-- add 1 firefox Browser to pool -->
< loadcmd >1,,false,firefox< /loadcmd >
< /ResourcePool >
< /project >

< !-- project is source for runnable items and resource pools-->
< !-- current one is configured to provide JUnit runnable items -->

< project >

< !-- adapter class, responsible for creating runnable tests tree according to required API.-->
< !-- check runner plugin guide for details-->

< adapter >org.kkonoplev.bali.runner.junit.JUnitProjectAdapter< /adapter >

< !-- project config contains common sections to be in each project
and additional detailconfig section to be parsed by adapter on runtime -->

< config >

< !-- uniq project name, observable in frontend as project id -->
< name >junit< /name >

< !-- set reference to the parent project, some items of parent project
(like classloader e.t.c) may be used by child for construction, we plan to use browsers from pool -->

< parentproject >commons< /parentproject >

< !-- detailconfig section is project specific to be parsed by adapter's ProjectDetailsParser interface -->
< detailconfig >
< binfolder >C:\projects\BaliDemo\bin\< /binfolder >
< libfolder >C:\projects\BaliDemo\lib\< /libfolder >
< testmatch > test.class < /testmatch >
< /detailconfig >
< /config >

< /project >

< /config >
Deploy App
Tomcat is used as application container (version 8 is included in pack to boost your configuration).
Per wish you are able to deploy bali app to any other servlet container.
Goto and edit .../tomcat8/conf/Catalina/localhost/Bali.xml app load descriptor.

modify docBase and workDir according to your's actual path.

< Context path="/bali" reloadable="true" docBase="/home/user/bali_pack/projects/Bali" workDir="/home/user/bali_pack/projects/Bali/work" / >
Start App
Goto .../tomcat8/bin and execute startup.bat (Win) or startup.sh (unix like systems).
Note that BALI_PROPERTIES_PATH variable should point to bali.properties file location. Otherwise system will not load.
Logs
Goto .../tomcat8/log/ to get app logs and debug any details.
Resource pool
Resource pool is java object, located in project's structure, containing instances of defined class (extending TestExecResource),
which are intended to be used by tests in current or child projects.
Current example is defining Browser resource pool. BrowserFactory is used for building pool's objects.
3 chrome browser and 1 firefox are instantiated on pool.
Bali offers for user to define any resource classe, its factory and resource pool of current class.

< ResourcePool >

< !-- factory class, implementing ITestExecResourceFactory interface and used for creation of pools instances-->
< factoryclass>org.kkonoplev.bali.selenium.browser.BrowserFactory

< !-- commands to be invoked in factory to generate required resource objects on instance -->
< loadcmd >3,,false,chrome< /loadcmd >

< !-- add 3 firefox Chrome to pool -->
< !-- add 1 firefox Browser to pool -->

< loadcmd >1,,false,firefox< /loadcmd >

< /ResourcePool >
Threads Count modify
In threads count textbox you see the actual size of thread pool for tests execution.
You can modify the value up to required and click update.
Resources add
Resources loaded on app deploy are configured in projects.xml. To add new resources goto Status -> Resources page.
Scroll to the resources pool view. Input in one's textbox a resource creation command and click add.

for example,
to add 2 phantomjs browsers, we need to click add with next string "2,,,phantomjs" (accoring to BrowserFactory design).
and as result we see 2 phantomjs browsers added.
Resources clear
Input string in pool's textbox matching the set of resources to remove and click clear.
Each TestExecResource.match(String s) == true will be picked.

For example, input string "firefox". Click clear.
Firefox browsers are removed.
Logging
Bali uses log4j for logging.
At webApp load it is taken from System.getProperty("catalina.base")/conf/log4j.properties.
System.getProperty("catalina.base") is usually set with < TOMCAT_HOME > on startup.
Configure it per your project.

1) Standard stdout
rootLogger -> stdout

2) Each test execution thread is logging to separate html formatted file

Custom appender/formatter was developed:
rootLogger -> threadslog
appender.threadslog=org.kkonoplev.bali.common.logger.ThreadsAppender
appender.threadslog.layout=org.kkonoplev.bali.common.logger.LogHTMLLayout

before test execution thread is starting new test context processing
it is setting ThreadLocal file variable to be used by ThreadsAppender.

MDC.put(ThreadsAppender.FILE, new File(packageDir, "TESTLOG-" + name + "-"+threadId+".html").getAbsolutePath());

3) Bali service execution logs to separate file
org.kkonoplev.bali.suiteexec.* -> bali-api.log

4) Bali project initialization to separate file
org.kkonoplev.bali.services.ProjectService -> bali-init.log
Made on
Tilda