I'm trying to write some tests with Dagger 2, I'm trying to follow this approach:
https://github.com/ecgreb/dagger-2-testing-demo, but Dagger does not generate the TestingModuleComponent. What should i do to trigger this ?
Related
I have a repo using bazel as build and test system. This repo has both python and golang. There are two types of tests, unit tests, and integration tests. I would like to run them in two separate test steps in our CI. I would like to automatically discover new tests in the repo when new tests are added. we are currently using bazel test .... but this will not help me to split the unit test and integration test. Is there any rule or existing method to do this? Thanks.
Bazel doesn't really have a direct concept of unit vs integration testing, but it does have the concept of a test "size", or how "heavy" a test is. This docs page gives an outline of the size attribute on test rules while the Test encyclopedia gives a great overview.
When the tests are appropriately sized, it's then possible to use --test_size_filters flag to run the test for that size.
For example,
bazel test ... --test_size_filters=small for running unit tests
bazel test ... --test_size_filters=large for integration tests
You may want to add additional flags for unit tests vs integration tests, so adding a new config to .bazelrc might be a good idea, then run via bazel test ... --config=integration for example.
--test_size_filters is the best way, because it is a wide used solution. If you need another separation, then tags are way to go:
py_test(
name = "unit_test",
tags = ["unit"],
)
py_test(
name = "integration_test",
tags = ["integration"],
)
And then
bazel test --test_tag_filters=unit //...
bazel test --test_tag_filters=integration //...
bazel test --test_tag_filters=-integration,-unit //... # each test which is not "unit" nor "integration"
I'm currently playing with the Dart version of Angular 2.
I have seen that the library is using a lot of Metadata as #Component for example.
I would like to know how are those directives working?
I went on http://www.darlang.org. They explain how to define an annotation but not how to use it to construct an object as it is done in angular.io.
Could someone explain how the magic is working?
In Dart annotations by itself don't do anything than exist beside the code element where they are added.
At runtime:
You can use dart:mirrors to query the imported libraries for elements like fields, functions, classes, parameters, ... for these annotations.
dart:mirrors is discouraged for browser applications. In this case you can use the reflectable package with quite similar capabilities.
See also:
https://www.dartlang.org/articles/reflection-with-mirrors/
https://api.dartlang.org/1.14.1/dart-mirrors/dart-mirrors-library.html
https://stackoverflow.com/search?q=%5Bdart-mirrors%5D+annotations
At buildtime
You can create a transformer and register it in pubspec.yaml to be run by pub serve and pub build.
In this case the Dart analyzer can be utilized to query the source files for annotations and, like Angular does, modify the source code in a build step to add/replace/remove arbitrary code.
For more details about transformers
- https://www.dartlang.org/tools/pub/assets-and-transformers.html
- https://www.dartlang.org/tools/pub/transformers/
- https://www.dartlang.org/tools/pub/transformers/examples/
- https://www.dartlang.org/tools/pub/transformers/aggregate.html
- https://pub.dartlang.org/packages/code_transformers
I am trying to use FSharp.Charting for visualisation. However a stumbling block for me is that I am using the tutorial at Try F#, but the FSharp.Charting dll is different - has different methods signatures etc.
I am trying to translate the following line found on Try F#:
Chart.Point(data).WithXAxis(MajorTickStep=1.0)
However, I can't find a way of setting the major tick step on the X-Axis - the following code of mine does not it:
Chart.Point(data).WithXAxis(MajorTickMark=ChartTypes.TickMark(Interval=1.0))
Can anyone help?
I want to create only one job of jenkins and trigger the multiple poms with it i have done the same in ant by using the conditional buildstep plugin
My actual design is that i want to use is suppose I create the one job with name ABC and i m maintaining the tar file with this name and in this job i want to maintain the multiple builds
like ABC-type-I, ABC-type-II, ABC-type-III ........ all of them have there pom layering(maven structure) and i want to create the conditional steps like at run time i would be able to decide for which types the build is included in the tar i know that it can be done using conditional steps plugin but want to know the better approach if any in ur mind please share...........................
I find out the solution of my problem what I did is that I have used conditional build step plugin in Jenkins, so I made the one parent pom and then make the respective child pom for each sub module of my parent module and through conditional plugin I was able to give or create the prebuildsteps(go to conditional single step or multiple and then u can give the pom.xml there of your sub module) or you can make your job as dynamic as well that if you want to to include only sub module 1 not sub module 2 in your parent module than you can make the checkbox there by using the boolean parameters and executes the conditional steps only when there value is true(means checked)
I'm going to be doing a presentation on Spock next week and as part of the presentation I need to give a demonstration. I have used Spock a bit before for a project but haven't used it in about a year or so.
The demonstration needs to be more than just a "hello world" type demonstration. I'm looking for ideas of cool things I can demonstrate using Spock ... Any ideas?
The only thing I have now is the basic example that is included in the "getting started" section of the Spock website.
def "length of Spock's and his friends' names"() {
expect:
name.size() == length
where:
name << ["Kirk", "Spock", "Scotty"]
length << [4,5,6]
/*
name | length
"Spock" | 5
"Kirk" | 4
"Scotty" | 6
*/
}
Same tool for end-to-end testing as well as unit testing. Since it is based on groovy you can provide your own simple domain specific dsl based automation framework leveraging spock. I've around 5000 automated tests running as part of CI using this framework.
For Acceptance Testing
use of power asserts focus on how easy it is to interpret the failed assertions
BDD with given-when-then
data driven specs and unrolling
business friendly reporting
Powerful UI automation by marrying with Geb
For unit and integration testing
interaction based testing and mocking
simplified xml etc testing because of groovy goodies
Get more ideas from their documentation