As we know Apple introduced UITesting with Xcode 7. I have added the XCTestCase in my app and can rub the test via Xcode.
Is there any way i could run the test through terminal? eventually i would like my build server to run the tests for me.
Thanks
I use this:
xcodebuild test -project path/to/<project name>.xcodeproj/ -scheme <scheme> -destination 'platform=iOS Simulator,name=iPhone 6' ONLY_ACTIVE_ARCH=YES
Adjust accordingly.
I tried xctool, but ui tests didn't work, so I switched to xcodebuild
Related
I'm running security scan with Snyk CLI for python project. Unfortunately snyk test command returns Failed to test pip project error. What am I missing, snyk test works just fine while scanning npm project ?
$ snyk test --file=requirements.txt
Failed to test pip project
I found the cause basically you need to do two things:
Make sure that packages that your project uses are installed.
Make sure that you are using correct python.
Solution
$ pip3 install -r requirements.txt
$ snyk test --file=requirements.txt --command=python3
Info
You can bypass missing python packages by passing the --allow-missing pip parameter through snyk by using the additional -- argument.
$ snyk test --file=requirements.txt --command=python3 -- --allow-missing
Docs
-- [COMPILER_OPTIONS]
Pass extra arguments directly to Gradle or Maven. E.g. snyk test
-- --build-cache
Python options
--command=COMMAND
Indicate which specific Python commands to use based on Python
version. The default is python which executes your systems de-
fault python version. Run 'python -V' to find out what version
is it. If you are using multiple Python versions, use this pa-
rameter to specify the correct Python command for execution.
Default: python Example: --command=python3
snyk monitor command will also return undefined if it is not ran with
pip3 install -r requirements.txt
snyk test --file=requirements.txt --command=python3
snyk monitor --file=requirements.txt --command=python3
If you are using Snyk and VScode, and you open a repo that has a Python VirtualEnv, you can get this error in your VScode terminal window.
[Error] Open Source Security test failed for "/home/{user}/path/to/repo". Failed to test pip project
Fix for VScode:
Close that VScode window.
From a terminal, navigate to the top folder of that repo.
Run the command to activate the virtual env
Example: . .venv/bin/activate
Open VScode for that folder
Example: run code .
The Snyk Open Source Security test should run without that error now.
If you are using virtual environments, then make sure you have activated the venv with
. venv/Scripts/activate
Then try running Snyk Test again.
Snyk monitor and other cli commands should work from that! :)
I tried a lot of things I read on documentations or tutorials... But I still can't cross-compile Qt with the MySQL library driver. Story begins:
I have to cross-compile Qt from Linux to Windows (32bits) using MinGW (i686-w64-mingw32- prefix to be precise). I downloaded qtbase-opensource-src-5.9.4 and started to work like that:
$ ./configure -prefix [...]/qt-5.9.4 -xplatform win32-g++ -device-option CROSS_COMPILE=/usr/bin/i686-w64-mingw32- -opengl desktop -no-sql-odbc -sql-sqlite -enable-shared -nomake examples -nomake tests -release
And it worked. Then, make and make install worked too. But I figured out that there was only the SQLite ".dll" in the plugins/sqldrivers repository. So I tried to compile the MySQL driver and... How can I do that?? If I add -sql-mysql to my ./configure ... call, I have to following error:
ERROR: Feature 'sql-mysql' was enabled, but the pre-condition 'libs.mysql' failed.
I downloaded MySQL library from the official website to get mysql-5.7.21-win32.zip. But how to link it with qtbase sources? Adding MYSQL_INCDIR=[...]/mysql-5.7.21-win32/include and MYSQL_LIBDIR=[...]/mysql-5.7.21-win32/lib or just MYSQL_PREFIX=[...]/mysql-5.7.21-win32 to my ./configure ... command results to the same error message.
Any idea please?
EDIT:
I tried to compile the driver like that (with the qmake I built previously):
$ cd qtbase-opensource-src-5.9.4/src/plugins/sqldrivers/mysql
$ [/*prefix of my previous build*/]/qt-5.9.4/bin/qmake .
And the result is:
Project ERROR: Library 'mysql' is not defined.
Ok everyone, I found the solution: do a clean checkout or add -recheck-all to the ./configure command when you want to add a lib like MySQL in my case. Easy isn't it? To make it clear, here is the command I used:
./configure -prefix [...] -xplatform win32-g++ -device-option CROSS_COMPILE=/usr/bin/i686-w64-mingw32- -opengl desktop -no-sql-odbc -sql-sqlite -plugin-sql-mysql MYSQL_PREFIX=[...] -enable-shared -nomake examples -nomake tests -release -recheck-all
That was just a refresh problem, but I prefer to let this answer because it's pretty hard to realize.
Instead of what you tried in your EDIT, should I think be:
$ cd qtbase-opensource-src-5.9.4/src/plugins/sqldrivers
qmake -- MYSQL_PREFIX= [...]/mysql-5.7.21-win32/include
when I execute the command “pod update”,I found some problems in this process.The detail information is as follows.
$ pod update
Update all pods
Updating local specs repositories
CocoaPods 1.1.0.beta.1 is available.
To update use: gem install cocoapods --pre
[!] This is a test version we'd love you to try.
For more information see http://blog.cocoapods.org
and the CHANGELOG for this version http://git.io/BaH8pQ.
Analyzing dependencies
sh: line 1: 4173 Segmentation fault: 11 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find xcode-select 2> /dev/null
xcrun: error: unable to find utility "xcode-select", not a developer tool or in PATH
Downloading dependencies
Using AFNetworking (3.1.0)
Using MJExtension (3.0.12)
Using ReactiveCocoa (2.1.8)
Using SDWebImage (3.8.1)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There are 4 dependencies from the Podfile and 4 total pods installed.
$
I was struck by the problem very long .I hope for your help!Thank you in advance!
opened Xcode.
Preferences
Locations
Selected the Command Lin Tools
credit : http://www.jianshu.com/p/6b56aba2ee05
I am using Xubuntu 15.04. I tried to run a basic console app using MonoDevelop, the latest one. I did a new project and this appears when I try to debug it:
Could not connect to the debugger
I googled for answers and I found out that there is a problem with the gnome-terminal, that it no longer accepts the --disable-factory argument and something about unchecking the "Run on external console". I unchecked that and when I press to run, it closed it immediately.
Try executing MonoDevelop as sudo
$ sudo monodevelop
It takes Xterm as output terminal emulator.
EDIT
Run Monodevelop as root can be a BIG mistake.
Best way is to write an script that unsets GNOME desktop session and run monodevelop, as Oskar says.
Try this one (copy and paste it on vim/nano and save as monodevelop.sh)
#!/bin/bash
unset GNOME_DESKTOP_SESSION_ID
monodevelop
Put it on your home (for example) and give it execution permissions:
chmod +x ./monodevelop.sh
When you want to run it, execute ./monodevelop.sh. Or you can add it as GNOME shell application following this guide.
I am having trouble getting chromedriver on Travis-CI working for my project knockout-secure-binding. I am trying to use WebdriverJS to automate testing with Chrome, at the least.
I noted that there seems to be some issues with chromedriver on Travis-CI, including:
http://github.com/travis-ci/travis-ci/issues/938
http://github.com/travis-ci/travis-ci/issues/272
https://code.google.com/p/chromedriver/issues/detail?id=308
The issue seems to be a variant of "chrome not reachable", and from what I can gather it requires an upstream engagement by Google to fix it.
The details of the error are available through the Travis build log.
No workaround is apparent, though one comment mentioned using --no-sandbox, but it is not clear where or how one would employ this in WebdriverJS.
Any thoughts on this would be sincerely appreciated.
—— Edit ——
As a matter of interest I am using Sauce Labs in lieu of Chromedriver.
There's an easier way to launch Chrome on Travis CI, simply specify google-chrome in addons/apt/sources and google-chrome-package in addons/apt/packages.
Here's my sample config for a better understanding:
sudo: required
dist: trusty
addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
language: node_js
node_js:
- "6"
cache:
directories: node_modules
branches:
only: master
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- npm i -g npm#^3
- sleep 3
I think Travis does support chrome driver, if you add these in your travis.yml, extract the right chromedriver and unzip it to a known location, so that you can trace it later.
before_script:
- wget http://chromedriver.storage.googleapis.com/2.10/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip -d /home/travis/virtualenv/python2.7.9/
- export CHROME_BIN=chromium-browser
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3
Plus when you call selenium or any testing automation library, you would need to add this the code here is in Python but this can be done in Java and Ruby as well.
options = webdriver.ChromeOptions()
options.binary_location = '/usr/bin/chromium-browser'
#All the arguments added for chromium to work on selenium
options.add_argument("--no-sandbox") #This make Chromium reachable
options.add_argument("--no-default-browser-check") #Overrides default choices
options.add_argument("--no-first-run")
options.add_argument("--disable-default-apps")
driver = webdriver.Chrome('/home/travis/virtualenv/python2.7.9 /chromedriver',chrome_options=options)
EDIT: As of October 2018, Travis CI is slowly moving away from containers (see official announcement). Therefore, one can omit sudo: false, but the given ChromeDriver setup still works.
If you want to use a container-based environment (fast boot time but no sudo), you can also do it as follows (include language and so forth accordingly):
dist: trusty
sudo: false
addons:
chrome: stable
apt:
packages:
- chromium-chromedriver
before_script:
# include ChromeDriver in PATH
- ln --symbolic /usr/lib/chromium-browser/chromedriver "${HOME}/bin/chromedriver"
# start Chrome and listen on localhost
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
Afterwards, as you already mentioned, add --no-sandbox to your Chrome options (taken from this gist):
var webdriver = require('selenium-webdriver');
var chromeOptions = {
'args': ['--no-sandbox']
};
var chromeCapabilities = webdriver.Capabilities.chrome();
chromeCapabilities.set('chromeOptions', chromeOptions);
var driver = new webdriver.Builder().withCapabilities(chromeCapabilities).build();
This is due to an issue in Travis CI. However, if you need sudo anyway or have a long-running build where a container-based environment makes only limited sense, you can also set sudo: true and omit adding --no-sandbox.
Additional resources:
Google Chrome addon on Travis CI
GUI and headless browser testing on Travis CI
How to make travis execute Angular tests on Chrome ("Please set env variable CHROME_BIN")