Automation MADE EASY
Quick Start Demo

The purpose of the quick start is to overview in details the process of bali use starting from download to demo project execuiton steps.
Thus you will gain hands-on experience and be able to plan and start your own project . Demo project ideally fits for test automation of web and can be used as a ground.
1
Download
Get bali pack from download section.
    2
    Demo projects
    Downloaded pack contains
    BaliDemo projects

    autotests.
    Requires BaliResources project on Build Path (described below), cause using its Browser resource.

    src/com/balitests/demo1/
    Demo1_JTest.java
    0) JUnit runnable test
    1) reads url1= and url2= values from property file
    2) gets free Browser resource (WebDriver) from pool
    3) opens url1, then url2, and again url1
    4) on each open adds demo error to errors reports, capture state to
    capture report and metric to metrics report
    5) logs steps description

    Demo2_JTest.java - same
    Demo3_JTest.java - same
    Demo4_JTest.java - same
    Demo5_JTest.java - same
    Demo6_2res_JTest.java - (2 resources use example)

    1) reads url1= and url2= values from property file
    2) gets 2 free Browser resources (WebDriver) from pool
    3) opens url1 in Browser1 and url2 in Browser2
    4) adds demo error in browser1 and browser 2 to errors reports
    5) logs steps description

    Demo7_JTest.java - positive test. passed.

    Demo1_TestMain.java - same steps, but runnable by java - static main(...)
    Demo2_TestMain.java
    demo2/
    Demo1_TestMain.java
    Demo1_JTest.java
    Demo2_JTest.java
    Demo6_2res_JTest.java


    /lib/
    bali-api.jar
    junit-4.11.jar
    log4j-1.2.16.jar
    selenium-server-standalone-2.44.0.jar
    3
    Run from IDE
    When You start your runnable item's source code within original runner in IDE or command line,
    it is still using Bali Client API and is expecting to get TestExecContext.

    Next values need to be defined for local TestExecContext building :
    1. Output directory for reports - localBaliRunContext.setResultDir(String dir)
    2. Directory to get options list (pattern *.properties) - localBaliRunContext.setPropertiesDir(String dir)
    3. Option instance to use as active in test - localBaliRunContext.setOptions(String options)
    4. List of resources, planned to used in test - localBaliRunContext.getLocalResources().add( ..instanceof TestExecResource )
    5. Name of class under execution (pack.pack.test) - localBaliRunContext.setLocalClass(String className)
    6. Some project specific initializations (Browser type, system properties)
    see BaseBaliTest.java Update paths accordingly before running test locally.

    /* * checking TestExecContext presence, otherwise creates it looking at local parameters */
    public static void init(Class testClass) throws Exception {

    log.info("Check text exec context in thread: "+Thread.currentThread().getName());
    TestExecContext testExecContext = TestExecContextThreadLocal.getTestExecContext();

    // if test is not started from Bali - then suite/testExecContext is not initialized
    if (testExecContext == null){
    // depended to resources
    System.setProperty("webdriver.chrome.driver", "C:\\selenium\\chromedriver.exe");
    System.setProperty("webdriver.firefox.profile", "default");
    LocalRunBaliContext localBaliRunContext = new LocalRunBaliContext();

    // reports and artefacts output dir
    String resultOutputDir = (System.getProperty("test.report.dir") != null) ? System.getProperty("test.report.dir") : "target/report/"; localBaliRunContext.setResultDir(resultOutputDir);

    // options dir
    localBaliRunContext.setPropertiesDir("C:/projects/Bali/conf/options/");

    // which properties to use in test ? localBaliRunContext.setOptions("ENV_LOCAL");
    localBaliRunContext.setLocalClass(testClass.getCanonicalName());

    // add here resources You plan to get using getResources(...) API
    // set browser type, default - CHROME
    String browserType = System.getProperty("browser") != null ? System.getProperty("browser") : Browser.CHROME;
    localBaliRunContext.getLocalResources().add(new Browser(browserType,"",false));


    // create TestExecContext and set it to TestExecContextThreadLocal
    Bali.activateLocalBaliRunContext(localBaliRunContext);
    }
    }

    4
    Configure & Start Bali with projects
    Follow setup guide located on guides page.
    5
    Loaded projects preview
    Open http://localhost:8080/bali and default testpad page is loaded.
    Goto Status -> Test Projects.

    3 projects are loaded according to projects.xml on bali startup. Commons project is providing Browser resources pool and other 2 child project (inherit classloader from parent) provide runnable items (mentioned list in previous chapter) with JUnit and Java Main runners.
    7
    Resources pool preview
    Goto Status -> Resources

    Here you can observer the list of resource pools and runnable items count, loaded with projects. Commons project contains browser resource pool: 3 chrome browser and 1 firefox on localhost and no tests. JUnit and Main project contain 9 and 3 tests and no resource pools.
    8
    Options view
    1) Goto Status -> Target Grid Options
    2) Select "ENV_A" in combo-box
    3) Properties content, used as parameter for suite execution and accessible in tests, will be displayed
    9
    Tests tree
    Open http://localhost:8080/bali and testpad page is loaded.

    Observer runnable items ready for execution ("junit" and "main" root items).
    Select target browser: Chrome.
    Select items in the tree and click run.
    10
    Suite execution view
    After start you will be moved to detailed execution view.

    System runs maximum possible items according to free resources on pool and threads.
    In our case we have 4 browsers, on first slide we can see 3 items are started and
    are under initialization or progress. 2 ones require 1 Browser and other one requests 2 browser from pool (see row Use Resources).
    Step by step items are executed with some result and then next been followed.
    11
    Resources pool view
    During suites execution You can observe busy state of resource pool's items.
    First browser is occupied by demo2.Demo2_JTest.
    Second browser is occupied by demo1.Demo2_JTest.
    Third and fourth browsers are occupied by demo1.Demo6_2res_JTest (required 2 ones).
    Fourth browser is re-instantiated with Chrome options been initially set as FireFox (per Browser resource design).
    12
    Error classify report

    Open error classify report to view information about errors in very convenient way.
    Observe 6 unique errors met in suite of 14 overall.
    Click "details view" on first unique error and see details layer.
    Click "details view" on first unique error and see details layer.
    13
    View test log
    Click on "test log" link on details layer.
    14
    View capture report
    open "screen capture report".
    15
    View metrics report
    Open metrics report to view collected data series in graph form.

    Data series "counter" was collected during suite execution.
    16
    Rerun tests
    For example, for any reason You wish to restart few tests in accomplished suite.
    Click replay on test icon, its artefact data will be removed from suite and
    it will be added to execution queue.
    It is useful, when You need to update executed suite with new actual result of particular tests run
    and doesn't want to re-run it all again.
    Suite's artefacts will be updated accordingly.
    Execution is in progress.
    17
    Rerun error from classify report
    It is possible to rerun unique error's test set just from 1 click in old suite.
    1) Click "rerun" link
    Report will be cleared from errors posted within reruned tests.
    Open suite execution view, observe tests are queued for re-execution and are in progress.
    18
    Rerun on other envs
    It is possible to rerun unique error's test sets on other environments just from error classify report.
    1) Check unique errors which You wish to rerun. We select second and third ones.
    2) Select in combo box environments You wish to execute it. We select ENV_A and ENV_B.
    3) Click "rerun on envs" button.
    Report will be cleared from errors posted within reruned tests.

    Open suite execution view, observe tests are queued for re-execution and are in progress.

    Open suite execution view, observe tests are queued for re-execution and are in progress.
    Suites with test sets will be created and put to execution queue on these envs.
    Click on second suite link (ENV_B) and open detailed suite execution view.

    Observer 3 tests from 2-nd uniqie error and 1 tests from 3-rd one are under execution.
    Suites with test sets will be created and put to execution queue on these envs.
    19
    Configure/run suite
    1) Goto Suites tab
    2) Select test items, target env, write description and unique name, e.t.c
    3) Input CRON time "0 0 3 * * ?" for scheduling
    4) Click Save
    5) Create few other suites
    6) Select in combo-box other suites, check opened same as saved
    7) click Run, suite is executed
    20
    Suites CRON
    1) Goto Status -> Cron Info
    2) View suites CRON schedule, next Run time
    3) Links to suites are active
    Made on
    Tilda