Robot framework resource file not found - testing

I want to use a resource file with the name clean_environment.robot on windows. It is in the same folder like my robot file (C:\Users\xxxxx\Desktop\git\src), which is callig the resource file.
Basic file 30.robot:
** Settings **
Resource clean_environment.robot
** Test Cases **
MyTestCase
Clean environment
I get the error:
[ ERROR ] Error in file
'C:\Users\xxxxx\Desktop\git\src\30.robot':
Resource file 'Clean environment' does not exist.
The resource file:
*** Settings ***
*** Test Cases ***
Clean environment
Log to console 111
Edit:
The computer said: Resource file 'Clean environment' does not exist! But 'Clean environment is not the resource file, it is the keyword right?

If the file has a test case in it, it is not considered to be a resource file by robot. Resource files can only have keywords, variables and settings.
If you expect Clean environment to be a keyword, put it in a keyword table:
*** Keywords ***
Clean environment
Log to console 1111

Related

Read configuration values in robot framework

I have a robot framework test automation product that runs in a docker container. All the configurations for the project are written in a .env file and all works perfectly in the docker environment.
Wat I want is to run this project out side the docker environment(in my laptop using VS code or any other supported IDE). But I don't know how to set the configuration environment when I run the project out side the docker environment.
Can someone please tell me the best way of doing this.
I found the soultion.
1.You create .env file as below and put all of your environment variables as below. This is the environment file that you are going to push in to the docker container.
HOST_ADDRESS="https://192.168.0.15"
DEFAULT_PORT="8056"
2.Create .yaml file called LocalConfig.yaml and place all your local configuration in that file as below.
LOCAL_HOST_ADDRESS: "https://192.168.0.10"
LOCAL_DEFAULT_PORT: "8055"
3.Create .resource file called Config.resource and read all the environment variables from the OS environment using % character and if the environment variable is not found in the OS, you can set the default value which is defined in the LocalConfig.yml file as below.
*** Settings ***
Variables LocalConfig.yaml
*** Variables ***
${CONFIG_HOST_ADDRESS} %{HOST_ADDRESS=${LOCAL_HOST_ADDRESS}}
${CONFIG_PORT} %{DEFAULT_PORT=${LOCAL_DEFAUL_PORT}}
4.Then you can reference this Config.resource file in any of your .robot files and retrieve the configuration values.
Example:
*** Settings ***
Resource ../Config.resource
*** Variables ***
*** Test Cases ***
Retrieve env variable Test
Log To Console ${CONFIG_HOST_ADDRESS}

Laravel migrate error

I have a weird error when I lunch any migrate command (reset refresh rollback etc..), the error is :
[ErrorException]
session_start(): open({APACHEPATH}/sessions\sess_0pb5924dau2oehuo4h32lqnem3
, O_RDWR) failed: No such file or directory (2)
PHP Fatal error: Uncaught exception 'ErrorException' with message 'Unknown: ope
n({APACHEPATH}/sessions\sess_0pb5924dau2oehuo4h32lqnem3, O_RDWR) failed: No such
file or directory (2)' in Unknown:0
Stack trace:
#0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handle
Error(2, 'Unknown: open({...', 'Unknown', 0, Array)
#1 {main}
thrown in Unknown on line 0
PHP Stack trace:
PHP 1. {main}() C:\UwAmp\www\project\artisan:0
The session id
sess_0pb5924dau2oehuo4h32lqnem3
differs is different each time, so I went to the apache sessions folder (C:\UwAmp\bin\apache\sessions) and that session id was not present.
I should mention that this problem occurred while installing the Tracker package , somehow during the process i can't migrate anymore, any ideas ? Thank you.
I definitely think your php.ini's session.save_path is not configured correctly, especially as I'm seeing a forward slash "/" in the path to the directory to save sessions in within your error message.
Try this:
Create a new file within your Laravel install called info.php with just a call to phpinfo().
Navigate to info.php. Under "Loaded Configuration File", find the path to the loaded php.ini file and open it in your favourite text editor.
Add / change the following line: session.save_path = C:\wamp\temp\ - assuming that this is the correct path to the temp folder and it actually exists on your system. Do a bit of research to determine where this directory lives and adjust accordingly, and make sure that the path uses "\" and not any "/".
Restart WAMP and try to run your migrations again.

SonarQube Runner fails on a file having comma in its name

SonarQube: 5.2
Scanner For MSBuild: 1.0.2
Below line exists in FilesToAnalyze.txt deep inside .sonarqube folder
...Help\User\Duplicating,_Renaming,_Deleting_a_Blueprint.htm
And, MSBuild.SonarQube.Runner.exe end throws below exception. Notice how file name is truncated just before first comma in file name.
Caused by: java.lang.IllegalStateException: The folder 'C:\<full\path>\Help\User\Duplicating' does not exist for '<sonar:key>:509A1B17-E264-4DF5-99FC-AF27D064FBC4' (base directory = <dir containing .sonarqube>)
I decided to exclude the folder containing Help\User\ by passing /d:sonar.exclusions="**\<parentDir>\Help\**". This has no effect.
Is there an issue in Sonar Runner if file names contained comma?
Why doesn't sonar.exclusions have any effect?
Finally, log message states ERROR: Re-run SonarQube Runner using the -X switch to enable full debug logging. How do I pass -X switch to Sonar Runner from MSBuild.SonarQube.Runner.exe. Is it in the begin command or end command?
This is indeed a known issue.
Please refer to https://jira.sonarsource.com/browse/SONARMSBRU-199 for details as to when it will be fixed.

