Как выполнить тестовый набор TTCN-3 из JAVA - PullRequest
0 голосов
/ 29 апреля 2020

Я хочу выполнить тестовый пример TTCN-3 с JAVA, но у нас возникли проблемы с его выполнением. Мы используем приведенный ниже тестовый пример ttcn3. Мы также добавили один плагин в Eclipse IDE, который называется «TITAN_Designer_and_Executor_Plugin_6.6.1». После успешного добавления плагина мы создадим проект TITAN java и добавим один модуль TTCN3 Hello1.ttcn

.
    //TTCN3 Module name : Hello1.ttcn

        //====================== Port Types ======================
        type port MYPORT message {
          inout charstring
        } with {extension "internal"}

        //====================== Component Types ======================
        type component MYCOMP {
          port MYPORT myport
        }

        //====================== Constants ======================
        const charstring ws0 := "(\n| )#(0,)"

        //====================== Templates ======================
        //Strings containing the words "hello" and "world", in all small, or
        //all capital letters, or small letters with first letter capital;
        //exclamation mark is optional; whitespaces allowed
        template charstring t_expected :=
          pattern "{ws0}(((h|H)ello {ws0}(w|W)orld)|HELLO {ws0}WORLD){ws0}!#(0,1){ws0}"

        //====================== Functions ======================
        function f_PTC() runs on MYCOMP {
          alt {
            [] myport.receive(t_expected){
              setverdict(pass,"expected message received: ",t_expected)
            }
            [] myport.receive {
              setverdict(fail,"not the expected message received: ",t_expected)
            }
          }
        }

        //====================== Testcases ======================
        testcase TC(charstring pl_toSend) runs on MYCOMP {
          var MYCOMP vl_PTC := MYCOMP.create;
          connect (self:myport, vl_PTC:myport);
          vl_PTC.start(f_PTC());
          myport.send(pl_toSend);
          vl_PTC.done
        }

        //=========================================================================
        // Control Part
        //=========================================================================
        control {
          var charstring vl_inputs [6] :=
            {"HELLO WORLD!","hello world","Hello World!","hello WORD!","hELLO wORLD!","helloworld!"}
          var integer i, vl_noStrings := sizeof(vl_inputs);
          for (i:=0; i< vl_noStrings; i:=i+1){
            execute (TC(vl_inputs[i]))
          }
        } // end of control

    // Automatic Generate so many line of Java code from Eclipse IDE file name is Hello1.java


    //this class also make the eclipse IdE Java Main Class 

     package org.eclipse.titan.dummy_test.generated;
            import org.eclipse.titan.runtime.core.Module_List;
            import org.eclipse.titan.runtime.core.PreGenRecordOf;
            import org.eclipse.titan.runtime.core.Runtime_Single_main;
            import org.eclipse.titan.runtime.core.TTCN_Logger;
            import org.eclipse.titan.runtime.core.TitanLoggerApi;
            import org.eclipse.titan.dummy_test.generated.Hello1;
            public class Single_main {
            public static void main( String[] args ) {
            long absoluteStart = System.nanoTime();
            Module_List.add_module(new PreGenRecordOf());
            Module_List.add_module(new TitanLoggerApi());
            Module_List.add_module(new Hello1());
            TTCN_Logger.set_executable_name("dummy-test");
            int returnValue = Runtime_Single_main.singleMain( args );
            System.out.println("Total execution took " + (System.nanoTime() - absoluteStart) * (1e-9) + " seconds to complete");
            System.exit(returnValue);
            }
            }   

// when we execute the main class then it will give some error logs in console

Dynamic test case error: Module PreGenRecordOf does not have control part.
Verdict statistics: 0 none, 0 pass, 0 inconc, 0 fail, 0 error.
Number of errors outside test cases: 1
Test execution summary: 0 test case was executed. Overall verdict: error
Total execution took 0.416742785 seconds to complete

* Мы пытаемся выполнить тестовый пример TTCN3 из java, но мы не можем выполнить.

мы можем создать тестовый пример TTCN3 с помощью "TITAN_Designer_and_Executor_Plugin" и в то же время соответствующий TTCN3 автоматически создаст исполняемый файл java.

, если файл java успешно скомпилируется, когда этот класс добавлен в основной класс, который мы должны выполнить.

Мы просим вас всех, пожалуйста, дайте мне какое-нибудь решение для выполнения теста TTCN-3 с JAVA. *

...