-
-
Notifications
You must be signed in to change notification settings - Fork 384
After you have written all the tests, what's next
authorjapps edited this page Nov 26, 2018
·
11 revisions
These are general things to take care, nothing specific to Zerocode
, but Zerocode
makes your life very easy to achieve all these things.
- Please check the organization of the tests.
- Check you have organized the test cases by the API features?
- Check you have organized the test cases by API methods?
- Check the sub-organization by
Positive
orNegative
flows- Sometimes they are called
Happy
andSad
flows - Sometimes they are called
Sunny
andRainy
cenarios
- Sometimes they are called
- If they are
Consumer
orBoundary
contract tests- Check you have organized them by the
consumer
names orboundary
names. - Bring up a single Suite runner pointing to the root of the tests(JSON test files). See here how
- Check you have organized them by the
- Create a
package
of tests akasuite
of tests- Sometime this may not need any additional work too
- i.e. just identify the root of the tests for which you want to create a suite runner, that's it.
- Create a Suite runner or a Package runner.
- It's good to bring up a Package runner or Suite runner for all your tests or subset of your tests. See here how
e.g.
@TargetEnv("app_host.properties") // <--- "app_host_sst.properties" if running against 'sst'
@TestPackageRoot("tests") // <--- Root of the all tests folder in the test/resources
@EnvProperty("_${env}") // <--- mvn clean install -Denv=ci1 or -Denv=sst1
@RunWith(ZeroCodePackageRunner.class)
public class ContractTestSuite{
}
- Create a Jenkin Build Pipe line for your project.
- This depends on how you have organized your tests
- If you have multi-module maven project(POM or Gradle based), then you might need a pipe line
- If you have only one
maven module
or only one type ofsuite
or one regressionpack
, then you just need one Jenkin Job, not a Jenkins Pipe Line
In the Jenkins build goal
, you need to configure which suite you want to run,
e.g.
// ------------------------------------------------------------------------
// Via mvn command -
// $ mvn clean install -Denv=ci -Dtest=com.hsbc.regulatory.tests.ContractTestSuite
// $ mvn clean install -Denv=dit -Dtest=com.hsbc.regulatory.tests.ContractTestSuite
// $ mvn clean install -Denv=sst -Dtest=com.hsbc.regulatory.tests.ContractTestSuite
// ------------------------------------------------------------------------
or
- Configure your
sure fire
plugin (if you using POM) like this
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<includes>
<include>com.hsbc.regulatory.tests.ContractTestSuite.class</include>
</includes>
</configuration>
</plugin>
Then your Jenkins build goal will be as below(bit shorter than earlier).
// ------------------------------
// Via mvn command -
// $ mvn clean install -Denv=ci
// $ mvn clean install -Denv=dit
// $ mvn clean install -Denv=sst
// ------------------------------
_(Basically, it depends on the situation and varies from project to project how teh setup should be)_
CI Build/Jenkins (Gradle)
===
- Configure your `Task` fire(if you using Gradle) like [this](https://github.com/BeTheCodeWithYou/SpringBoot-Kotlin/blob/master/build.gradle)
```java
task integrationTests(type: Test) {
delete 'target/'
systemProperty 'zerocode.junit', 'gen-smart-charts-csv-reports'
include 'com/mastercard/vm/tests/ContractTestSuite.class'
testLogging {
showStandardStreams = true
}
}
@TargetEnv("app_host.properties") <--- Point this to any properties file
to run the tests against that env
e.g.
app_host.properties <-- against localhost/or dev or default type env.
app_host_ci.properties <--- against ci
app_host_dit.properties <--- against dit
app_host_sit.properties <--- against sst
Visit the Zerocode Documentation Site for all things.
-
User's Guide
-
Matchers
-
Zerocode Value Tokens
-
YAML DSL
-
Http Testing
-
Kafka Testing
- Introduction
- Produce, consume proto message
- Produce raw message
- Consume raw message
- Produce JSON message
- Consume JSON message
- Produce and consume XML message
- Kafka - consume the latest message or n latest messages
- Produce avro message
- Consume avro message
- KSQL in action
- Produce multiple records
- Produce from file
- Produce to a partition
- Produce and consume records with headers
- Produce n assert partition ack
- Comsume and dump to file
- commitSync vs commitAsync
- Overriding config inside a test
- Chosing String or Int or Avro Serializer
- Chosing String or Int or Avro Deserializer
- Attaching timestamp during load
- Default timestamp provided by Kafka
- Consume and assert avro schema metadata
- Error handling - produce via avro schema
- Sorting Kafka records consumed
-
DB Testing
-
Kotlin Testing
-
Performance Testing - Load and Stress
- Performance Testing - via awesome JUnit runners
- Load Vs Stress generation on target application
- Run a single test or a scenario in parallel
- Run multiple test scenarios in parallel - Production load simulation
- Dynamically change the payload for every request
- Analytics - Useful report(s) or statistics
-
Parameterized Testing
-
Docker
-
More+
-
Extensions
-
JUnit5 Jupiter Test
-
Questions And Answers(FAQ)
- What is Zerocode testing?
- SSL http https connections supported?
- How to assert array size Greater-Than Lesser-Than etc?
- How to invoke POST api?
- How to assert custom headers of the response?
- How to pass custom security token into the request header?
- When to use JUnit Suite runner and when Zerocode Package runner?
- How to execute DB SQL and assert?
- How to handle Http response other than utf-8 e.g. utf-16 or utf-32 ?
- Random Number Generator Placeholders Usages and Limits
- Automation tests for Zerocode lib itself
- Picking a leaf value from the array matching JSON Path
- Array assertions made easy, incl. size and element finder
-
Read Our Blogs
- Top 16 Open Source API Testing Tools For REST & SOAP Services - joecolantonio (Lists popular tools - Globally)
- OAuth2 Test Automation - DZone 2min Read
- Zero defect APIs - Build Pipe Line - Medium 10 min Read
- Develop ZeroDefect API's with ZeroCode! - Extreme Portal ( A must read for all developers and test engineers) 10min Read
- Performance testing using JUnit and maven - Codeproject 10 min Read
- REST API or SOAP End Point Testing - Codeproject 10min Read
- DZone- MuleSoft API Testing With Zerocode Test Framework - DZone 5min Read
- Testing need not be harder or slower, it should be easier and faster - DZone 5 min Read
- Kotlin Integration Testing simplified via Zerocode - Extreme portal 10 min Read
- and More...