Robot FrameWork : Issue when parameterizing Resource path in Settings - eclipse

Robot Framework -I have issue parameterizing the resource path in settings section.Currently I have object repository in a file for my selenium project and saved it as ObjectMap.Robot file. The OR file is placed inside project . My objective is to place the ObjectMap.Robot in remote place to access it.
Currently I have defined the variable in the ConfigVariables.robot
*** Variables ***
${DataFilePath} /Sample/DataFiles/
${OR_PATH} \\\\AIX2UB333/Resources/ObjectMap/
The ${OR_PATH} keep changing And to access OR file in my keyword file, I have set my setting as below.
*** Settings ***
Resource ../Resources/ConfigurationFiles/ConfigVariables.robot
Resource ${OR_PATH}/ObjectMap.robot
Issue : Error is shown as that
The import name/path '${OR_PATH}/ObjectMap.robot' is parameterized.
Some of used parameters cannot be resolved. Use Variable mappings in
red.xml for parameter resolution
Tried adding to red.xml, the error still persist.
The funny thing is that if i run the test case it would run successfully. But the variables used from the objectmap has a red error line in test cases. Every variables has the error
Variable is used, but not defined.

As highlighted by #Bryan Oakley, this is not a Robot Framework problem but a project configuration issue in the Eclipse RED Robot Framework editor.
It seems to me that something in your setup is not correct with respect to the project variable mapping. Please ensure that you have the latest RED by updating your eclipse from the market place or by downloading the latest from the GitHub site. I created a new project and added three files
project:
.
├── red.xml
├── OR
| └── ObjectStore.robot
├── test.robot
└── resource.robot
test.robot
*** Setting ***
Resource resource.robot
Resource ${OR}/ObjectStore.robot
*** Test Cases ***
resource.robot
*** Variable ***
${OR} OR
ObjectStore.robot
[EMPTY]
RED.xml
This then ensures that no error is shown in test.robot
As your object store may change, I'd also advise not to include it in a hard coded configuration reference. Instead use the power of Robot Framework command line variable to add a variable or refer to a variable file to have the flexibility you seek without the need to modify files after fetching them from a source code repository.

I have found a workaround for the situation asked. I inserted a py file which as the code to copy ObjectMap from my remote machine to my local project and method name of this code was used as keyword in robot and applied in Suite setup. In robot I had made a flag as well to run only if the condition satify. The flag is added becos , if any one wants to run the code in the same remote machine that would create various copies of it Object Map in the same machine.
My py code
'def copy_file_from_source_to_destination(self,src,dst):
try:
shutil.copy2(src, dst)
except Exception as e:
return str(e)
return 'Success' '
My robot keyword
'Get Central OR
${DESTINATION}= Catenate ${EXECDIR}${TARGET_OR}
Log ${DESTINATION}
${CALL_STATUS}= Convert To Uppercase ${CALL_STATUS}
Run Keyword If '${CALL_STATUS}'=='YES' Copy File From Source To Destination ${CENTRAL_OR} ${DESTINATION}

A bit late (I must have missed this question on SO),let me sum up above issue. RED does not know the value of variable. Variable can be modified during execution (either by testlogic,suite setups,variable files etc.) so any value assignments from Variable sections cannot be taken by RED to resolve parametrised path. The same applies to system variables such as ${EXECDIR} which can change depending where you start Robot execution and how robot command is constructed.
In another scenario, CI job, based on input parameters (for instance version or type of software to be tested with Robot) modifies variable in paths to use proper library or resource which is valid only for that version or type of software. Without VM mechanism,tester would have to temporary change suites with parametrised imports to direct paths just to be able to use proper imports (real world scenario in Nokia and the reason for VM in red.xml).
Therefore for any imports with variables in path, RED assumes that USER has to specify temporary valid values to be used during edit phase.
This is a reason for Variable Mappings in red.xml - allow to specify values of variables so any paths can be resolved thus allowing to import files.
There is also an entry in RED help (in application and on github):http://nokia.github.io/RED/help/user_guide/working_with_RED/variable_mapping.html
Warning regarding "something is outside Project/Workspace" - a warning which may help to understand why tests are not working when they were checkout from repository on different machine. Any Errors/Warnings can be changed in Windows->Preferences->Robot Framework -> Error/Warnings
Help topic: http://nokia.github.io/RED/help/user_guide/validation/validation_preferences.html
If you have any questions or issues,please create those on issue tracker on RED GitHub project: https://github.com/nokia/RED/issues
RED PM

Related

Eclipse - Problem Occurred using actual vs Project directory reference

Using Eclipse 2020 with 2 different Projects. Each Project has their own Workspace.
Workspace1/Project1 Run as expected.
Workspace2/Project2 generates the following error indicating an inability to find MyJarFile.jar:
All the Build values are the same, but when comparing the Dependencies between the working and failing environment I noticed the following.
The working environment shows reference to MyJarFile.jar as an actual path reference.
The failing environment shows reference to MyJarFile.jar as a reference via the Project Name.
The strange thing is when I first Add MyJarFile.jar it shows the actual path name, but after closing and reopening the Dependencies tab, it converts the \MyProject\ reference.
In both scenarios it has been confirmed the file exists.
Also, the addition of the File was done using the dialogbox so that also confirms it exists.
Questions:
1 - Is there a setting which dictates when the actual directory reference is shown and when the \Project\ reference is used?
2 - When the \Project\ reference is used, is there an extra step required so the associated file is actually found?

Codemagic - Set Dynamic Environment Variables for the Build arguments

