konveyor / tackle-test-generator-cli

Apache License 2.0
58 stars 34 forks source link

Add add_state_diff_assertions value by default in UI config toml #229

Closed w3dkramer closed 2 years ago

w3dkramer commented 2 years ago

Describe the bug

Currently the init command for the UI config file doesn't include the add_state_diff_assertions parameter. So, when generating test cases, an exception occurs. Example with TMF:

(venv) daniel@Daniels-MacBook-Pro tackle-test-generator-cli-v2.0.0 % tkltest-ui --config-file ./tkltest_ui_config_TMFClassic.toml --verbose generate
[tkltest|12:22:28.933] Loading config file ./tkltest_ui_config_TMFClassic.toml
[tkltest|12:22:28.934] Crawljax runner log will be written to TMF-Classic_crawljax_runner.log
[tkltest|12:22:28.934] Running UI test generator with config: app=TMF-Classic, url="http://localhost:9080/", time_limit=2min, browser=chrome_headless
Generating tests:   1%|▉                                                                                                         |1.0/120 [00:01<01:59]
[tkltest|12:22:29.954] ERROR: UI test genenration failed: Command 'java -Xmx2048m -cp lib/download/tackle-test-generator-ui-0.0.1.jar:lib/download/crawljax-examples-5.0-frag.jar:lib/download/commons-cli-1.4.jar:lib/download/tomlj-1.0.0.jar:lib/download/antlr4-runtime-4.7.2.jar org.konveyor.tackletest.ui.crawljax.CrawljaxRunner -cf __TMF-Classic_tkltest_ui_config.toml 1> TMF-Classic_crawljax_runner.log' returned non-zero exit status 1.
[2022-03-21 12:22:29] [INFO   ] [org.konveyor.tackletest.ui.crawljax.CrawljaxRunner main] Testgen config plan file: __TMF-Classic_tkltest_ui_config.toml 
[2022-03-21 12:22:29] [INFO   ] [org.konveyor.tackletest.ui.crawljax.CrawljaxRunner main] app_name=TMF-Classic app_url=http://localhost:9080/ test_directory=tkltest-output-ui-TMF-Classic/TMF-Classic_localhost_2mins 
[2022-03-21 12:22:29] [INFO   ] [org.konveyor.tackletest.ui.crawljax.CrawljaxRunner main] generate options: [form_fill_mode, crawl_hidden_anchors, click_default_elements, rted_similarity_threshold, max_states, time_limit, include_iframes, max_depth, wait_after_reload, wait_after_event, browser, form_data_spec_file, clickables_spec_file, form_fill_order, browser_pixel_density] 
[2022-03-21 12:22:29] [INFO   ] [org.konveyor.tackletest.ui.crawljax.CrawljaxRunner updateClickablesConfiguration] adding click element spec for 1 elements 
[2022-03-21 12:22:29] [INFO   ] [org.konveyor.tackletest.ui.crawljax.CrawljaxRunner updateClickablesConfiguration] adding don't click element spec for 8 elements 
[2022-03-21 12:22:29] [INFO   ] [org.konveyor.tackletest.ui.crawljax.CrawljaxRunner updateClickablesConfiguration] Done processing click/dont_click.element spec 
[2022-03-21 12:22:29] [SEVERE ] [org.konveyor.tackletest.ui.crawljax.CrawljaxRunner main] Error creating Crawljax configuration: Assertion type not specified: null 
java.lang.RuntimeException: Assertion type not specified: null
        at org.konveyor.tackletest.ui.crawljax.CrawljaxRunner.createTestConfiguration(CrawljaxRunner.java:78)
        at org.konveyor.tackletest.ui.crawljax.CrawljaxRunner.createCrawljaxConfiguration(CrawljaxRunner.java:510)
        at org.konveyor.tackletest.ui.crawljax.CrawljaxRunner.main(CrawljaxRunner.java:645)

https://github.com/konveyor/tackle-test-generator-core/blob/74009fda8d856e876b477e6ffbb169e91f97ad89/tackle-test-generator-ui/src/org/konveyor/tackletest/ui/crawljax/CrawljaxRunner.java line 78

    private static TestConfiguration createTestConfiguration(String stateAssertion) {
        if (stateAssertion == null || stateAssertion.isEmpty()) {
            throw new RuntimeException("Assertion type not specified: "+stateAssertion);
        }
rachelt44 commented 2 years ago

Implemented and merged via PR: https://github.com/konveyor/tackle-test-generator-core/pull/145