Working on automated testing for work and the bosses wanted something simpler than straight Python with Selenium. So we've gone with Robot Framework to simplify the test case creation.
My issue is that until today my keyword auto completion was working just fine in Sublime text 3. I was working on adding Appium and the Appium library to that auto completion and then it stopped working. I have tried reverting to my original state but something seems to be missing or not working and I can't tell what. I do know the "create database" command for Robot Framework Assistant is upset based on the sublime console. Can anyone tell me what I might be missing?
My current PATH
The errors in Sublime console
This is the contents of the log file in the database directory mentioned in the sublime console. I have done a pip install finder but that didn't seem to fix anything:
Traceback (most recent call last):
File "C:\Users\kepperson\AppData\Roaming\Sublime Text 3\Packages\Robot Framework Assistant\dataparser\run_scanner.py", line 9, in <module>
from queue.scanner import Scanner
File "C:\Users\kepperson\AppData\Roaming\Sublime Text 3\Packages\Robot Framework Assistant\dataparser\queue\scanner.py", line 7, in <module>
from finder import finder
ImportError: cannot import name 'finder'
My plugin settings:
/*
Robot Framework Assistant default settings
/*
Sublime settings to make Robot Framework data editing more
clearer and easier. Refer the Sublime default settings for
more details.
*/
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"draw_white_space": "all",
/*
Same as the Sublime default in Build 3103 with one exception,
it does not contain the * character. When the * is not in
word_separators the snippets containing * in tabTrigger
work out of the box.
If * is needed as a word separator, then the snippets
should be accessed by pressing tab key multiple times.
*/
"word_separators": "./\\()\"'-:,.;<>~!##$%^&|+=[]{}`~?",
/*
Robot Framework Workspace
Defines a root folder where Test Suite located.
Before the Robot Framework Assistant can provide the keyword
and variable completion features, it needs to scan and index
the test suite and resource files. The argument defines the root folder
where scanning of robot data is performed.
In windows the backslash is the folder separator and in json
backslash is the escape character. Therefore, in windows write
double backslash to write literal backslash.
Linux example: "/home/User/myRobotTests"
Windows example: "c:\\Users\\User\\Desktop\\myRobotTests"
*/
"robot_framework_workspace": "c:\\sq_automation\\test_cases",
/*
Defines how keyword argument are formatted when keyword
completion is used. When set to false, each argument is
formatted to individual lines. If set to true keyword
and arguments are returned in single line.
*/
"robot_framework_keyword_argument_format": true,
/*
File extension defines which types of files the Robot Framework
Assistant plugin will search and index from the folder defined
in the robot_framework_workspace option.
This setting does not affect to the which files are uses the
syntax highlight.
*/
"robot_framework_extension": "robot",
/*
Path to Python binary
In order the scanning and indexing of keywords and variables to
work, path to Python binary must be defined. It must be the same
Python binary where the Robot Framework is installed.
In Linux like environments this could be like: /usr/bin/python
and in Windows this could be like: C:\Python27\python.exe
*/
"path_to_python": "c:\\python36\\python.exe",
/*
Module search path defines a list of paths where the
Robot Framework libraries are searched. Example if you have imported
a library with the library name, then module search path must
contain the folder where the library can be located.
The Robot Framework Assistant uses the Robot Framework API to parse
the test data and libraries. All changes, which are not system
wide, to locate the libraries, must also be added in the
module search path in the Robot Framework Assistant
More details how libraries is searched in Robot Framework can be
found from be the Robot Framework User guide:
http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#module-search-path
*/
"robot_framework_module_search_path":
[
"c://sq_automation"
],
/*
Automatic database update on saving file
The robot_framework_automatic_database_update setting controls the
internal database updating. If the set to true, the internal
database table and index are created after a Robot Framework test data
file is saved. If set to false, the internal database tables are
only updated when the `Create Database`, `Create Database Tables`
or `Update Internal Database For Active Tab`
commands are run.
The setting only controls the Robot Framework test data. If a
libraries or a variable files are updated, then `Create Database`,
`Create Database Tables` or `Create Database Table From Active Tab`
commands must be run to update the internal database.
*/
"robot_framework_automatic_database_update": true,
/*
Robot Framework libraries in XML
When the library is not available during parsing time,
example if library is imported with Remote library interface.
Then this setting can be used to import libraries in libdoc XML
format.
Libraries found from the this path are globally available, in
same manner as the BuiltIn library
*/
"robot_framework_libraries_in_xml": "/path/to/library/documentation",
/*
Robot Framework variables
Robot Framework comes by default some predefined and built in
variables. These variables names may change between different
Robot Framework versions. Use this setting to define the
Robot Framework default variables.
The variables in the default settings are from Robot Framework
version 2.9.2
*/
"robot_framework_builtin_variables":
[
"${/}",
"${:}",
"${\\n}",
"${CURDIR}",
"${DEBUG_FILE}",
"${EMPTY}",
"#{EMPTY}",
"&{EMPTY}",
"${EXECDIR}",
"${False}",
"${LOG_FILE}",
"${LOG_LEVEL}",
"${None}",
"${null}",
"${OUTPUT_DIR}",
"${OUTPUT_FILE}",
"${PREV_TEST_MESSAGE}",
"${PREV_TEST_NAME}",
"${PREV_TEST_STATUS}",
"${REPORT_FILE}",
"${SPACE}",
"${SUITE_DOCUMENTATION}",
"${SUITE_NAME}",
"${SUITE_SOURCE}",
"${TEMPDIR}",
"${TEST_DOCUMENTATION}",
"${TEST_NAME}",
"${True}",
"&{SUITE_METADATA}",
"#{TEST_TAGS}"
],
/*
Path to internal database
By default internal database is created in plugin installation
directory, in database folder. Sometimes it could be useful to
change the default database location.
Example if the robot_framework_workspace is defined in the
Sublime workspace file and user wants to change between
different projects. Then it is useful to define
robot_framework_database_path setting also be project specific.
When the internal database is project specific, user does not
recreate the database when the project is changed.
The robot_framework_database_path must be a path to a folder.
If the setting is not path to a folder, then the database
is created in the plugin installation directory.
*/
"robot_framework_database_path": false,
/*
Sublime Text log_commands
This setting controls will the 'Robot Framework: Command Logging'
command enable or disable the Sublime Text log_commands API call.
If the robot_framework_log_commands setting evaluates as Python
True, then log_commands API call is enabled. If setting
evaluates as Python False, log_commands API call is disabled.
If log_commands API call is enabled. all commands run from key
bindings and the menu will be logged to the console.
*/
"robot_framework_log_commands": false
If there is more information required I will do my best to acquire it.
In perfect me style, I see that my path for "robot_framework_module_search_path": uses // instead of \\ So this is solved and I'm stupid.
Related
I am new to Odoo. I am using Odoo 10. I would like to write test cases for a new wizard I created under a module A. I put all my wizard code (views + models) inside wizards directory. I created unit test cases under the path <<module/tests>> followed all the file/class/method naming conventions. When I try to upgrade the module (with test enable) to run unit test cases, all the other modules tests scripts are run but not for the newly created module A. Please suggest what additional changes might be needed to enable test scripts for a newly created module with wizard.
Thank you.
I believe that the structure you have follow is according to the standard way. You can find the structure here Testing Module Structure.
Also please check that the naming on the folder and file in which you wrote the code,
for example - tests/test_todo.py Also, don't forget to update the import in tests/init.py to from. import test_todo
This is because Odoo expects the test module names to start with test_ when it searches for tests belonging to a module Code Reference
Command to Run the testcases:
python ./odoo.py -i module_to_test --log-level=test -d your_database --db-filter=your_database --test-enable --stop-after-init
In my C++ application, I have a text file (dataFile.txt) that is installed on the Linux target machine in the following path:
/SoftwareHomeDir/Configuration/Application/dataFile.txt
This file exists on my Rational ClearCase source code environment under the path:
/ProjectName/config/Application/dataFile.txt
I am developping a unitTest in gtest that does following:
Read a specific data from dataFile.txt , if the data does not exist than write it into the file.
1) I am avoiding to create an environment variable to check whether I am in the compilation environment or the target machine. Then add additional test code in the final release. I really want to separate test code from final code.
2) I am not using any IDE (no visual studio, no qt, etc.), just notepad++
3) The compilatio. server is shared (access with a username, however the root folder "/" is shared. Which means that if I create the path "/SoftwareHomeDir/Confiugration/Application/dataFile.txt", it will be visible by all users, and if another user is running his gtest unitTest, he may overwrite my file.
4) In the final code, the path to the dataFile is hard coded, and it is very costly (will take few seconds to run) to implement a filesearch(filename) method to look for the file in the entire hard drive before reading the file.
Question:
I am looking for a solution to unit-test my code in the compilation environment that is using /ProjectName/config/Application/dataFile.txt
The solution to my problem was to combine gmock with gtest as described by the link
https://github.com/google/googletest/blob/master/googlemock/docs/CookBook.md#delegating-calls-to-a-fake
The only modification I made to my code is that instead of defining the path to the configuration data using #define, I created a function getConfigFilePath() that returns the hardcoded path of the configuration file in the installed application. From here, I mocked the class and in my mock, I call a fake getConfigFilePath() that returns, when the real code is executing, the hardcoded path of the config file in the project tree in ClearCase. This is precisely what I was looking for.
I am trying to write a Dropwizard application and its doc tells me that I need to ship everything as an uber jar.
However, in my application I need to support multiple databases and this requires multiple database JDBC driver jars in my classpath, all of which are not expected to be shipped together with my application. Users are expected to place the corresponding JDBC jar like mysql-connector-java-5.1.39.jar in a particular folder by their own.
After reading Dropwizard's documentation I am not sure if this kind of usage is supported. Does anyone have experience making it to work this way?
Since java 6, you can wildcard classpaths.
Using the application plugin, the generated bin folder will have a start script that contains the classpath. What we want to do, is to instead of listing every possible jar in the bin folder, we simply include all of them.
Note: You can also do the same thing with different folders if you want the classpath in a different location.
This can be achieved (in a workaround manner since there are problems with this plugin in my version) in the easiest way as follows. In build.gradle you do:
startScripts {
doLast {
def windowsScriptFile = file getWindowsScript()
def unixScriptFile = file getUnixScript()
windowsScriptFile.text = windowsScriptFile.text.replaceAll('CLASSPATH=.*', 'CLASSPATH=\\$APP_HOME/lib/*')
unixScriptFile.text = unixScriptFile.text.replaceAll('CLASSPATH=.*', 'CLASSPATH=\\$APP_HOME/lib/*')
}
}
This will wildcard your lib folder in the start scripts. When starting up, your classpath will simply be
lib/*
When you drop jars into that folder, they will automatically be picked up (on startup, not on runtime).
I hope this helps,
Artur
I have a basic App with QML Extension Library app setup with no changes except package identifiers and the similar (email, description, name).
Every time I open app/testApp.qml I get the following error:
Warnings while parsing QML type information of /var/lib/schroot/chroots/click-ubuntu-sdk-14.10-armhf/usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Components:
Failed to parse '/var/lib/schroot/chroots/click-ubuntu-sdk-14.10-armhf/usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Components/plugins.qmltypes'.
Error: /var/lib/schroot/chroots/click-ubuntu-sdk-14.10-armhf/usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Components/plugins.qmltypes:632:19: Expected string literal to contain 'Package/Name major.minor' or 'Name major.minor'.
/var/lib/schroot/chroots/click-ubuntu-sdk-14.10-armhf/usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Components/plugins.qmltypes:633:36: Expected array literal with only number literal members.
In addition, and this may be entirely different, when I click the Design button, the system doesn't work and there's an error partially hidden by the right menu. The error is:
The problem is the qml plugin files required are not in the currently specified include directories listed on [projectName].qmlproject in the app project root directory.
I was testing on another project of a different type and I followed these instructions (the project was a QML project with a .qmlproject file).
It was near the bottom of the page, like this:
/* List of plugin directories passed to QML runtime */
importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml"]
I ran find / -name *qml* and found something that looked to be a suitable directory, with many items that had a good chance of being qml plugins, so I copied that directory, went to [projectName].qmlproject to the statement posted above and added the directory. The final importPaths statement looks like this:
/* List of plugin directories passed to QML runtime */
importPaths: [ "." ,"/usr/bin","/usr/lib/x86_64-linux-gnu/qt5/qml","/var/lib/schroot/chroots/click-ubuntu-sdk-14.10-armhf/usr/lib/arm-linux-gnueabihf/qt5/qml/Ubuntu/Components/" ]
After doing that, I could open the qml file in designer.
The effect also transferred to my other project, which does not have a .qmlproject file. I'm not sure why. I assume there's some kind of memory of the proper file, although I do not know the specifics.
I have created some Java applications to extend Rhapsody using Java API and I have deployed them successfully to the Rhapsody environment (Right click on the project -> Apps).
I can see the exported .jar files under the directory RhapsodyApps/apps.
My question is, How can I run them from the command line (Under windows 7)???
Thank you in advance
What I managed to do is to create a .bat file, using "Generate Apps Execution Batch File". As I mentioned in my last post it did not exist in the "Apps" menu of rhapsody. Besides, it existed in the "...\share\RhapsodyApps\apps" directory with the name "SynchronousScriptInvocation.jar". I hardcoded the RhapsodyApps.hep file, by adding the following:
#REM: This app generates a script which will invoke each app synchronously one after another. ...
name7=Apps\Generate Apps Execution Batch File
isPluginCommand7=1
command7=Apps
applicableTo7=Project,SysML,AUTOSAR_40,AUTOSAR_31,AUTOSAR_32,DDS,UPDM1_DoDAF20,UPDM2_DoDAF
isVisible7=1
I got the name (Generate Apps Execution Batch File) from the AppInfos.xml file.
Then, the plugin is displayed in the Apps menu in Rhapsody IDE, and I can generate the .bat file. Problems did not stop here. The batch file was not displaying my plugin and the reason was something with my JAVA_PATH configuration. Finally I modified the .bat file as following:
#rem This is auto generated script. Be careful on changing it manually.
#rem Build Order
set APP0=0df8829923eb43f4aab9d33ada1ddbf1
#set APPS= %APP0%
set JAVA_PATH=%JAVA_PATH%\bin\java
set JAVA_API=C:/work/User/Build.TRUNK/ProjectName/RhapsodyShare8/JavaAPI
set RhapsodyApps=C:/work/User/Build.TRUNK/ProjectName/RhapsodyShare8/RhapsodyApps
set CLASS_PATH="%RhapsodyApps%"/apps/RhapsodyAppLauncher.jar;"%RhapsodyApps%"/RhapsodyApps.jar;"%RhapsodyApps%"/apps.jar;"%JAVA_API%"/rhapsody.jar
"C:\Program Files (x86)\IBM\Rational\Rhapsody\8.0.5\jre\bin\java" -cp %CLASS_PATH% -Djava.library.path="%JAVA_API%" apps.RhapsodyLauncherApp %APPS%
Finally it works. I hope that this post will help somebody in the future.