How Testing Tool Works

Construction.png Not Ready for Review: This Page is Under Development!

This page explains how Eiffel Studio testing tool works under the hood. For Eiffel Studio testing tool general information, please see Eiffel_Testing_Tool.

Main ideas

Test case creation

Testing tool can create unit test cases. It depends on the test case creation wizard to get test case related information from end users. After end user gave all information, {ES_NEW_EWEASEL_TEST_MANAGER} will create a set of test case files which have four files (test case Eiffel class file, test case ecf file, eweasel control file, tcf file, test case note file).

While creating test case files, {ES_NEW_EWEASEL_TEST_MANAGER} reads file templates from Eiffel Studio template directory ($ISE_EIFFEL/studio/help/defaults). The four template files are:

  • eiffel_unit_test_class_template.e
  • eiffel_unit_test_ecf_template.ecf
  • eiffel_unit_test_note_template.txt
  • eiffel_unit_test_tcf_template.txt

After read template file, {ES_NEW_EWEASEL_TEST_MANAGER} will replace $SYMBOL in template files with generated texts (such as features under test, test case class name etc...). Finally, the files will be saved by {ES_NEW_EWEASEL_TEST_MANAGER} in the cluster selected by end user.

Test case execution

Eiffel Studio testing tool is a tool which launch eweasel executable in background.

If launch success, eweasel output analyzers ({ES_EWEASEL_RESULT_ANALYZER}) will analyze all eweasel console outputs which redirected by process library. The {ES_EWEASEL_RESULT_ANALYZER} manage a set of {ES_EWEASEL_RESULT_HANDLER}s. The responsibility of {ES_EWEASEL_RESULT_ANALYZER} is try to find eweasel test run result output sections, and invoke all {ES_EWEASEL_RESULT_HANDLER} to handle the eweasel output. The eweasel result output section means the text block between two "Test " tags.

{ES_EWEASEL_RESULT_HANDLER} is using chain of responsibility pattern. So different {ES_EWEASEL_RESULT_HANDLER} descandent will handle different eweasel output case. Such as {ES_EWEASEL_PASSED_RESULT_HANDLER} will try to find if there is ": passed" in a eweasel output section. If found, {ES_EWEASEL_PASSED_RESULT_HANDLER} will create a {ES_EWEASEL_TEST_RESULT_ITEM} as result. {ES_EWEASEL_RESULT_ANALYZER} will stop the loop.

Just after pressed `start_test_run’ button, testing tool will try to find eweasel executable (e.g. eweasel.exe on Windows) under your $ISE_EIFFEL/eweasel/bin directory. If the executable not found, testing tool can’t not start the test run. And it will report error on the UI.

Tese case class identification

You may notice that even the test case classes are not references in a project. They are compiled even recompile from scratch. The secrect is {ES_TEST_CASE_FINDER}.add_hook. {ES_TEST_CASE_FINDER} will find all test case classes each time system rebuild configuration ({SYSTEM_I}.rebuild_configuration). If a Eiffel class top indexings have a line: "test_case: xxx", it will be recognized as a test case class ({ES_TEST_CASE_FINDER}.is_test_case_class).


If just after started testing, but eweasel is hanging

This is normally caused by following three reasons:

  • Precompiled lib version is not correct

This normally happens just after you using a new version of ec.exe. So the precompiled library version mismatches. Please first precompiled the base and base-mt before use the testing tool.

  • Your locale is not “en_US”.

The solution is set ISE_LANG environment variable. “set ISE_LANG=en_US”

  • ec compliant about $ISE_EIFFEL not exits just after started

Please make sure your %ISE_EIFFEL environment is correct. Please make sure it isn’t end with “\” and the path exits.