No response from codeception - codeception

I am trying to run codeception against my Yii2 project. However, I can getting no response from the simplest command line invocations. The command just sits there, for hours, until I break it.
I have installed this codeception manually, using the official phar and placing it in my path. I also have a copy in my vendors directory. Both of them do no work.
#install
wget http://codeception.com/codecept.phar
cp codecept.phar /usr/local/bin/codecep
#any combination hangs
/usr/local/bin/codecep bootstrap
vendor/bin/codecept build
codecept run
codecept
In am running PHP 5.5, and installed the latest version of codeception from the project web site.

Can not speak for your specific installation of Yii2 (basic/advanced/custom/etc) but this works for myself and my team:
In composer.json of your project ensure the following lines exist:
"require-dev": {
"yiisoft/yii2-debug": "^2.0.0",
"yiisoft/yii2-gii": "^2.0.0",
"yiisoft/yii2-codeception": "^2.0.0",
"yiisoft/yii2-faker": "^2.0.0",
"codeception/codeception": "2.2",
"codeception/specify": "^0.4.3",
"codeception/verify": "^0.3.0"
}
In a CLI client (terminal/cmd/putty) run php composer install from the root of the project and ensure the packages install. Next check inside the ./vendor/bin dir in your project, do you see a file named 'codecept'? You should.
Next, check that ./tests directory exists; again at the root of your project. Inside that should be a file called codeception.yml This is the main configuration file codeception uses the begin the testing process(es). Without it nothing works.
Back in the CLI client run php ./vendor/bin/codecept run -c ./tests/codeception.yml. In the worse case this should provide some output from Codeception.

Try: www.pceuropa.net/blog/yii2-tests-codeception-configuration-first-test/

Related

Environment variables (zsh terminal) installed through npm on MacOS 12.4 Monterey - SOLVED

