Revision: f2fcbe6f0011
Branch: default
Author: Jussi Malinen <jussi.ao.mali...@gmail.com>
Date: Wed May 28 11:08:10 2014 UTC
Log: Update issue 811
Now works with java
http://code.google.com/p/robotframework/source/detail?r=f2fcbe6f0011
Added:
/atest/testdata/test_libraries/as_listener/suite_scope_java.txt
/atest/testresources/testlibs/JavaListenerLibrary.class
/atest/testresources/testlibs/JavaListenerLibrary.java
Modified:
/atest/robot/test_libraries/as_listener.txt
=======================================
--- /dev/null
+++ /atest/testdata/test_libraries/as_listener/suite_scope_java.txt Wed May
28 11:08:10 2014 UTC
@@ -0,0 +1,17 @@
+*** Settings ***
+Library JavaListenerLibrary
+
+*** Test Cases ***
+Java suite scope library gets events
+ Events should be start suite Suite Scope Java
+ ... start test Java suite scope library gets events
+ ... start kw JavaListenerLibrary.Events Should Be
+
+New java test gets previous suite scope events
+ Events should be start suite Suite Scope Java
+ ... start test Java suite scope library gets events
+ ... start kw JavaListenerLibrary.Events Should Be
+ ... end kw JavaListenerLibrary.Events Should Be
+ ... end test Java suite scope library gets events
+ ... start test New java test gets previous suite scope
events
+ ... start kw JavaListenerLibrary.Events Should Be
=======================================
--- /dev/null
+++ /atest/testresources/testlibs/JavaListenerLibrary.class Wed May 28
11:08:10 2014 UTC
@@ -0,0 +1,83 @@
+Êþº¾ 1 m
+ @ A
+ @ B C D
+ @ E
+ F
+ G
+ H I J K L M
+ N O
+ P
+ P Q R
+ S T
+ U
+ V W
+ V
+ X Y Z [ ROBOT_LISTENER_API_VERSION Ljava/lang/String;
+ConstantValue \ ROBOT_LIBRARY_SCOPE ] events Ljava/util/ArrayList;
Signature )Ljava/util/ArrayList<Ljava/lang/String;>; ROBOT_LIBRARY_LISTENER LJavaListenerLibrary; <init> ()V Code LineNumberTable
+startSuite $(Ljava/lang/String;Ljava/util/Map;)V endSuite
startTest endTest
+startKeyword
+endKeyword
getEvents ()Ljava/util/List; &()Ljava/util/List<Ljava/lang/String;>; eventsShouldBe (Ljava/util/List;)V '(Ljava/util/List<Ljava/lang/String;>;)V
+SourceFile JavaListenerLibrary.java
+ - . java/util/ArrayList
+ ' (
+ + , java/lang/StringBuilder
+start suite
+ ^ _
+ ` a
+ b c
+end suite
+start test end test start kw end kw
+ d e java/util/List
+ f g java/lang/RuntimeException -Expected events not the same size.
Expected:
+
+ ^ h
+Actual:
+
+ - i
+ j k java/lang/String
+ l c (Expected events not the same. Expected:
+ JavaListenerLibrary java/lang/Object 2
+TEST
SUITE append -(Ljava/lang/String;)Ljava/lang/StringBuilder; toString ()Ljava/lang/String; add (Ljava/lang/Object;)Z clone ()Ljava/lang/Object; size ()I -(Ljava/lang/Object;)Ljava/lang/StringBuilder; (Ljava/lang/String;)V get (I)Ljava/lang/Object; equals !
! " # $ % " # & ' ( ) * + ,
- . / 9 *· *» Y· µ **µ ± 0
+
+ 1 2 / 8
+*´ » Y· ¶ +¶ ¶
+¶
+W± 0
+ 3 2 / 8
+*´ » Y·
+¶ +¶ ¶
+¶
+W± 0
+ 4 2 / 8
+*´ » Y·
+¶ +¶ ¶
+¶
+W± 0
+ 5 2 / 8
+*´ » Y· ¶ +¶ ¶
+¶
+W± 0
+
+
+ 6 2 / 8
+*´ » Y· ¶ +¶ ¶
+¶
+W± 0
+ ! " 7 2 / 8
+*´ » Y· ¶ +¶ ¶
+¶
+W± 0
+ % & 8 9 / #
+*´ ¶ À ° 0 ) ) : ; < / É ™*´ ¶ +¹ Ÿ *» Y» Y· ¶
+¶ ¶
*´ ¶ ¶
+· ¿ =
++¹ ¢ X+
+¹ À *´
+¶
+¶
+š :» Y» Y·
+¶ +
+¹ À ¶ ¶ *´
+¶
+À ¶ ¶
+· ¿„ §ÿ¤± 0
+ - . 7 / C 0 [ 1 ’ / ˜ 4 ) = > ?
=======================================
--- /dev/null
+++ /atest/testresources/testlibs/JavaListenerLibrary.java Wed May 28
11:08:10 2014 UTC
@@ -0,0 +1,53 @@
+import java.util.*;
+
+public class JavaListenerLibrary {
+
+ public static final String ROBOT_LISTENER_API_VERSION = "2";
+ public static final String ROBOT_LIBRARY_SCOPE = "TEST SUITE";
+
+ public ArrayList<String> events = new ArrayList<String>();
+
+ public JavaListenerLibrary ROBOT_LIBRARY_LISTENER;
+
+ public JavaListenerLibrary() {
+ ROBOT_LIBRARY_LISTENER = this;
+ }
+
+ public void startSuite(String name, Map attrs){
+ events.add("start suite "+name);
+ }
+
+ public void endSuite(String name, Map attrs){
+ events.add("end suite "+name);
+ }
+
+ public void startTest(String name, Map attrs){
+ events.add("start test "+name);
+ }
+
+ public void endTest(String name, Map attrs){
+ events.add("end test "+name);
+ }
+
+ public void startKeyword(String name, Map attrs){
+ events.add("start kw "+name);
+ }
+
+ public void endKeyword(String name, Map attrs){
+ events.add("end kw "+name);
+ }
+
+ public List<String> getEvents() {
+ return (List<String>)events.clone();
+ }
+
+ public void eventsShouldBe(List<String> expected) {
+ if (events.size() != expected.size())
+ throw new RuntimeException("Expected events not the same size.
Expected:\n"+expected+"\nActual:\n"+events);
+ for (int i = 0; i < expected.size(); i++) {
+ if (!expected.get(i).equals(events.get(i)))
+ throw new RuntimeException("Expected events not the same.
Expected:\n"+expected.get(i)+"\nActual:\n"+events.get(i));
+ }
+
+ }
+}
=======================================
--- /atest/robot/test_libraries/as_listener.txt Tue May 27 10:01:34 2014 UTC
+++ /atest/robot/test_libraries/as_listener.txt Wed May 28 11:08:10 2014 UTC
@@ -1,7 +1,8 @@
*** Settings ***
Documentation Tests for libraries using getKeywordNames and runKeyword
with **kwargs functionality. In these tests libraries are implemented with
Java.
Suite Setup Run Tests ${EMPTY} test_libraries/as_listener/
-Force Tags regression pybot jybot
+Force Tags regression
+Default tags jybot pybot
Resource atest_resource.txt
*** Test Cases ***
@@ -13,3 +14,9 @@
Check Test Case ${TESTNAME}
New test gets previous suite scope events
Check Test Case ${TESTNAME}
+Java suite scope library gets events
+ [tags] jybot
+ Check Test Case ${TESTNAME}
+New java test gets previous suite scope events
+ [tags] jybot
+ Check Test Case ${TESTNAME}
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.