I am looking a way to manage dynamic environment variables in my build arguments.
I am able to make it work if I define values for TARGET_FILE and FLAVOR in the environment variable section in CodeMagic.
But my goal is to have the values specified in my git repository. So I will be able to change it and have a dynamic build.
I was thinking I would be able to set the env var in the pre-build section.
Following is a sample of my pre-build.sh file
# in my case it’s `dev`, `qa` and `prod`
export FLAVOR='qa'
# major and minor part of app version e.g. 1.0
export VERSION_NUMBER='1.0.0'
# this is the entry point of the app e.g. main_dev.dart
export TARGET_FILE="lib/main_$FLAVOR.dart"
My build is still failing because the TARGET_FILE for example is not specified
Target file "--flavor" not found.
Build failed :|
Failed to build for Android
I was wondering if anyone has ever encountered this scenario
As for configuring build from GitHub you can use codemagic.yaml file that allows you to define the configuration for CodeMagic build, including env variables (here is a docs).
Additional notes, just a proposition))
I actually don't know what is going on in your Flavors and env entry points, but quite possible you can actually get rid of both.
For instance, you can use .env file and flutter_config package to pass env specific variables to the native layer, including plist's and Gradle. Also, you can load this .env file into Dart code and use variables from it. On top of this, you can use this package to generate .env file with the terminal command (if you don't want to create any sh scripts))). Alongside with .env file, it can generate Dart class specifically for Dart code. It also can generate files based on global env variables.
In that way all environment specific configuration will be defined once, you won't expose your prod credentials anywhere except build tool and you won't need to copy/paste multiple entry points.
Update 08/05/2020:
Starting from Flutter 1.17 you can use --dart-defines argument instead of environment_config and flutter_config package to define compile-time variables. You can read more about this argument here

Added a command-line target to my Swift app, but it does not see the rest of the project

I originally created my project using Xcode's templates for iOS, and then arranged my files into "core" logic and "iOS" GUI. core contains a single file, Game.swift.
Now I've added a CLI target as well. However, the CLI target doesn't seem to "see" the files in core, and when I try to init the main object, I get:
Use of unresolved identifier 'Game'
I assume this is because adding a target after-the-fact failed to set up a Search Path or similar in the target, but I'm looking around and don't see anything obvious.

How can I get labels of a sub folder under a team project using command line tool TF.exe?

We have TFS version control in which the following folder structure is adopted.
The following is the folder structure that we use:
In the above image, delta is the TFS server name, TempProjects is the project collection and DetBarShapeEngine is one of the team project. Main is the branch name and ProjectSource is a special folder under which all files managed by development team are stored. We label at the ProjectSource level and hence it is a kind of root folder for every project source.
When I ran tf labels /collection:"https://delta:443/tfs/TempProjects" /owner:*, I saw a huge list of labels from all the project collections including DetBarShapeEngine.
I modified the above command line to include the team project in the project collection URL tf labels /collection:"https://delta:443/tfs/TempProjects/DetBarShapeEngine" /owner:*, I receive:
TF31002: Unable to connect to this Team Foundation Server .... ....
Technical information (for administrator): The remote server returned
an error: (404) Not Found.
I tried increasing the depth of the path of the project collection URL till ProjectSource, but I still get the same 404 error.
Question:
How do I get labels of a sub folder under a team project?
Note:
I cannot change this folder structure for any reason what so ever.
We use TFS 2013.
After struggling a lot, I stumbled on a blog showing sample about using scope in some other command. I tried to use that scope string to TF labels command and it was a success!
Here is the command line that I used:
tf labels /collection:"https://delta:443/tfs/CadsProjects" *#$/DetBarShapeEngine/Main/ProjectSource /owner:*

How to upload Parent child SSIS package to server

Hi all I am very new to SSIS. I have got SSIS package developed by some other guy this package reads data from flat files and stores to database after mapping.
Flow:
1) First package extract records from flat file and stores in table.
2) Then it calls child package using Execute package tasks.
3) Then child package do some calculations and update the database table.
SSIS is using Environment variable to get database information.
Every thing is working fine but now I want to deploy this package to my client's server.
Ques: Do I need to copy and paste files from bin folder and paste on clients machine?
What I Tried: I copy files from bin folder and placed on my local computer. Then I create a job in MSSQL and run the job. Package runs perfectly. But Later I changed location of my project and problem starts job stops working.
Issue: Error says location of child package is not available(As I changed position of my project files)
Kindly suggest what to do.
I am going to make several assumtions here so please correct me if I get any wrong.
The problem I am guessing is that on your Package.dtsx within the connection manager this is currently linked to the package location within the project folder. In this case you are wanting to change it to another location, however the package in the connection manager is still pointing to the project location.
If I were you I would do the following:
Create a string variable
PackageFolderPath - C:\CurrentPackagePath\DBPackage.dtsx
Now what you want to do is go to the package within the connection manager and under the properties add an expression for ConnectionString with the following: “#[User::PackageFolderPath] If you evaluate the expression it should give you the location you setup in your variables.
Please note however that if you want this to work on the development system then setup the package to the project location.
Now once you have those setup, copy the files across the new server and under the SQL agent job to go the Set Values tab and within here you want to add the following:
\Package.Variables[User::PackageFolderPath].Properties[Value]
Under the value you want to put wherever the package is now located
This now should pickup the new location of the package when it is run.
A better way to do this would be to make use of the deployment utility and using an XML configuration variable on the package. However this way should work.