How to mark / tag spring cloud contract generated test - spring-cloud-contract

is there any possibility to annotate / tag the CDC generated tests?
I would like to group the cdc tests and execute them as separate step in my build pipeline.

They are all present under target or build and then /generated-test-sources/contracts. You can by default exclude those paths and have a separate profile in maven or task in gradle that will include those paths when you want to run contract tests

Related

debugging contract test cases in spring cloud contract

I have a question related to spring cloud contract framework.Is it possible to debug the test cases which are auto-generated by spring cloud contracts. usually I do gradle build to execute the contracts.But to understand the actual problem, I would like to do debug and see the results.
The Spring Cloud Contract Plugin generates standard Junit test files based on your contracts. For Maven you can find these in the target/generated-test-sources/contracts directory (Gradle will have similar output in the build directory).
When opening the files in this directory, you can have a look at the generated code. If the intention is to debug these tests, they can be copy/pasted from this directory into the actual test sources directory in your project. Then you can directly run the tests in debug mode (as previously pointed out by Marcin). To avoid the copy/pasting, add the target/generated-test-sources/contracts directory as test sources folder in your IDE.

CorDapp Suite and Dependencies

Let's say I want to use a cash-based CorDapp for DVP with my CP Trading CorDapp (But I do not want to be responsible for updating/developing cash). How does one note CorDapp dependencies for deployment? What if the cash CorDapp updates their state or contract definition?
If cash is too specific, let's say I want to use an API that reaches out to another data source for enrichment or validation of my state. Does this have to be an Oracle? Can we implement this API call as a CorDapp that's installed in a CorDapp Suite so it stays decentralized or must it contain a signature of an oracle in order to keep the transaction valid?
You specify the dependencies of your CorDapp in the dependencies section of your build.gradle file. For example, the following line would include the corda-finance module, which includes cash:
cordapp "net.corda:corda-finance:$corda_release_version"
As you can see, you specify the version of the CorDapp that you wish to use.
By default, when you build a CorDapp, the CorDapp jar's name is determined by:
The name of the module where the sources are defined
The version property in a project's gradle.properties file
So if the version number is 0.1, and your module is called clemens-dvp, building the CorDapp jar will create a file called clemens-dvp-0.1.jar.
See further information here: https://docs.corda.net/cordapp-build-systems.html. The docs state:
"The filename of the jar must include some sort of unique identifier to deduplicate it from other releases of the same CorDapp. This is typically done by appending the version string. It should not change once the jar has been deployed on a node."

Spring Cloud Contract with TestNG

As far as I understand(beginner level on Spring Cloud Contract), the contract tests generated from the groovy contracts are with junit.
What if I want to use TestNG? Basically I want to group my tests with TestNG annotation #Test(groups="unit") and #Test(groups="contract") in order to separate unit tests and contract tests using ssomething like mvn test -Dgroups=unit and mvn test -Dgroups=contract.
Thank you for your help.
Currently, we don't support this out of the box. You would have to write your own org.springframework.cloud.contract.verifier.builder.SingleTestGenerator implementation (by extending, for example, the JavaTestGenerator and referencing it in spring.factories file) but that can be quite time-consuming, unfortunately.

Accessing Karma Configurations from a Jasmine Unit Test

I was wondering if it was possible to access the settings defined within my karma.config.js file, and if so how?
I'm currently using a Grunt task runner to perform various tasks like building, linting, packaging, etc. I'm also using Grunt to kick off the Karma test runner to run my Jasmine unit tests. Furthermore, I'm pulling in the Jasmine-jQuery library so I can define and read in JSON and HTML fixtures from separate files that I setup earlier.
While I was writing some new tests, I noticed that I was redefining my fixtures base path in every test file. So I decided to pull it out and put it into a global constant.
The problem I'm having is where I should define it. Currently, I have a file named "testSettings.js" that I'm including in my karma configuration, where I define a configuration object and set it to window.testSettings. Thats all well and good, but I think it would be better if I defined it within my karma configuration and then just referenced that from my tests. But there doesn't look like a way to do this... or is there?
My library versions are:
"karma": "~0.12.32"
"karma-jasmine": "~0.3.5"
"karma-jasmine-jquery": "~0.1.1"

sbt-native-packager bashScriptExtraDefines profiles

I want to create some kind of "branding" for scala application using sbt-native-packager.
The idea is to configure two profiles in sbt (aprofile and bprofile) and when calling specific
target it defines correct configuration file to be used when starting application.
Two configuration files
conf/a.config
conf/b.config
I want to package application using following keys
sbt aprofile:stage
sbt bprofile:stage
Sbt-native-profile defines
bashScriptExtraDefines += """addJava "-Dconfig.file=${app_home}/../conf/app.config""""
Now the question is how to create those two profiles in sbt to define bashScriptExtraDefines property accordingly. I am trying to use https://stackoverflow.com/a/20573422/289043 somehow, however I don't know how to correctly overwrite bashScriptExtraDefines.

Resources