How to ignore import file from Global import in Robot framework - selenium

I have imported Resource from the submodule and then I need to rewrite some data in the file but it doesn't work because it calling the global file import
Example:
# submodule/imports/web_global.robot
*** Settings ***
Variables ${CURDIR}/../test_data/products_data.yaml
${products_data}: global
# imports/web_local.robot
*** Settings ***
Resource ${CURDIR}/../submodule/imports/web_global.robot
Variables ${CURDIR}/../test_data/products_data.yaml
${products_data}: local
# testcases/web/test_file.robot
*** Settings ***
Resource ${CURDIR}/../../imports/web_local.robot
*** Test Cases ***
Example
Log To Console ${products_data}
I got the last result is global. How to get the last result to local

You might be confusing the yaml method of supplying variables with the ${} "usual way". As given, your "${var}: " causes a syntax error because it is an illegal variable name (cannot end with a colon).
You do not show your products_data.yaml (please supply all code), but I am guessing that your ${products_data}: should be expressed as
VAR: value
PRODUCTS_DATA: global
It is a confusing question and I am struggling to grasp it.
Here is my attempt to re-create your question, but I could not re-produce the full sense of your question.
*** Settings ***
Variables ${CURDIR}/test_data/products_data.yaml
*** Variables ***
${products_data} local
*** Test Cases ***
Example
Log To Console Value of products_data is ${products_data}\n
and the result:
==============================================================================
SOExample
==============================================================================
Example Value of products_data is local
Example | PASS |

I painstakingly re-created your entire, convoluted chain.
The semantic answer to your question: when there is a naming conflict, Robot takes the first one (ignores your 2nd definition of the like-named variable products_data).
You can read about it in the RF User Guide, section on variables
Here is the relevant paragraph:
All variables from a variable file are available in the test data file that imports it. If several variable files are imported and they contain a variable with the same name, the one in the earliest imported file is taken into use. Additionally, variables created in Variable tables and set from the command line override variables from variable files.
Simplest solution: in imports/web_local.robot, remove the Resource which you do not want:
*** Settings ***
#Resource ${CURDIR}/../submodule/imports/web_global.robot
Variables ${CURDIR}/test_data/products_data.yaml
Now your variable from imports/test_data/products_data.yaml is used.
Good luck untangling! I recommend re-thinking your structure.

Related

Error serializing export interface, Unable to load transformation [null] : can't find directory

I used a Transformation Executor to call another transformation, Under browse I defined the variable as ${trans_path} however when I run it on the server it complains about the following error "Unable to load transformation [null] : can't find directory "
Before calling the trans executor have a write to log step output the value of that variable. It’ll allow you to check whether the variable is being passed correctly.
The log output should appear on you catalina.out file under tomcat’s lot folder.

RobotFramework - Help to understand - Multiline strings are different message

I am looking to compare two text files using RobotFramework.
I get similar lines as shown below when there is a mismatch
Multiline strings are different:
--- first
+++ second
## -3,11 +3,11 ##
I understand that - denotes an old file and the + denotes the new file.
I have trouble understanding the ## -3,11 +3,11 ## part.
Because , in the file , the difference is in line 10 of my file.
I am not able to understand why it says 3 or 11
*** Settings ***
Library SeleniumLibrary
Library OperatingSystem
*** Test Cases ***
Read Text File
${Getfile1content}= Get File convo1.txt
${Getfile2content}= Get File convo2.txt
Should be equal as strings ${Getfile1content} ${Getfile2content}
This is the code that I am using .
In my case, the difference is in Line 10 of the new file. It rightly isolates the lines and shows the difference but the actual numbers are confusing

How can a CMake variable be hidden?