Robot framework "resource file not found" error

I have designed this architecture where all the test cases will be in Amazon.robot file and all low level keywords for robot framework will be in two separate files(AmazonGui.robot and Commons.robot)
Amazon.robot file that has all the test cases:
*** Settings ***
Documentation This is some basic infor the whole suite
Resource Resources/AmazonGui.robot
Resource Resources/Common.robot
*** Variables ***
*** Test Cases ***
User must sign in to check out
[Documentation] This is some basic info about test
[Tags] Smoke
Common.Begin Web Test
AmazonGui.Search for Products
AmazonGui.Select Product from Search Results
AmazonGui.Add Product to Cart
AmazonGui.Begin Checkout
Common.End Web Test
I have two other resources files that has the low keywords, so basically the test case(Amazon.robot) is calling the low level Keywords files(Common.robot and AmazonGui.robot). I have imported the Resources files to the test case file.
AmazonGui.robot file that has low level keywords for test cases
*** Settings ***
Library Selenium2Library
*** Keywords ***
Search for Products
go to http://www.amazon.com
wait until page contains Your Amazon.com
input text id=twotabsearchtextbox Ferrari 458
click button xpath=//*[#id='nav-search']/form/div[2]/div/input
wait until page contains results for "Ferrari 458"
Select Product from Search Results
click link css=#result_0 a.s-access-detail-page
wait until page contains Back to search results
Add Product to Cart
click button id=add-to-cart-button
wait until page contains Added to Cart
Begin Checkout
click link id=hlb-ptc-btn-native
page should contain element id=signInSubmit
Common.robot file that has common features just opening and closing browser
*** Settings ***
Library Selenium2Library
*** Keywords ***
Begin Web Test
open browser about:blank ff
End Web Test
close browser
When I am trying to run the script from terminal using :
C:\development\robot-scripts\amazon>pybot -d results tests/amazon.robot
I get the below error:
[ ERROR ] Error in file 'C:\development\robot-scripts\amazon\tests\amazon.robot': Resource file 'Resources\AmazonGui.robot' does not exist.
[ ERROR ] Error in file 'C:\development\robot-scripts\amazon\tests\amazon.robot': Resource file 'Resources\Common.robot' does not exist.
==============================================================================
Amazon :: This is some basic infor the whole suite
==============================================================================
User must sign in to check out :: This is some basic info about test | FAIL |
No keyword with name 'Common.Begin Web Test' found.
--------------------------------------------------------
Amazon :: This is some basic infor the whole suite | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
Not really sure, where I should look to find out the issue.
You have your test cases inside a folder called tests. The Resource files are present in a different folder called Resources.
When you give
Resources/AmazonGui.robot
It will check for a directory named Resources in the directory tests, but actually the directory is present outside the tests directory.
../Resources/AmazonGui.robot
Here you are asking the framework to come outside of the tests directory and check for the directory named Resources.
This issue is do not set the right path for resource files. Try this codes replace old:
Resource ../Resources/AmazonGui.robot
Resource ../Resources/Common.robot

Index Sources & Publish Symbols step fails in TFS 2015

By default TFS Build creates a "Index Sources & Publish Symbols" step in a Visual Studio Build definition. When the step's property "Path to publish symbols" is empty, everything works fine. But when setting the path to a local directory, the step generates the following error:
2015-09-25T11:00:09.7991491Z Executing the powershell script: C:\NewAgent\tasks\PublishSymbols\1.0.4\PublishSymbols.ps1
2015-09-25T11:00:10.0022755Z Find-Files -SearchPattern **\bin\**\*.pdb -RootFolder C:\NewAgent\_work\990dcb3f\Projects
2015-09-25T11:00:10.0491548Z Found 15 files to index...
2015-09-25T11:00:10.0491548Z Invoke-IndexSources -RepositoryEndpoint <repositoryEndpoint> -SourceFolder C:\NewAgent\_work\990dcb3f\Projects -PdbFiles <pdbFiles>
2015-09-25T11:00:10.6272794Z Invoke-PublishSymbols -PdbFiles <pdbFiles> -Share C:\DebugSymbols -Product EntityMapper -Version 20150925.14 -MaximumWaitTime 7200000 -MaximumSemaphoreAge 1440 -ArtifactName
2015-09-25T11:00:10.7348541Z ##[error]Can't infer artifact type from artifact location C:\DebugSymbols.
2015-09-25T11:00:10.7504779Z
2015-09-25T11:00:10.7504779Z Start: AssociateArtifact
2015-09-25T11:00:10.7504779Z ##[error]Artifact Type is required.
2015-09-25T11:00:10.7504779Z End: AssociateArtifact
The pdb files are published to the specified directory, so i don't really understand what is causing the error (which then causes the whole build job to fail).
When the step's property "Path to publish symbols" is empty, everything works fine.
Yes, because if symbols path is not set, the script only index sources, not publishing symbols.
But when setting the path to a local directory, the step generates the error
You need prepare your symbol store. In your case setup folder sharing and permissions.
In my case changing the "Path to publish symbols" from
//myserver/symbols
to
\\myserver\symbols
solved the issue. Don't know why this happend to me but ok... :)