Background:
Dear Stackoverflow community. I recently switched from Windows to MacOS and am at a loss how to configure environment variables. Many of the previous questions asked here are about bash instead of zsh.
Goal:
I am trying to install an npm package globally. For instance:
npm install -g vercel
or any other package, and use it in my Visual Studio Code terminal (also zsh). If I want to deploy code I have to use 'npx vercel deploy' every time. I want to be able to use "vercel deploy" but instead I get:
zsh: command not found: vercel
What I tried so far:
Installing the package in zsh and visual studio code terminals (didn't work)
Setting the path equal on both VS and terminal: export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
I learned that you need to add environment variabels to a .zshrc file. I don't seem to have a zshrc file. When I do:
sudo ~/.zshrc
Password: XXXXXX
sudo: /Users/vincent/.zshrc: command not found
I am getting another error.
I read in the zsh man file that you should use $HOME/.zshrc instead. Again I am getting the same errors:
vincent#Vincents-MacBook-Air-2 ~ % $HOME/.zshrc
zsh: permission denied: /Users/vincent/.zshrc
vincent#Vincents-MacBook-Air-2 ~ % sudo $HOME/.zshrc
sudo: /Users/vincent/.zshrc: command not found
Update 1:
#slebetman Thank you for your explanation. When I open the terminal I go to home via "cd $HOME" which puts me in in the home directory. However there is no way for me to create a .zshrc file in that directory. Neither via touch or vs code. I am getting the following error: "Unable to write file '/home/.zshrc' (Unknown (FileSystemError): Error: ENOTSUP: operation not supported on socket, open '/home/.zshrc')"
Update 2:
I did manage to find the .zshrc file in visual studio code under /etc. I hope this will work. I was able to overwrite the file with Sudo and add environment variables to it.
Add this to the file .zshrc file under /etc and force overwrite it:
export vercel=/Users/vincent/.npm-global/bin/vercel
Screenshots below for those who will try in the future:
Image with .zshrc file layout
Final remarks:
I don't understand how it is so difficult to add environment variables on Mac while everything else is so easy.
I have read many different questions on stackoverflow, and I can't seem to solve it. Also since I am a newbie I am not allowed to comment on there so I post here in the hope that anyone can help me :)
Best,
Vincent
Note that when you do:
npx vercel deploy
Npm will execute vercel for you without installing it. It does that by temporarily downloading vercel. If you want to run vercel directly without using npx then simply don't use npx. Install it instead:
npm install -g vercel
The -g flag installs the module globally and if the module has a CLI it will be available globally as well (note that depending on your setup you may need admin/sudo privileges to use the -g flag). Now you can run vercel by simply typing:
vercel deploy
This works in all operating systems supported by node.js and npm. That means you can even do this in Windows. In fact I use npm to distribute my tools in a simple cross-platform way so I don't have to support multiple package managers like chocolatey (Windows), homebrew (Mac OS), deb (Debian based distros), rpm (Redhat based distros) etc. (npm does not require your software to be written in node.js - I have published packages on npm written in tcl and bash).

Botium informations are available but whats the happy path to setup up alexa skill starting point of Botium

What needs to be setup first then the second level what needs to be done .
Eg :
Install botium in vs code with package.json with dependencies
"chai": "^4.2.0",
"mocha": "^6.1.4",
"botium-bindings": "^2.0.13",
"botium-cli": "^0.0.50",
"botium-connector-alexa-avs": "^0.0.3",
"botium-connector-alexa-smapi": "^0.0.5"
2.In vs code Cmd ->node modules ->bin
botium-cli init
botium-cli run
3.Botium.json file is available in node modules-> bin
4.Add the required dependencies (sample botium.json file for alexa required)
5.Define test cases (The below is for IBM watson.Need the same for amazon alexa)
[https://chatbotsmagazine.com/5-steps-automated-testing-of-chatbots-in-eclipse-ef4c3dcaf233][1]
6.Setup Botium box (This i know in browser with npmjs steps i've done it)
7.Setup Botium-bindings(where does this happen in IDE like eclipse or vs code)
So a happy path of installation steps is required .Now all we have is raw information which can't be connected together to find the start and end point
https://chatbotsmagazine.com/5-steps-automated-testing-of-chatbots-in-eclipse-ef4c3dcaf233
First step, install Botium-CLI and connector:
> npm install -g botium-cli
> npm install -g botium-connector-alexa-smapi
> botium-cli init
> botium-cli run
Second step, connect your Alexa Skill to Botium by adapting the botium.json file. This requires multiple steps, all of them are described here (Install ask-cli, retrieve credentials, copy to botium.json).
For an introduction what Botium is and how to get started writing test cases, I recommend the Botium in a nutshell blog series.

Behat : No such file or directory

I just installed behat using Behat's install instructions #1
Every time I run bin/behat I am getting the following error:
bin/behat --init
: No such file or directory
How do I fix it? I am new to behat and don't know where to start.
Did you run bin/behat --init?
Make sure it's bin/behat and not vendor/bin/behat.
Have you configured your .yml file?
Run
bin/behat --init
If you have see all the step in 'Behat's install instructions #1', you just have now a folder bin in your main directory (where you have your composer.phar and composer.json files) and inside this bin file, you have a behat file.
Actually vendor/bin/behat it won't work because of this:
"config": {
"bin-dir": "bin/"
}
And this code will create the bin folder. Hope it works for you.

How can I build mapbox-gl.js with Browserify?

If I git clone the repo (from mapbox-gl.js repo), how can I build my own standalone version of the files?
I just need the standalone mapbox-gl.js, like this one.
A simple browserify js/mapbox-gl.js -o dist/mapbox-gl.js does not work.
I just added a section to the mapbox-gl-js readme on this topic.
Creating a Standalone Build
A standalone build allows you to turn the contents of this repository
into mapbox-gl.js and mapbox-gl.css files that can be included on
an html page.
To create a standalone build, run bash npm run production
Once that command finishes, you will have a standalone build at
dist/mapbox-gl.js and dist/mapbox-gl.css
I hope that helps! Let me know if you have any follow-up questions.
To create standalone files, run npm run build in root of repo.

Yii2: install codeception and phpunit with composer and use it

System: Win7 ,64Bit
I installed yii2 with composer. And I also tried to install codeception and phpunit by composer using these commands
composer global require "phpunit/phpunit=4.3.*"
composer global require "codeception/codeception=2.0.*"
composer global require "codeception/specify=*"
composer global require "codeception/verify=*"
I also added teh phpunit to the composer.json
"require-dev": {
"yiisoft/yii2-codeception": "*",
"yiisoft/yii2-debug": "*",
"yiisoft/yii2-gii": "*",
"yiisoft/yii2-faker": "*",
"phpunit/phpunit": "4.3.*"
},
and added current Path to the PATH environment variable
E:\wamp\www\website\vendor\bin
But if I run
phpunit --version
or
codeception
I get the Error message "The command 'phpunit' wasn't found...
I am sure that E:\wamp\www\website\vendor\bin does not contain any phpunit or codeception files. Because you have installed phpunit and codeception globally, it means that they are installed someplace else and not in the website files (and that makes sense too).
Here are some instructions on how to add composer globally in Windows
Is there any way to install Composer globally on Windows?.
I do not have windows so I cannot tell you directly where things are.