I have a CMake project which lets a globally set variable (set with -DARDUINO_SDK_PATH=/a/b/c on command line) disappear i.e. suddenly the given value is gone which leads to a fatal error.
I know there are different ways to "hide" a variable (e.g. inside functions or external projects)
In my case:
the variable is not being set explicitly anywhere in the code (e.g. via set() or find_path())
the access which leads to the error is on top level (i.e. not inside a function)
there are instructions (i.e. same file/line) where in one case the variable has the value it's been given and the next time it's gone
Tracing the variable with variable_watch(ARDUINO_SDK_PATH) I can see that everything works fine before the compiler is being checked:
cmake -DARDUINO_SDK_PATH=/a/b/c <path>
...
... everything fine, ${DARDUINO_SDK_PATH} == '/a/b/c' everywhere
...
-- Check for working C compiler: /usr/bin/avr-gcc
...
... here the variable is empty and not being traced any more
...
Here is my suggestion:
Does the compiler check (indicated by check for working C compiler .. on the terminal) have it's own variable space and does not know variables provided on command line?
Note: This question is a generalization of this question, which has become way too specialized but might offer some useful background information.
That any modification to variable is not traced after the variable_watch() command seems like a bug somewhere in CMake to me.
Generally speaking a "cached CMake variable" can be hidden by a "normal CMake variable" with the same name. But e.g. find_path() won't run again or modify a variable if already set.
Here is an example:
cmake_minimum_required(VERSION 2.4)
project(VariableWatchTest NONE)
variable_watch(MY_TEST_VAR)
set(MY_TEST_VAR "something" CACHE INTERNAL "")
message("${MY_TEST_VAR}")
set(MY_TEST_VAR "hiding something")
message("${MY_TEST_VAR}")
unset(MY_TEST_VAR)
message("${MY_TEST_VAR}")
find_path(MY_TEST_VAR NAMES "CMakeLists.txt" HINTS "${CMAKE_CURRENT_LIST_DIR}")
message("${MY_TEST_VAR}")
Would give (without the variable_watch() messages:
-- something
-- hiding something
-- something
-- something
References
What's the CMake syntax to set and use variables?
I'm not sure whether this is a bug or a feature but (at least some) CMake variables are not available in certain steps of the CMake configuration procedure.
You can check this by adding something like this to your toolchain file:
MESSAGE("FOO: ${FOO}")
and run CMake like this
cd build-dir
cmake -DFOO=TEST ..
You will likely see FOO printed with value TEST once in the beginning of the configuration process and later printed again but being empty.
Just don't access variables from the global space inside a toolchain file (doesn't belong there anyway).

Testing net/http?

I am a little confused about how to structure a go web app and its tests. I have read the How to Write Go Code but still don't get it. For example, I have a go project called "beacon" with a beacon.go file at the root. Adding a trivial beacon_test.go file (copied verbatim from http://golang.org/pkg/net/http/httptest/#example_Server) causes this error:
$ go test
# github.com/jelder/beacon
./beacon_test.go:11: main redeclared in this block
previous declaration at ./beacon.go:216
FAIL github.com/jelder/beacon [build failed]
Sure enough, line 11 is func main(). If I instead change the package main line in my beacon_test.go to package hello, I get this error instead:
can't load package: package github.com/jelder/beacon: found packages main (beacon.go) and hello (beacon_test.go) in /Users/jacob/src/github.com/jelder/beacon
beacon_test.go has also a function called main() rename it to TestFirst (or any other name you like as long as it starts with Test, note the uppercase T is important). There is no need for that. Just run go test . from inside the package you are working on (the one containing the *.go files). Post the full files if you need more help.

How to add a user defined function in QDB Library?

QDB is a database provided by QNX Neutrino package. I went through the QDB documentation to add a user defined SQL function: http://www.qnx.com/developers/docs/6.5.0/topic/com.qnx.doc.qdb_en_dev_guide/writing_functions.html?cp=2_0_8
I created a source file which had my user define SQL function written in C and qdb_function structure definition. I built it with a make file to create libudf.so.
As suggested by QDB I added Function = udftag#libudf.so in the qdb.cfg. But while running the qdb in the shell prompt, it is giving the error (in bold):
qdb -I basic -V -R set -v -c /etc/sql/qdb.cfg -s de_DE#cldr -o tempstore=/fs/tmpfs
QDB: No script registered for handling corrupt database.
qdb: processing [TempMainAddressBook]Function - Can't access shared library
and qdb is getting exited immediately.
I have tried following things:
made sure sqlite3 library is added in the make file
source code is in strictly in C by using directive : extern "C" to avoid name mangling as the file extension is .cpp. I also tried with .c extension.
given the absolute path of the libudf.so in qdb.cfg as : Function = udftag#/usr/lib/libudf.so
qdb_funcion struct is properly defined in library's source code only.
tried without using the static declaration of function(mentioned in the qdb docs)
After trying all hits and trials also, I am getting the same error every time which is Can't access shared library
If any one has any idea to resolve this error please share.
Suggestion 1: run qdb by setting LD_DEBUG=1, like in:
LD_DEBUG=1 qdb command line options
This will output a lot of debug information from the dynamic loader as it attempts to locate and then load the .so files. Check what is the path that it output before the "Can't access" message is displayed.
Suggestion 2: obvious but make sure that the permissions are OK for the .so file. Do you have the execution permission set?
Suggestion 3: check if the error message is identical if you completely remove the .so file from the system
Suggestion 4: increase the number of lower-case 'v'-s. QDB likely supports more, with progressively more verbose information provided as you increase the numbers (6 should be enough for full verbosity)