I ‘ve an issue with Codeception coupled with Symfony. I want to run several test suites from several bundles with only one run command
./bin/codeception run
The project structure looks like this :
my-bundle-application
+--- app
+--- bin
+--- ...
+--- codeception.yml // the main codeception file
+--- tests
+--- packages
| +--- my-bundle
| +--- my-core-bundle
| +--- app
| +--- bin
| +--- ...
| +--- src
| +--- Controller
| +--- Model
| +--- ...
| +--- MyCoreBundle.php
| +--- tests // codecetpion tests directory
| +--- _data
| +--- _support
| +--- api
| +--- _bootstrap.php
| +--- api.suite.yml
| +--- codeception.yml // subfolder codeception file
| +--- composer.json (see below)
| +--- my-order-bundle
| +--- app
| +--- src
| +--- Controller
| +--- Model
| +--- ...
| +--- MyOrderBundle.php
| +--- bin
| +--- ...
| +--- tests
| +--- codeception.yml // subfolder codeception file
I want execute all test suite from my main bundle and also from my packages bundles. (my-bundle-application + my-core-bundle + my-order-bundle....)
I would like to know if it’s possible. I was thinking about the ‘include’ option in my main codeception.yml but things are not so simple and every test I’ve made give me the same error.
[Codeception\Exception\ConfigurationException]
Configuration file could not be found.
Run `bootstrap` to initialize Codeception.
Here is my main codeception.yml file :
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: true
memory_limit: 1024M
extensions:
enabled:
- Codeception\Extension\RunFailed
modules:
config:
Db:
dsn: ''
user: ''
password: ''
dump: tests/_data/dump.sql
include:
- MyBundle\CoreBundle // This give an error
The others Codeception files are similar without the include option.
and finally here is the composer.json of one of my sub Bundle
{
"name": "my-bundle/my-core-bundle",
"type": "symfony-bundle",
"license": "proprietary",
"description": "Bundle to manage core features.",
"autoload": {
"psr-4": { "MyBundle\\CoreBundle\\": "src/" }
},
...
}
Maybe I am not using Codeception correctly or there is no way to do this but I am not sure.
This github issue can also help : https://github.com/Codeception/Codeception/issues/319
Related
I'm building a C[++] project with CMake.
After running cmake --build ... I have a build folder in my project containing my binary plus some CMake service file like that:
.
|____CMakeLists.txt
|____build
| |____compile_commands.json
| |____CMakeFiles
| |____Makefile
| |____cmake_install.cmake
| |____CMakeCache.txt
| |____project.a
| |____.cmake
|____include
|____src
Is it possible to configure CMake to move all those files (except the actually built binaries) to some other place?
I can imagine something like:
.
|____CMakeLists.txt
|____build
| |____project.a
| |____.cmake
| |____compile_commands.json
| |____CMakeFiles
| |____Makefile
| |____cmake_install.cmake
| |____CMakeCache.txt
| |____etc
| |____...
|____include
|____src
Trying to force cmake to generate a specific file structure well supported. I recommend approaching the problem from the other end instead: Determine the location where cmake outputs the binaries. You simply need to set some or all of the following variables:
CMAKE_ARCHIVE_OUTPUT_DIRECTORY
CMAKE_LIBRARY_OUTPUT_DIRECTORY
CMAKE_PDB_OUTPUT_DIRECTORY
CMAKE_RUNTIME_OUTPUT_DIRECTORY
CMake presets would be a convenient place to set this kind of info:
...
configurePresets": [
{
...
"cacheVariables": {
"CMAKE_RUNTIME_OUTPUT_DIRECTORY": {
"type": "PATH",
"value": "${sourceDir}/build_binaries"
},
"CMAKE_LIBRARY_OUTPUT_DIRECTORY": {
"type": "PATH",
"value": "${sourceDir}/build_binaries"
},
"CMAKE_ARCHIVE_OUTPUT_DIRECTORY": {
"type": "PATH",
"value": "${sourceDir}/build_binaries"
},
"CMAKE_PDB_OUTPUT_DIRECTORY": {
"type": "PATH",
"value": "${sourceDir}/build_binaries"
}
},
...
},
...
]
...
This only provides default values though. The corresponding target properties (e.g. RUNTIME_OUTPUT_DIRECTORY) take precedence. Furthermore there's the possibility of the cache variables being shadowed by variables of the same name specified in your cmake files.
Note: If you want to put the binaries for a project in a file structure suitable for deployment, you should be using install() functionality instead.
PROBLEM DESCRIPTION
I am using vue develop a multi-entries app, the project folder is some like:
|- assets
| |- fonts
| | |- a.ttf
| |- styles
| | |- b.css // import ../fonts/a.ttf
|- src
| |- page_one
| | |- App.vue // import ../../assets/styles/b.css
Above project runs well in local deleopment enviroment, but reported 404 for the .ttf resource after deployed on the server. I checked the built product, found that the css font url is incorrect: I got http://<host>/css/fonts/a.ttf, while http://<host>/fonts/a.ttf is the expected URL.
TRACK the CAUSE
After lots of survey, I found above problem is related to the page entry. Since I got a lot pages, and I wanted to separate them into different folders, so the entries are some like:
// vue.config.js
module.exports = {
pages: {
'a/one': {
filename: 'a/one.html',
},
},
};
After built, the folder is like:
|- dist
| |- css
| | |- a
| | | |- one-<hash>.css // import ../fonts/a.ttf
| |- fonts
| | |- a.ttf
ROOT REASON: The pack tool (webpack) output css file in subfoler a/one-<hash>.css, while the url in css file is incorrect. Looks webpack supposed css file is directly placed at css folder.
SOLUTION: DO NOT USE / IN ENTRY. A correct configuration file is like:
// vue.config.js
module.exports = {
pages: {
'a-one': { // JUST DO NOT USE SLASH.
filename: 'a/one.html', // You can use this to build the produced pages intro separate folders
},
},
};
After all, if you use webpack and meet same problem, the reason and solution should be same.
Remove the '/' from the page entry. Correct:
// vue.config.js
module.exports = {
pages: {
'a-one': { // JUST DO NOT USE SLASH.
filename: 'a/one.html', // You can use this to build the produced pages intro separate folders
},
},
};
I generated an application with vue-cli and chose Jest as a test runner.
Everything works fine with the HelloWorld default vue.
I added to that ".vue" the following statement :
import aService from 'my-lib';
It works fine when I run the project with : npm run dev
However, when I run the test with npm run test:unit, I get the Cannot find module 'my-lib' from 'HelloWorld.vue' error :
> vue-cli-service test:unit
FAIL tests/unit/example.spec.js
● Test suite failed to run
Cannot find module 'my-lib' from 'HelloWorld.vue'
93 |
94 | <script>
> 95 | import aService from 'my-lib';
| ^
96 |
97 | export default {
98 | name: 'HelloWorld',
Why Jest cannot find my module ? knowing that It runs well and that It's an ES6 module.
What I've tried so far : I added the following code to my jest.config.js file but didn't help:
module.exports = {
preset: '#vue/cli-plugin-unit-jest',
transformIgnorePatterns: [
"node_modules/(?!(my-lib)/)"
],
moduleDirectories: [
"node_modules"
],
};
Android Studio 3.2.1, Gradle 4.6.
Java 1.8
In module1 I use in dir libs/android-binding-v0.6-build718.jar
It's containt class:
android\support\v4\accessibilityservice\AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl.class
in project/build.gradle:
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
in app/build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.myproject"
minSdkVersion 23
targetSdkVersion 28
versionCode 421
versionName "2.1.421"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
}
}
def AAVersion = '4.5.2'
dependencies {
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
annotationProcessor "org.androidannotations:ormlite:$AAVersion"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:animated-vector-drawable:28.0.0'
implementation 'com.android.support:exifinterface:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'org.apache.httpcomponents:httpclient:4.5.6'
implementation 'com.google.android.gms:play-services-gcm:16.0.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.j256.ormlite:ormlite-android:5.1'
implementation 'commons-io:commons-io:2.6'
implementation "org.androidannotations:androidannotations-api:$AAVersion"
implementation "org.androidannotations:ormlite-api:$AAVersion"
implementation project(':module1')
implementation project(':module2')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
here dependencies:
+--- com.google.android.gms:play-services-gcm:16.0.0
| +--- com.google.android.gms:play-services-base:16.0.1
| | +--- com.google.android.gms:play-services-basement:16.0.1
| | | \--- com.android.support:support-v4:26.1.0 -> 28.0.0 (*)
| | \--- com.google.android.gms:play-services-tasks:16.0.1
| | \--- com.google.android.gms:play-services-basement:16.0.1 (*)
| +--- com.google.android.gms:play-services-basement:16.0.1 (*)
| +--- com.google.android.gms:play-services-iid:16.0.0
| | +--- com.google.android.gms:play-services-base:16.0.1 (*)
| | +--- com.google.android.gms:play-services-basement:16.0.1 (*)
| | +--- com.google.android.gms:play-services-stats:16.0.1
| | | \--- com.google.android.gms:play-services-basement:16.0.1 (*)
| | \--- com.google.android.gms:play-services-tasks:16.0.1 (*)
| \--- com.google.android.gms:play-services-stats:16.0.1 (*)
But I get error:
:app:transformDexArchiveWithExternalLibsDexMergerForDebugD8: Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat$AccessibilityServiceInfoIcsImpl
FAILED
FAILURE: Build failed with an exception.
I've been fighting with Intern for quite a while, to test both server code (following these recommendations) and client code (tradionnal app, as defined on this project of mine, for example).
The Intern config file contains:
loader: {
packages: [
{ name: 'dojo', location: './libs/dojo' },
{ name: 'server', location: './server' }
]
},
However, the location of the dojo package is always ignored. The reported error is:
$ node node_modules/intern/client.js config=intern suites=server/model/tests/News
Defaulting to "console" reporter
Error: Failed to load module dojo/_base/declare from <root>/dojo/_base/declare.js (parent: server/model/Ne
ws)
at <root>\node_modules\intern\node_modules\dojo\dojo.js:742:12
at fs.js:207:20
at Object.oncomplete (fs.js:107:15)
I redacted for the <root> part to simplify the output.
My current workaround is to copy the dojo folder at the <root> level but that's inconvenient...
My current folder structure is:
<root>
|- client
|- libs
| |- dojo
| |- ...
|- node_modules
| |- grunt
| |- intern
| |- ...
|- server
|- dao
| |- tests
|- model
| |- tests
|- ...
Where am I wrong?
Update: Everywhere I read (like here), the configuration is specified as a MID, not as a filename with an extension. When I run my command with "config=intern.js" the configuration is correctly processed (I've hacked "client.js" to log the config content). Note: I'm running Node.js/Intern on a Windows machine...
Additional information: Here is the minimum content required to process my tests.
define({
loader: {
packages: [
{ name: 'dojo', location: './libs/dojo' },
{ name: 'server', location: './server' }
]
},
suites: [ 'server/allTests' ]
});
The issue I faced is related to the loader:
If the config file intern.js is at the root level, the command MUST contain the extension: config=intern.js;
If the config file is in a subfolder like tests then the extension MUST be omitted in the command: config=tests/intern.
This happens in intern/client.js, line 38, with the call to the Node.js require() function.