├── _config.yml
├── zerocode-maven-archetype
├── .gitignore
├── src
│ └── main
│ │ └── resources
│ │ └── archetype-resources
│ │ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── utils
│ │ │ └── MyUtils.java
│ │ └── test
│ │ ├── resources
│ │ ├── hostconfig_ci.properties
│ │ ├── hostconfig_sit.properties
│ │ └── tests
│ │ │ └── get_api_200.json
│ │ └── java
│ │ ├── MyApiSuite.java
│ │ ├── RunMyApiSuite.java
│ │ └── tests
│ │ ├── MyPutApiTest.java
│ │ ├── MyGetApiTest.java
│ │ └── MyPostApiTest.java
└── pom.xml
├── http-testing-examples
└── src
│ ├── test
│ ├── resources
│ │ ├── helloworld_file_upload
│ │ │ ├── textfile.txt
│ │ │ └── hello_world_file_upload_test.json
│ │ ├── parameterized_csv
│ │ │ ├── params.csv
│ │ │ ├── params_with_header.csv
│ │ │ └── hello_world_test_parameterized_csv_source_files.json
│ │ ├── reusable_content
│ │ │ ├── request
│ │ │ │ ├── request_body.json
│ │ │ │ ├── office_address.json
│ │ │ │ └── request_body_with_address.json
│ │ │ └── response
│ │ │ │ └── response_body.json
│ │ ├── hello_world_host.properties
│ │ ├── github_host.properties
│ │ ├── steps
│ │ │ ├── step1.json
│ │ │ └── step2.json
│ │ ├── myapp_proto.properties
│ │ ├── postman_echo_host.properties
│ │ ├── customer_web_app.properties
│ │ ├── localhost_app.properties
│ │ ├── helloworld_github_REST_api
│ │ │ ├── GitHub_REST_api_step_reuse.json
│ │ │ ├── GitHub_REST_api_more_assertions.json
│ │ │ └── GitHub_REST_api_sample_assertions.json
│ │ ├── helloworld_implicit_delay
│ │ │ └── http_implicit_delay_max_timeout_scenario.json
│ │ ├── helloworld_more
│ │ │ ├── hello_world_get_new_emp_200.json
│ │ │ └── hello_world_ok_status_200.json
│ │ ├── helloworldjavaexec
│ │ │ ├── hello_world_javaexec_req_resp_as_json.json
│ │ │ ├── java_static_method_test.json
│ │ │ └── hello_world_java_method_return_assertions.json
│ │ ├── helloworld
│ │ │ └── hello_world_status_ok_assertions.json
│ │ ├── parameterized_value
│ │ │ └── hello_world_test_parameterized_value.json
│ │ ├── helloworld_properties_reading
│ │ │ └── use_common_SAML_token_as_headers.json
│ │ ├── helloworld_date
│ │ │ └── hello_world_date_after_before_test.json
│ │ ├── metadatatest
│ │ │ └── metadatatest.json
│ │ ├── no_server
│ │ │ └── no_server_call_multi.json
│ │ └── loadtesting
│ │ │ └── github_get_api_test_case.json
│ └── java
│ │ └── org
│ │ └── jsmart
│ │ └── zerocode
│ │ └── testhelp
│ │ └── tests
│ │ ├── helloworldjavaexec
│ │ ├── StaticMethodExecTest.java
│ │ ├── MultipleArgumentMethodExecTest.java
│ │ ├── HelloWorldJavaApiAsProtocolTest.java
│ │ └── SecurityHeaderTokenDynamicTest.java
│ │ ├── helloworldretrywithsteps
│ │ └── HelloWorldRetryWithStepsTest.java
│ │ ├── metadatatest
│ │ └── MetaDataTest.java
│ │ ├── helloworld
│ │ └── JustHelloWorldTest.java
│ │ ├── loadtesting
│ │ └── LoadGetEndPointTest.java
│ │ ├── helloworldoneof
│ │ └── HelloWorldOneOfTest.java
│ │ ├── helloworldfileupload
│ │ └── HelloWorldFileUploadTest.java
│ │ ├── helloworldgithub
│ │ └── GitHubHelloWorldTest.java
│ │ ├── helloworldtypecast
│ │ └── HelloWorldTypeCastTest.java
│ │ ├── helloworldarraysize
│ │ └── HelloWorldArraySizeTest.java
│ │ ├── helloworldnamedcsvparam
│ │ └── HelloWorldNamedCsvParamsTest.java
│ │ ├── helloworldqueryparams
│ │ └── HelloWorldQueryParamsTest.java
│ │ ├── helloworlddateafterbefore
│ │ └── HelloWorldDateAfterBeforeTest.java
│ │ ├── helloworldjsoncontent
│ │ └── HelloJsonContentAsBodyTest.java
│ │ ├── helloworldparameterizedvalue
│ │ └── HelloWorldParameterizedValueTest.java
│ │ ├── helloworldregexmatch
│ │ └── HelloWorldRegexMatchDateTest.java
│ │ ├── helloworldtokenresolver
│ │ └── HelloWorldTokenResolverTest.java
│ │ ├── HelloWorldGitHubSuite.java
│ │ ├── helloworldcustomclient
│ │ └── CustomSecurityHeaderTokenTest.java
│ │ ├── HelloWorldCustomHttpClientSuite.java
│ │ └── helloworldignorestepfailures
│ │ └── HelloWorldIgnoreStepFailuresTest.java
│ └── main
│ └── java
│ └── org
│ └── jsmart
│ └── zerocode
│ └── zerocodejavaexec
│ └── httpclient
│ └── JustHelloWorldSuite.java
├── core
└── src
│ ├── main
│ ├── resources
│ │ ├── engine
│ │ │ ├── request_respone_template_scene.json
│ │ │ ├── request_respone_template_step.json
│ │ │ └── request_respone_actual.json
│ │ ├── soap_response
│ │ │ └── mock_soap_response.xml
│ │ ├── config_hosts.properties
│ │ ├── 01_verification_test_cases
│ │ │ ├── 20_non_json_assert_part_string.json
│ │ │ ├── 02_java_service_single_step.json
│ │ │ ├── 09_host_port_annotated_bu_failed_assertion.json
│ │ │ ├── 08_get_with_inline_host_port_context.json
│ │ │ ├── 10_text_node_json_test.json
│ │ │ ├── 15_non_json_string_body_test.json
│ │ │ └── 06_number_not_equals_test.json
│ │ ├── dsl_formats
│ │ │ └── dsl_parameterized_values.json
│ │ ├── reports
│ │ │ └── 09_report_template.vm
│ │ └── logback.xml
│ └── java
│ │ └── org
│ │ └── jsmart
│ │ └── zerocode
│ │ ├── core
│ │ ├── domain
│ │ │ ├── QueryParams.java
│ │ │ ├── reports
│ │ │ │ ├── chart
│ │ │ │ │ └── ZeroCodeChart.java
│ │ │ │ ├── LocalDateTimeDeserializer.java
│ │ │ │ └── LocalDateTimeSerializer.java
│ │ │ ├── LoadWith.java
│ │ │ ├── TestMappings.java
│ │ │ ├── Scenario.java
│ │ │ ├── JsonTestCase.java
│ │ │ ├── EnvProperty.java
│ │ │ ├── TargetEnv.java
│ │ │ ├── TestPackageRoot.java
│ │ │ ├── TestMapping.java
│ │ │ ├── Scenarios.java
│ │ │ ├── JsonTestCases.java
│ │ │ ├── Body.java
│ │ │ ├── HostProperties.java
│ │ │ ├── UseKafkaClient.java
│ │ │ ├── UseHttpClient.java
│ │ │ └── Retry.java
│ │ ├── di
│ │ │ ├── module
│ │ │ │ ├── SmartUtilsModule.java
│ │ │ │ ├── GsonModule.java
│ │ │ │ ├── KafkaModule.java
│ │ │ │ ├── CsvParserModule.java
│ │ │ │ ├── HttpClientModule.java
│ │ │ │ ├── PropertiesInjectorModule.java
│ │ │ │ ├── RuntimeHttpClientModule.java
│ │ │ │ └── RuntimeKafkaClientModule.java
│ │ │ ├── provider
│ │ │ │ ├── DefaultGuiceHttpClientProvider.java
│ │ │ │ ├── ObjectMapperProvider.java
│ │ │ │ ├── KafkaServicesProvider.java
│ │ │ │ ├── YamlObjectMapperProvider.java
│ │ │ │ └── JacksonCsvParserAdapter.java
│ │ │ └── PropertyKeys.java
│ │ ├── utils
│ │ │ ├── ApiType.java
│ │ │ ├── UUIDGenerator.java
│ │ │ ├── RandomNumberGenerator.java
│ │ │ └── EnvUtils.java
│ │ ├── kafka
│ │ │ ├── common
│ │ │ │ ├── CommonConfigs.java
│ │ │ │ └── KafkaCommonUtils.java
│ │ │ ├── error
│ │ │ │ └── KafkaMessageConstants.java
│ │ │ ├── KafkaService.java
│ │ │ ├── client
│ │ │ │ └── ZerocodeCustomKafkaClient.java
│ │ │ ├── KafkaConstants.java
│ │ │ └── helper
│ │ │ │ └── KafkaCommonUtils.java
│ │ ├── engine
│ │ │ ├── executor
│ │ │ │ ├── httpapi
│ │ │ │ │ └── HttpApiExecutor.java
│ │ │ │ └── javaapi
│ │ │ │ │ ├── JavaMethodExecutor.java
│ │ │ │ │ └── CustomAsserter.java
│ │ │ ├── preprocessor
│ │ │ │ ├── ZeroCodeParameterizedProcessor.java
│ │ │ │ └── ZeroCodeExternalFileProcessor.java
│ │ │ ├── sorter
│ │ │ │ ├── SortOrder.java
│ │ │ │ └── ZeroCodeSorter.java
│ │ │ ├── validators
│ │ │ │ └── ZeroCodeValidator.java
│ │ │ └── assertion
│ │ │ │ └── NumberComparator.java
│ │ ├── runner
│ │ │ ├── Notifier.java
│ │ │ └── ZeroCodeMultiStepsScenarioRunner.java
│ │ ├── report
│ │ │ └── ZeroCodeReportGenerator.java
│ │ ├── zzignored
│ │ │ ├── trick
│ │ │ │ └── LogHello.java
│ │ │ └── ZeroCodeException.java
│ │ ├── verify
│ │ │ └── SmartPackagedVerification.java
│ │ └── constants
│ │ │ └── ZerocodeConstants.java
│ │ └── converter
│ │ ├── Converter.java
│ │ └── SoapMocker.java
│ └── test
│ ├── resources
│ ├── unit_test_files
│ │ ├── jks_files
│ │ │ └── dummy_key_store.jks
│ │ ├── engine_unit_test_jsons
│ │ │ ├── params.csv
│ │ │ ├── 13_validator_key_value_pair.json
│ │ │ ├── 05_test_external_step_reuse.json
│ │ │ ├── params_with_header.csv
│ │ │ ├── 08.1_parameterized_csv_source_from_file.json
│ │ │ ├── 08.2_parameterized_csv_source_from_file_containing_header.json
│ │ │ ├── 08_parameterized.json
│ │ │ ├── 14_validator_key_value_array.json
│ │ │ ├── 06_test_single_step_parameterized_value.json
│ │ │ ├── 07_test_single_step_parameterized_csv.json
│ │ │ ├── 12_scenario_parameterized_wrong_dsl.json
│ │ │ ├── 10_scenario_parameterized_values.json
│ │ │ ├── 01_test_json_single_step.json
│ │ │ ├── 01.1_test_json_single_step_method.json
│ │ │ ├── 11.1_scenario_parameterized_csv.json
│ │ │ ├── 04_ignoreStepFailures_in_multistep.json
│ │ │ └── 15_test_validators_single_step.json
│ │ ├── filebody_unit_test
│ │ │ ├── common
│ │ │ │ ├── common_content.json
│ │ │ │ ├── comm_addresses.json
│ │ │ │ ├── common_content_recursive.json
│ │ │ │ └── common_content_request.json
│ │ │ ├── json_step_text_request.json
│ │ │ ├── json_step_no_ext_json_test_file.json
│ │ │ ├── json_step_text_node_ext_json_file_test.json
│ │ │ ├── json_step_test_wrong_file_ref.json
│ │ │ ├── json_step_test_file.json
│ │ │ ├── json_step_test_file_recursive.json
│ │ │ └── json_step_test_address_array.json
│ │ ├── test_engine
│ │ │ └── 02_request_respone_template.json
│ │ ├── yaml
│ │ │ ├── scenario_get_api_step_test.yml
│ │ │ ├── scenario_get_api_step.yml
│ │ │ └── scenario_get_api_test.yml
│ │ ├── wiremock
│ │ │ ├── test_mock_step.json
│ │ │ ├── test_mock_step_request_headers.json
│ │ │ └── test_mock_step_request_body.json
│ │ ├── soap_stub
│ │ │ └── soap_request.xml
│ │ ├── java_apis
│ │ │ ├── 02_test_json_java_service_method_no_param.json
│ │ │ ├── 03_test_json_java_service_method_Exception.json
│ │ │ ├── 01_test_json_java_service_method_Integer.json
│ │ │ └── 01_test_json_java_service_method_MyNumber.json
│ │ ├── reports
│ │ │ ├── 01_basic_report_for_test.json
│ │ │ └── 03_multi_scenario_expected_report.json
│ │ ├── json_content_unit_test
│ │ │ ├── json_step_no_json_content_test.json
│ │ │ └── json_step_test_wrong_json_path.json
│ │ ├── one_of
│ │ │ ├── oneOf_test_expectedArrayEmpty.json
│ │ │ ├── oneOf_test_currentStatus.json
│ │ │ ├── oneOf_test_whiteSpace.json
│ │ │ └── oneOf_test_emptyString.json
│ │ ├── place_holders
│ │ │ ├── 05_REST_end_point_nonJson_response.json
│ │ │ ├── 04_REST_end_point_textNodeJson_response.json
│ │ │ ├── 02_REST_end_point_GET.json
│ │ │ └── 03_REST_end_point_POST.json
│ │ ├── date_after_before
│ │ │ ├── dateAfterBefore_test_fail_afterSameDate.json
│ │ │ ├── dateAfterBefore_test_fail_beforeSameDate.json
│ │ │ ├── dateAfterBefore_test_both.json
│ │ │ └── dateAfterBefore_test_fail_both.json
│ │ ├── regex_match
│ │ │ └── string_matches_regex_test.json
│ │ └── ignore_case
│ │ │ └── test_string_match_withIgnoring_case.json
│ ├── integration_test_files
│ │ ├── db
│ │ │ ├── players_without_headers.csv
│ │ │ └── players_with_headers.csv
│ │ ├── filebody
│ │ │ └── bodyonly
│ │ │ │ ├── response_body.json
│ │ │ │ └── request_body.json
│ │ ├── kafka_pfiles
│ │ │ └── unit_test_data_raw.json
│ │ ├── multi_step
│ │ │ ├── single_step.json
│ │ │ └── multi_step_file.json
│ │ ├── yaml
│ │ │ ├── simple_get_api_test.yml
│ │ │ └── string_optional_double_quotes_test.yml
│ │ ├── soap
│ │ │ └── xml_files
│ │ │ │ └── soap_request.xml
│ │ ├── json_paths_jayway
│ │ │ ├── 02_java_service_single_step.json
│ │ │ ├── 05_REST_with_request_response_path_1step.json
│ │ │ └── 07_REST_with_loop_test.json
│ │ ├── env_prop
│ │ │ └── 22_env_property_dynamic_runtime.json
│ │ ├── failed_steps
│ │ │ └── 01_two_step_one_fail.json
│ │ ├── custom_log
│ │ │ └── step_files.json
│ │ ├── retry_test_cases
│ │ │ └── 04_REST_retry_with_state_test.json
│ │ ├── failed_steps_with_ignore
│ │ │ └── 01_two_step_one_fail_and_ignored.json
│ │ ├── parameterized
│ │ │ ├── parameterized_sample_csv_string_test.json
│ │ │ └── parameterized_sample_type_cast_test.json
│ │ ├── get_api
│ │ │ └── simple_get_api_test.json
│ │ ├── helloworld
│ │ │ └── get_api_integration_test.json
│ │ └── host_keys
│ │ │ └── property_reading_into_test_step_test.json
│ ├── github_host_test.properties
│ ├── github_host_old_fashion_test.properties
│ ├── app_config.properties
│ ├── app_config_ci.properties
│ ├── dev_test.properties
│ ├── config_hosts_test.properties
│ ├── config_hosts_test_ci.properties
│ ├── config_hosts_test_backword_compatibility.properties
│ ├── env_config_test_files
│ │ ├── app_config.properties
│ │ └── app_config_ci.properties
│ ├── hello_world_host.properties
│ ├── db_test.properties
│ ├── db_test_postgres.properties
│ ├── host_with_corp_proxy.properties
│ ├── soap_host_with_corp_proxy.properties
│ ├── web_app.properties
│ ├── load_test_files
│ │ ├── simple_load_at_localhost.json
│ │ ├── simple_load_at_localhost_fail.json
│ │ └── github_get_api_sample_test.json
│ └── soap_host.properties
│ └── java
│ └── org
│ └── jsmart
│ └── zerocode
│ ├── core
│ ├── kafka
│ │ └── receive
│ │ │ └── KafkaReceiverTest.java
│ ├── runner
│ │ ├── FlowExampleWithoutAnnotationClass.java
│ │ ├── FlowExamplePackagePickerClass.java
│ │ └── e2e
│ │ │ └── FailSimpleAssertionInMultiStep.java
│ ├── tests
│ │ ├── customrunner
│ │ │ └── SimulatorState.java
│ │ └── SmartPackagedTestCases.java
│ ├── defaultrunner
│ │ └── DefaultRunnerTestRunManuallyOnly.java
│ ├── domain
│ │ └── builders
│ │ │ └── ZeroCodeIoWriteBuilderTest.java
│ ├── AddServiceTest.java
│ ├── javamethod
│ │ └── JavaMethodExecTest.java
│ ├── verification
│ │ ├── ZeroCodePackageRunnerIgnoreTest.java
│ │ ├── ZeroCodePackageRunnerVerification.java
│ │ ├── hostproperties
│ │ │ ├── PropertiesInStepsPackageRunnerTest.java
│ │ │ └── PropertiesInStepsUnitRunnerTest.java
│ │ ├── ZeroCodeUnitNumberEqualsTest.java
│ │ ├── ZeroCodeUnitNumberNotEqualsTest.java
│ │ ├── loopreport
│ │ │ ├── SmartJUnitNavigatorReportGen.java
│ │ │ └── SmartJUnitNavigatorReportGenFailureStep.java
│ │ ├── ZeroCodeFailedAssertionsTestRunner.java
│ │ └── ZeroCodeJUnitHostPortContextAnnotationTest.java
│ ├── yaml
│ │ └── YamlUnitTest.java
│ ├── scenario
│ │ └── ScenarioAnnotationTest.java
│ └── envprop
│ │ └── suite
│ │ └── ZeroCodeEnvPropertyReaderPackageTest.java
│ ├── integrationtests
│ ├── customassert
│ │ └── MyCustomComparatorReflectionTest.java
│ ├── CustomLogTest.java
│ └── MultiStepTest.java
│ ├── TestUtility.java
│ ├── parallel
│ └── restful
│ │ ├── LoadRestEndPointSingleRunnerTest.java
│ │ └── LoadRestEndPointMultiRunnerTest.java
│ ├── parameterized
│ ├── ParameterisedDemoTest.java
│ └── ParameterizedDemoTypeCastTest.java
│ ├── typecast
│ └── TypeCastIntegrationTest.java
│ └── github
│ ├── TestGitHubApi.java
│ └── TestGitHubApiOldFashionHost.java
├── kafka-testing-examples
└── src
│ ├── test
│ ├── resources
│ │ ├── security_files
│ │ │ └── sample_key_store.jks
│ │ ├── kafka
│ │ │ ├── pfiles
│ │ │ │ ├── test_data_raw.json
│ │ │ │ ├── test_data_json.json
│ │ │ │ └── test_data_json_with_vars.json
│ │ │ ├── produce
│ │ │ │ ├── WIP_test_kafka_publish_inline_server.json
│ │ │ │ ├── test_kafka_produce.json
│ │ │ │ └── negative
│ │ │ │ │ └── test_kafka_produce_from_worng_filename.json
│ │ │ ├── metadata
│ │ │ │ └── WIP_test_kafka_topic_details.json
│ │ │ ├── commands
│ │ │ │ └── WIP_test_kafka_command_execution.json
│ │ │ ├── more
│ │ │ │ └── test_kafka_produce.json
│ │ │ └── consume
│ │ │ │ └── latest
│ │ │ │ └── test_offset_to_latest_all_partitions_existing_topic.json
│ │ └── kafka_servers
│ │ │ ├── kafka_test_bad_server.properties
│ │ │ ├── kafka_producer_int_key.properties
│ │ │ └── kafka_producer_double_key.properties
│ └── java
│ │ └── org
│ │ └── jsmart
│ │ └── zerocode
│ │ └── integration
│ │ └── tests
│ │ ├── kafka
│ │ ├── produce
│ │ │ ├── KafkaProduceJsonButNotReallyJsonTest.java
│ │ │ ├── KafkaProduceAsyncTest.java
│ │ │ ├── KafkaProduceRawTest.java
│ │ │ ├── KafkaProduceUniqueClientIdTest.java
│ │ │ ├── KafkaProduceJsonTest.java
│ │ │ ├── KafkaProduceTwoRecordsTest.java
│ │ │ ├── KafkaProduceIntKeyTest.java
│ │ │ ├── KafkaProduceWithHeadersTest.java
│ │ │ ├── KafkaProduceToPartitionTest.java
│ │ │ ├── KafkaProduceWithTimeStampTest.java
│ │ │ ├── KafkaProduceRawWithHeadersTest.java
│ │ │ ├── file
│ │ │ │ ├── KafkaProduceSyncFromFileRawTest.java
│ │ │ │ └── KafkaProduceAsyncFromFileRawTest.java
│ │ │ └── negative
│ │ │ │ └── KafkaProduceSyncWrongFileNameTest.java
│ │ ├── consume
│ │ │ ├── KafkaConsumeRawTest.java
│ │ │ ├── KafkaConsumeXmlTest.java
│ │ │ ├── KafkaConsumeUniqueGroupIdTest.java
│ │ │ ├── filter
│ │ │ │ └── KafkaFilterTest.java
│ │ │ ├── sorting
│ │ │ │ └── KafkaSortingTest.java
│ │ │ ├── KafkaConsumeIntKeyTest.java
│ │ │ └── KafkaProduceConsumeAvroTest.java
│ │ └── protobuf
│ │ │ └── KafkaProtobufTest.java
│ │ └── more
│ │ └── customclientsuite
│ │ └── KafkaProduceCustomClientSuiteTest.java
│ └── main
│ ├── proto
│ └── Persons.proto
│ └── java
│ └── org
│ └── jsmart
│ └── zerocode
│ └── zerocodejavaexec
│ └── utils
│ └── ExampleUtils.java
├── junit5-testing-examples
└── src
│ ├── test
│ ├── java
│ │ └── org
│ │ │ └── jsmart
│ │ │ └── zerocode
│ │ │ ├── jupiter
│ │ │ └── load
│ │ │ │ └── JupiterLoadProcessorTest.java
│ │ │ └── tests
│ │ │ ├── junit4
│ │ │ ├── JUnit4Test.java
│ │ │ └── GitHubHelloWorldTest.java
│ │ │ └── jupiter
│ │ │ └── JUnit5Test.java
│ └── resources
│ │ ├── github_host.properties
│ │ ├── helloworld_github_REST_api
│ │ └── GitHub_REST_api_sample_assertions.json
│ │ └── loadtesting
│ │ └── github_get_api_test_case.json
│ └── main
│ └── java
│ └── org
│ └── jsmart
│ └── zerocode
│ └── jupiter
│ └── demo
│ └── Calculator.java
├── ISSUES.md
├── docker
├── Dockerfile
└── compose
│ ├── shutdown.sh
│ └── pg_compose.yml
└── .gitignore
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-hacker
2 |
--------------------------------------------------------------------------------
/zerocode-maven-archetype/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworld_file_upload/textfile.txt:
--------------------------------------------------------------------------------
1 | HelloWorld
--------------------------------------------------------------------------------
/core/src/main/resources/engine/request_respone_template_scene.json:
--------------------------------------------------------------------------------
1 | {
2 | ${STEP_REQUEST_RESPONSE_SECTION}
3 | }
4 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/jks_files/dummy_key_store.jks:
--------------------------------------------------------------------------------
1 | -----key start----
2 | dummy
3 | -----key ends-----
--------------------------------------------------------------------------------
/core/src/main/resources/soap_response/mock_soap_response.xml:
--------------------------------------------------------------------------------
1 |
Street 123
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/db/players_without_headers.csv:
--------------------------------------------------------------------------------
1 | 1001, Ronaldo, 23
2 | 1002, null!!, 24
3 | 1003, Trevaldo, 35
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/security_files/sample_key_store.jks:
--------------------------------------------------------------------------------
1 | -----key start----
2 | dummy cert.
3 | -----key ends-----
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/parameterized_csv/params.csv:
--------------------------------------------------------------------------------
1 | octocat,The Octocat,San Francisco,583231
2 | siddhagalaxy,Sidd,UK,33847730
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/reusable_content/request/request_body.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Emma",
3 | "surName": "Norton"
4 | }
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/filebody/bodyonly/response_body.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "$NOT.NULL",
3 | "availability": true
4 | }
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/params.csv:
--------------------------------------------------------------------------------
1 | octocat,The Octocat,San Francisco,583231
2 | siddhagalaxy,Sidd,UK,33847730
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/13_validator_key_value_pair.json:
--------------------------------------------------------------------------------
1 | {
2 | "field": "foo",
3 | "value": "bar"
4 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/QueryParams.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 | public class QueryParams {
4 | }
5 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/db/players_with_headers.csv:
--------------------------------------------------------------------------------
1 | ID, AGE, NAME
2 | 1001, 23, Ronaldo
3 | 1002, , Devaldo
4 | 1003, 35, Trevaldo
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/filebody/bodyonly/request_body.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Shower-${RANDOM.NUMBER}",
3 | "availability": true
4 | }
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/05_test_external_step_reuse.json:
--------------------------------------------------------------------------------
1 | {
2 | "id" : "step1",
3 | "stepFile": "file/path"
4 |
5 | }
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/reusable_content/request/office_address.json:
--------------------------------------------------------------------------------
1 | {
2 | "addressId":"lon-hsbc-5432",
3 | "countryOfOrigin":"UK"
4 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/module/SmartUtilsModule.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.di.module;
2 |
3 | public class SmartUtilsModule {
4 | }
5 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/kafka/pfiles/test_data_raw.json:
--------------------------------------------------------------------------------
1 | {"key":"1539010017093","value":"Hello World 1"}
2 | {"key":"1539010017094","value":"Hello World 2"}
3 |
--------------------------------------------------------------------------------
/zerocode-maven-archetype/src/main/resources/archetype-resources/src/main/java/utils/MyUtils.java:
--------------------------------------------------------------------------------
1 | package ${groupId}.utils;
2 |
3 |
4 | public class MyUtils {
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/core/src/main/resources/engine/request_respone_template_step.json:
--------------------------------------------------------------------------------
1 | {
2 | "${STEP.NAME}": {
3 | "request":${STEP.REQUEST},
4 | "response": ${STEP.RESPONSE}
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/filebody_unit_test/common/common_content.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "Emp-No-${RANDOM.NUMBER}",
3 | "age": 16,
4 | "secret": "passwwrd"
5 | }
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/parameterized_csv/params_with_header.csv:
--------------------------------------------------------------------------------
1 | user,name,city,userid
2 | octocat,The Octocat,San Francisco,583231
3 | siddhagalaxy,Sidd,UK,33847730
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/reports/chart/ZeroCodeChart.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain.reports.chart;
2 |
3 | public class ZeroCodeChart {
4 | }
5 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/kafka_pfiles/unit_test_data_raw.json:
--------------------------------------------------------------------------------
1 | {"key":"1539010017093","value":"Hello World 1"}
2 | {"key":"1539010017094","value":"Hello World 2"}
3 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/params_with_header.csv:
--------------------------------------------------------------------------------
1 | user,name,city,userid
2 | octocat,The Octocat,San Francisco,583231
3 | siddhagalaxy,Sidd,UK,33847730
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/reusable_content/response/response_body.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": 39001,
3 | "ldapId": "emmanorton",
4 | "name": "Emma",
5 | "surName": "Norton"
6 | }
--------------------------------------------------------------------------------
/junit5-testing-examples/src/test/java/org/jsmart/zerocode/jupiter/load/JupiterLoadProcessorTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.jupiter.load;
2 |
3 | class JupiterLoadProcessorTest {
4 |
5 | }
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/kafka/pfiles/test_data_json.json:
--------------------------------------------------------------------------------
1 | {"key":"1546955346669","value":{"id":121,"name":"Jey"}}
2 | {"key":"1546955346670","value":{"id":122,"name":"Krep"}}
3 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/test_engine/02_request_respone_template.json:
--------------------------------------------------------------------------------
1 | {
2 | "${STEP.NAME}": {
3 | "request":${STEP.REQUEST},
4 | "response": ${STEP.RESPONSE}
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/core/src/test/resources/github_host_test.properties:
--------------------------------------------------------------------------------
1 | # GitHub api hosts
2 | web.application.endpoint.host=https://api.github.com
3 | web.application.endpoint.port=
4 | web.application.endpoint.context=
5 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/utils/ApiType.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.utils;
2 |
3 | public enum ApiType {
4 | REST_CALL,
5 | KAFKA_CALL,
6 | JAVA_CALL,
7 | NONE;
8 | }
9 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/kafka/receive/KafkaReceiverTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.kafka.receive;
2 |
3 | public class KafkaReceiverTest {
4 | KafkaReceiver kafkaReceiver;
5 |
6 | }
--------------------------------------------------------------------------------
/core/src/test/resources/github_host_old_fashion_test.properties:
--------------------------------------------------------------------------------
1 | # GitHub api hosts
2 | restful.application.endpoint.host=https://api.github.com
3 | restful.application.endpoint.port=443
4 | restful.application.endpoint.context=
5 |
--------------------------------------------------------------------------------
/core/src/test/resources/app_config.properties:
--------------------------------------------------------------------------------
1 | #
2 | web.application.endpoint.host=http://localhost
3 | web.application.endpoint.port=9998
4 |
5 | # Google Map Service Context
6 | web.application.endpoint.context=/google-map-services
7 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/reusable_content/request/request_body_with_address.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Emma",
3 | "surName": "Norton",
4 | "address": "${JSON.FILE:reusable_content/request/office_address.json}"
5 | }
--------------------------------------------------------------------------------
/core/src/test/resources/app_config_ci.properties:
--------------------------------------------------------------------------------
1 | #
2 | web.application.endpoint.host=http://localhost
3 | web.application.endpoint.port=9998
4 |
5 | # Google Map Service Context
6 | web.application.endpoint.context=/google-map-services
7 |
--------------------------------------------------------------------------------
/core/src/test/resources/dev_test.properties:
--------------------------------------------------------------------------------
1 | web.application.endpoint.host=http://localhost
2 | web.application.endpoint.port=9998
3 | web.application.endpoint.context=
4 |
5 | my_new_url=http://localhost:9998
6 |
7 | mock.api.port=8888
8 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/runner/FlowExampleWithoutAnnotationClass.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.runner;
2 |
3 | //@TestPackageRoot("03_test_one_multi_steps")
4 | public class FlowExampleWithoutAnnotationClass {
5 | }
6 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/kafka/common/CommonConfigs.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.kafka.common;
2 |
3 | public class CommonConfigs {
4 | public static final String BOOTSTRAP_SERVERS = "bootstrap.servers";
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/core/src/main/resources/config_hosts.properties:
--------------------------------------------------------------------------------
1 | # host and port
2 | web.application.endpoint.host=http://localhost
3 | web.application.endpoint.port=8888
4 |
5 | # Google Map Service Context
6 | web.application.endpoint.context=/google-map-services
7 |
--------------------------------------------------------------------------------
/core/src/test/resources/config_hosts_test.properties:
--------------------------------------------------------------------------------
1 | #
2 | web.application.endpoint.host=http://localhost-test
3 | web.application.endpoint.port=8820
4 |
5 | # Google Map Service Context
6 | web.application.endpoint.context=/google-map-services
7 |
--------------------------------------------------------------------------------
/core/src/test/resources/config_hosts_test_ci.properties:
--------------------------------------------------------------------------------
1 | #
2 | web.application.endpoint.host=http://localhost-test
3 | web.application.endpoint.port=88200
4 |
5 | # Google Map Service Context
6 | web.application.endpoint.context=/google-map-services
7 |
--------------------------------------------------------------------------------
/junit5-testing-examples/src/main/java/org/jsmart/zerocode/jupiter/demo/Calculator.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.jupiter.demo;
2 |
3 | public class Calculator {
4 |
5 | public int add(int a, int b) {
6 | return a + b;
7 | }
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/core/src/test/resources/config_hosts_test_backword_compatibility.properties:
--------------------------------------------------------------------------------
1 | restful.application.endpoint.host=http://localhost-test-backword-compatibility
2 | restful.application.endpoint.port=8820
3 | restful.application.endpoint.context=/google-map-services
4 |
--------------------------------------------------------------------------------
/core/src/test/resources/env_config_test_files/app_config.properties:
--------------------------------------------------------------------------------
1 | #
2 | web.application.endpoint.host=http://localhost
3 | web.application.endpoint.port=9997
4 |
5 | # Google Map Service Context
6 | web.application.endpoint.context=/google-map-services
7 |
--------------------------------------------------------------------------------
/core/src/test/resources/env_config_test_files/app_config_ci.properties:
--------------------------------------------------------------------------------
1 | #
2 | web.application.endpoint.host=http://localhost
3 | web.application.endpoint.port=9997
4 |
5 | # Google Map Service Context
6 | web.application.endpoint.context=/google-map-services
7 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/filebody_unit_test/common/comm_addresses.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "type":"corp-office",
4 | "city":"Texas"
5 | },
6 | {
7 | "type":"hr-office",
8 | "city":"Newark"
9 | }
10 | ]
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/08.1_parameterized_csv_source_from_file.json:
--------------------------------------------------------------------------------
1 | {
2 | "valueSource": [
3 | "hello",
4 | 123,
5 | true
6 | ],
7 | "csvSource": "unit_test_files/engine_unit_test_jsons/params.csv"
8 | }
9 |
--------------------------------------------------------------------------------
/ISSUES.md:
--------------------------------------------------------------------------------
1 | ## How To Raise Issues Correctly
2 | Visit this [link](https://github.com/authorjapps/zerocode/wiki/Guidelines-for-raising-issues#right-way)
3 |
4 | Visit this [page](https://github.com/authorjapps/zerocode/wiki/Guidelines-for-raising-issues) to learn more in a context.
5 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/yaml/scenario_get_api_step_test.yml:
--------------------------------------------------------------------------------
1 | ---
2 | scenarioName: "GIVEN-the GitHub REST end point, WHEN-I invoke GET, THEN-I will receive the 200 status with body"
3 | steps:
4 | - stepFile: ${YAML.FILE:unit_test_files/yaml/scenario_get_api_step.yml}
--------------------------------------------------------------------------------
/docker/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM confluentinc/cp-kafka
2 |
3 | VOLUME ["/var/lib/${COMPONENT}/data", "/etc/${COMPONENT}/secrets"]
4 |
5 | COPY include/etc/confluent/docker /etc/confluent/docker
6 |
7 | CMD ["/etc/confluent/docker/run"]
8 |
9 | ENTRYPOINT ["/docker_entrypoint.sh"]
10 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/filebody_unit_test/common/common_content_recursive.json:
--------------------------------------------------------------------------------
1 | {
2 | "id": "Emp-No-${RANDOM.NUMBER}",
3 | "age": 16,
4 | "secret": "passwwrd",
5 | "addresses": "${JSON.FILE:unit_test_files/filebody_unit_test/common/comm_addresses.json}"
6 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/engine/executor/httpapi/HttpApiExecutor.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.engine.executor.httpapi;
2 |
3 | public interface HttpApiExecutor {
4 | String execute(String urlName, String methodName, String requestJson) throws Exception;
5 | }
6 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/engine/executor/javaapi/JavaMethodExecutor.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.engine.executor.javaapi;
2 |
3 | public interface JavaMethodExecutor {
4 | String execute(String qualifiedClassName, String methodName, String requestJson);
5 | }
6 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/LoadWith.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 | import java.lang.annotation.Retention;
4 | import java.lang.annotation.RetentionPolicy;
5 |
6 | @Retention(RetentionPolicy.RUNTIME)
7 | public @interface LoadWith {
8 | String value();
9 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/kafka/error/KafkaMessageConstants.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.kafka.error;
2 |
3 | public interface KafkaMessageConstants {
4 | String NO_RECORD_FOUND_TO_SEND = "--------> No record was found or invalid record format was found <--------";
5 |
6 | }
7 |
--------------------------------------------------------------------------------
/core/src/test/resources/hello_world_host.properties:
--------------------------------------------------------------------------------
1 | # Web Server host and port
2 | restful.application.endpoint.host=http://localhost
3 | restful.application.endpoint.port=9998
4 |
5 | # Web Service context; Leave it blank in case you do not have a common context
6 | restful.application.endpoint.context=
7 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/filebody_unit_test/common/common_content_request.json:
--------------------------------------------------------------------------------
1 | {
2 | "headers":{
3 | "api_key":"hello key"
4 | },
5 | "body": {
6 | "id": "Emp-No-${RANDOM.NUMBER}",
7 | "age": 16,
8 | "secret": "passwwrd"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/engine/executor/javaapi/CustomAsserter.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.engine.executor.javaapi;
2 |
3 | import java.util.Map;
4 |
5 | public interface CustomAsserter {
6 | Boolean asserted(Map inputParamMap, Object actualFieldValue);
7 | }
8 |
--------------------------------------------------------------------------------
/docker/compose/shutdown.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | echo "shutting down confluent kafka..."
3 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
4 | docker-compose -f $SCRIPT_DIR/kafka-schema-registry.yml kill
5 | docker-compose -f $SCRIPT_DIR/kafka-schema-registry.yml rm -f
6 | echo "Done."
7 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/runner/FlowExamplePackagePickerClass.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.runner;
2 |
3 | import org.jsmart.zerocode.core.domain.TestPackageRoot;
4 |
5 | @TestPackageRoot("unit_test_files/test_scenario_multi_steps")
6 | public class FlowExamplePackagePickerClass {
7 | }
8 |
--------------------------------------------------------------------------------
/core/src/test/resources/db_test.properties:
--------------------------------------------------------------------------------
1 | # Connection info used by the DbSqlExecutor
2 |
3 | # JDBC connection string to the test database (H2)
4 | db.driver.url=jdbc:h2:./target/test_db_sql_executor
5 | # If connection requires authentication, specify user and password:
6 | # db.driver.user=
7 | # db.driver.password=
8 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/hello_world_host.properties:
--------------------------------------------------------------------------------
1 | # Web Server host and port
2 | restful.application.endpoint.host=http://localhost
3 | restful.application.endpoint.port=9999
4 |
5 | # Web Service context; Leave it blank in case you do not have a common context
6 | restful.application.endpoint.context=
7 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/yaml/scenario_get_api_step.yml:
--------------------------------------------------------------------------------
1 | name: "get_user_details"
2 | url: "/users/octocat"
3 | operation: "GET"
4 | request:
5 | -
6 | verify:
7 | status: 200
8 | body:
9 | login: "octocat"
10 | id: 583231
11 | type: "User"
12 | location: "$MATCHES.STRING:San Fra(.*)"
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/runner/Notifier.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.runner;
2 |
3 | @FunctionalInterface
4 | public interface Notifier {
5 | /*
6 | * R is Return, but does not have to be the last in the list nor named R.
7 | */
8 | R apply (A a, B b, C c, D d, E e);
9 | }
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/multi_step/single_step.json:
--------------------------------------------------------------------------------
1 |
2 | {
3 | "name": "step_file_with_node",
4 | "url": "",
5 | "operation": "",
6 | "customLog": "Contributing to Zerocode",
7 | "request": {
8 | "req": "hey zerocode"
9 | },
10 | "assertions": {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/utils/UUIDGenerator.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.utils;
2 |
3 | import static java.util.UUID.randomUUID;
4 |
5 | public class UUIDGenerator {
6 |
7 | @Override
8 | public String toString(){
9 | return randomUUID().toString();
10 | }
11 |
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/kafka/pfiles/test_data_json_with_vars.json:
--------------------------------------------------------------------------------
1 | {"key":"1546955346669","value":{"id":121,"name":"${$.load_kafka.response.recordMetadata.topicPartition.topic}-My-Value-1"}}
2 | {"key":"1546955346670","value":{"id":122,"name":"${$.load_kafka.response.recordMetadata.topicPartition.topic}-My-Value-2"}}
3 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/08.2_parameterized_csv_source_from_file_containing_header.json:
--------------------------------------------------------------------------------
1 | {
2 | "valueSource": [
3 | "hello",
4 | 123,
5 | true
6 | ],
7 | "ignoreHeader": true,
8 | "csvSource": "unit_test_files/engine_unit_test_jsons/params_with_header.csv"
9 | }
10 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/08_parameterized.json:
--------------------------------------------------------------------------------
1 | {
2 | "valueSource": [
3 | "hello",
4 | 123,
5 | true
6 | ],
7 | "csvSource": [
8 | //id, AddressId, status
9 | "1, 2, 200",
10 | "11, 22, 400"
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/TestMappings.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 |
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 |
7 | @Retention(RetentionPolicy.RUNTIME)
8 | public @interface TestMappings {
9 | public TestMapping[] value() default {};
10 | }
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/integrationtests/customassert/MyCustomComparatorReflectionTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integrationtests.customassert;
2 |
3 | public class MyCustomComparatorReflectionTest {
4 | // See tests here:
5 | // src/test/java/org/jsmart/zerocode/integrationtests/customassert/MyCustomComparatorTest.java
6 | }
7 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeParameterizedProcessor.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.engine.preprocessor;
2 |
3 | import org.jsmart.zerocode.core.domain.ScenarioSpec;
4 |
5 | public interface ZeroCodeParameterizedProcessor {
6 |
7 | ScenarioSpec resolveParameterized(ScenarioSpec scenario, int iteration);
8 | }
9 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/filebody_unit_test/json_step_text_request.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "create_emp",
3 | "url": "/api/test/v1/employess",
4 | "operation": "POST",
5 | "request": "I am a simple text",
6 | "assertions": {
7 | "status": 201,
8 | "body": {
9 | "id": 100
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/core/src/test/resources/db_test_postgres.properties:
--------------------------------------------------------------------------------
1 | # Connection info used by the DbSqlExecutor
2 |
3 | # JDBC connection string to a PostgreSQL test database
4 | # Spin up the DB container before running the postgres tests: docker/compose/pg_compose.yml
5 | db.driver.url=jdbc:postgresql://localhost:35432/postgres
6 | db.driver.user=postgres
7 | db.driver.password=example
8 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/github_host.properties:
--------------------------------------------------------------------------------
1 | # Web Server host and port
2 | web.application.endpoint.host=https://api.github.com
3 | # Web Service Port; Leave it blank in case it is default port i.e. 80 or 443 etc
4 | web.application.endpoint.port=
5 | # Web Service context; Leave it blank in case you do not have a common context
6 | web.application.endpoint.context=
7 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/steps/step1.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "get_github_server_details_1",
3 | "url": "/users/albertosipov",
4 | "method": "GET",
5 | "request": {
6 | },
7 | "assertions": {
8 | "status": 200,
9 | "body": {
10 | "login": "albertosipov",
11 | "id": 36400587
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/steps/step2.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "get_github_server_details_2",
3 | "url": "/users/albertosipov",
4 | "method": "GET",
5 | "request": {
6 | },
7 | "assertions": {
8 | "status": 200,
9 | "body": {
10 | "login": "albertosipov",
11 | "id": 36400587
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/report/ZeroCodeReportGenerator.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.report;
2 |
3 | public interface ZeroCodeReportGenerator {
4 | void generateCsvReport();
5 |
6 | /**
7 | * Spike chat is disabled by default
8 | *
9 | */
10 | void generateHighChartReport();
11 |
12 | void generateExtentReport();
13 | }
14 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/myapp_proto.properties:
--------------------------------------------------------------------------------
1 | db.conn.user.name=localappuser
2 | db.conn.password=pass00rd
3 | java.api.protocol.mappings=pg://v1/sql-executor|org.jsmart.zerocode.zerocodejavaexec.DbSqlExecutor,\
4 | bar://v1/gremlin-exe|graph.ql.Exec,\
5 | bar1://v1/gremlin-exe|graph.ql.Exec,\
6 | bar2://v1/gremlin-exe|org.jsmart.zerocode.zerocodejavaexec.DbSqlExecutor
--------------------------------------------------------------------------------
/junit5-testing-examples/src/test/resources/github_host.properties:
--------------------------------------------------------------------------------
1 | # Web Server host and port
2 | web.application.endpoint.host=https://api.github.com
3 | # Web Service Port; Leave it blank in case it is default port i.e. 80 or 443 etc
4 | web.application.endpoint.port=
5 | # Web Service context; Leave it blank in case you do not have a common context
6 | web.application.endpoint.context=
7 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/postman_echo_host.properties:
--------------------------------------------------------------------------------
1 | # Web Server host and port
2 | web.application.endpoint.host=https://postman-echo.com
3 | # Web Service Port; Leave it blank in case it is default port i.e. 80 or 443 etc
4 | web.application.endpoint.port=
5 | # Web Service context; Leave it blank in case you do not have a common context
6 | web.application.endpoint.context=
7 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/Scenario.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 | import java.lang.annotation.Repeatable;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 |
7 | @Retention(RetentionPolicy.RUNTIME)
8 | @Repeatable( value = Scenarios.class )
9 | public @interface Scenario {
10 | String value();
11 | }
12 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/wiremock/test_mock_step.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Mock the Get Person",
3 | "operation": "GET",
4 | "url": "/google-guys/persons/p001",
5 | "response": {
6 | "status": 200,
7 | "body": {
8 | "id": "p001",
9 | "source": {
10 | "code": "GOOGLE.UK"
11 | }
12 | }
13 | }
14 | }
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/customer_web_app.properties:
--------------------------------------------------------------------------------
1 | # Web Server host and port
2 | restful.application.endpoint.host=http://localhost
3 | restful.application.endpoint.port=8888
4 |
5 | # Web Service context; Leave it blank in case you do not have a common context
6 | restful.application.endpoint.context=
7 |
8 | # WireMock will use this port for mocking dependent end points
9 | mock.api.port=8888
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/engine/sorter/SortOrder.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.engine.sorter;
2 |
3 | public enum SortOrder {
4 | NATURAL("natural"), REVERSE("reverse");
5 |
6 | String value;
7 |
8 | SortOrder(String order) {
9 | this.value = order;
10 | }
11 |
12 | public String getValue() {
13 | return value;
14 | }
15 |
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/core/src/test/resources/host_with_corp_proxy.properties:
--------------------------------------------------------------------------------
1 | #
2 | web.application.endpoint.host=https://soap-server.co.uk/ServiceName
3 | web.application.endpoint.port=443
4 |
5 | # Google Map Service Context
6 | web.application.endpoint.context=
7 |
8 | corporate.proxy.host=example.proxy.corp.co.uk
9 | corporate.proxy.port=80
10 | corporate.proxy.username=APPLEORANGE
11 | corporate.proxy.password=can3eat
12 |
--------------------------------------------------------------------------------
/core/src/test/resources/soap_host_with_corp_proxy.properties:
--------------------------------------------------------------------------------
1 | #
2 | web.application.endpoint.host=https://soap-server.co.uk/ServiceName
3 | web.application.endpoint.port=443
4 |
5 | # Google Map Service Context
6 | web.application.endpoint.context=
7 |
8 | corporate.proxy.host=example.proxy.corp.co.uk
9 | corporate.proxy.port=80
10 | corporate.proxy.username=APPLEORANGE
11 | corporate.proxy.password=can3eat
12 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/soap_stub/soap_request.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/14_validator_key_value_array.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "field": "foo",
4 | "value": "bar"
5 | },
6 | {
7 | "field": "age",
8 | "value": 23
9 | },
10 | {
11 | "field": "address",
12 | "value": {
13 | "line1": "East Croydon",
14 | "postcode": "ECY"
15 | }
16 | }
17 | ]
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/java_apis/02_test_json_java_service_method_no_param.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Given_When_Then-Flow name For Java Service",
3 | "loop": 5,
4 | "steps": [
5 | {
6 | "name": "javaMethodExecution",
7 | "url": "org.jsmart.zerocode.core.AddService",
8 | "operation": "anInteger",
9 | "request": "",
10 | "assertions": 30
11 | }
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/JsonTestCase.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 | import java.lang.annotation.Repeatable;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 |
7 | @Deprecated
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Repeatable( value = JsonTestCases.class )
10 | public @interface JsonTestCase {
11 | String value();
12 | }
13 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/filebody_unit_test/json_step_no_ext_json_test_file.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "create_emp",
3 | "url": "/api/test/v1/employess",
4 | "operation": "POST",
5 | "request": {
6 | "body": {
7 | "name": "Emma"
8 | }
9 | },
10 | "assertions": {
11 | "status": 201,
12 | "body": {
13 | "id": 100
14 | }
15 | }
16 | }
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/localhost_app.properties:
--------------------------------------------------------------------------------
1 | web.application.endpoint.host=http://localhost
2 | web.application.endpoint.port=8383
3 | web.application.endpoint.context=
4 |
5 | # To make the test PASS, update this value to 3000(3 sec) or anything higher than 2000.
6 | # Where 2000 milli-sec(2sec) is the delay from the Web(WireMock) server in responding
7 | # to the http request.
8 | http.max.timeout.milliseconds=2500
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 | *.log
3 |
4 | # Mobile Tools for Java (J2ME)
5 | .mtj.tmp/
6 |
7 | # Package Files #
8 | *.jar
9 | *.war
10 | *.ear
11 |
12 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
13 | hs_err_pid*
14 |
15 | *iml
16 | *.idea
17 | /target
18 | .DS_Store
19 | package.properties
20 |
21 | #for eclipse
22 | .classpath
23 | .project
24 | .settings
25 |
26 | */target
27 | .vscode
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/EnvProperty.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Target(ElementType.TYPE)
10 | public @interface EnvProperty {
11 | String value();
12 | }
13 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/TargetEnv.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Target(ElementType.TYPE)
10 | public @interface TargetEnv {
11 | String value();
12 | }
13 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/engine/preprocessor/ZeroCodeExternalFileProcessor.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.engine.preprocessor;
2 |
3 | import org.jsmart.zerocode.core.domain.Step;
4 |
5 | import java.util.List;
6 |
7 | public interface ZeroCodeExternalFileProcessor {
8 |
9 | Step resolveExtJsonFile(Step thisStep);
10 |
11 | List createFromStepFile(Step thisStep, String stepId);
12 | }
13 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/kafka/KafkaService.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.kafka;
2 |
3 | public interface KafkaService {
4 |
5 | String consume(String serviceName, String methodName, String requestJson);
6 |
7 | String produce(String kafkaServers, String topicName, String requestJson);
8 |
9 | String execute(String kafkaServers, String topicName, String operation, String requestJson);
10 | }
11 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworld_github_REST_api/GitHub_REST_api_step_reuse.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "GitHub Step Reuse @@Alex",
3 | "steps": [
4 | {
5 | "id" : "step1",
6 | "stepFile": "${JSON.FILE:steps/step1.json}"
7 |
8 | },
9 | {
10 | "id": "step2",
11 | "stepFile": "${JSON.FILE:steps/step2.json}"
12 | }
13 | ]
14 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/TestPackageRoot.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Target(ElementType.TYPE)
10 | public @interface TestPackageRoot {
11 | String value();
12 | }
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/filebody_unit_test/json_step_text_node_ext_json_file_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "create_emp",
3 | "url": "/api/test/v1/employess",
4 | "operation": "POST",
5 | "request": "${JSON.FILE:unit_test_files/filebody_unit_test/common/common_content_request.json}",
6 | "assertions": {
7 | "status": 201,
8 | "body": {
9 | "id": 100
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/TestMapping.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 |
4 | import java.lang.annotation.Repeatable;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 |
8 | @Retention(RetentionPolicy.RUNTIME)
9 | @Repeatable( value = TestMappings.class )
10 | public @interface TestMapping {
11 | Class> testClass();
12 | String testMethod();
13 | }
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/tests/customrunner/SimulatorState.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.tests.customrunner;
2 |
3 | public class SimulatorState {
4 | private static boolean started;
5 |
6 | public static boolean hasStarted() {
7 | return started;
8 | }
9 |
10 | public static void setStarted(boolean started) {
11 | SimulatorState.started = started;
12 | }
13 |
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/yaml/simple_get_api_test.yml:
--------------------------------------------------------------------------------
1 | ---
2 | scenarioName: As simple GET request response
3 | steps:
4 | - name: find_match
5 | url: "/api/v1/search/persons"
6 | method: GET
7 | request:
8 | queryParams:
9 | lang: Amazing
10 | city: Lon
11 | verify:
12 | status: 200
13 | body:
14 | exactMatches: true
15 | name: Mr Bean
16 | lang: Amazing
17 | city: Lon
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/06_test_single_step_parameterized_value.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "parameterized_csv_step",
3 | "url": "/persons",
4 | "operation": "POST",
5 | "request": {
6 | },
7 | "assertions": {
8 | "body": {
9 | "id": 1001
10 | }
11 | },
12 | "parameterized": [
13 | "Hello",
14 | 123,
15 | true
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/kafka_servers/kafka_test_bad_server.properties:
--------------------------------------------------------------------------------
1 | # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
2 | # kafka bootstrap servers comma separated
3 | # e.g. localhost:9092,host2:9093
4 | # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
5 | kafka.bootstrap.servers=localhost:9999
6 |
7 | kafka.producer.properties=kafka_servers/kafka_producer.properties
8 | kafka.consumer.properties=kafka_servers/kafka_consumer.properties
9 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/07_test_single_step_parameterized_csv.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "StepNameWithoutSpaceEgCREATE",
3 | "url": "/persons",
4 | "operation": "POST",
5 | "request": {
6 | },
7 | "assertions": {
8 | "body": {
9 | "id": 1001
10 | }
11 | },
12 | "parameterizedCsv": [
13 | "1, 2, 3",
14 | "11, 22, 33"
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/Scenarios.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 |
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | @Target(ElementType.TYPE)
10 | @Retention(RetentionPolicy.RUNTIME)
11 | public @interface Scenarios {
12 | public Scenario[] value() default {};
13 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/engine/sorter/ZeroCodeSorter.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.engine.sorter;
2 |
3 | import org.jsmart.zerocode.core.domain.Step;
4 | import org.jsmart.zerocode.core.engine.assertion.FieldAssertionMatcher;
5 |
6 | import java.util.List;
7 |
8 | public interface ZeroCodeSorter {
9 |
10 | String sortArrayAndReplaceInResponse(Step thisStep, String results, String resolvedScenarioState);
11 | }
12 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/zzignored/trick/LogHello.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.zzignored.trick;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 |
6 | public class LogHello {
7 | private static final Logger LOGGER = LoggerFactory.getLogger(LogHello.class);
8 |
9 | public static void main(String[] args) {
10 | LOGGER.debug("###Hello - " + LogHello.class.getName());
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/junit5-testing-examples/src/test/java/org/jsmart/zerocode/tests/junit4/JUnit4Test.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.tests.junit4;
2 |
3 |
4 | import org.junit.Test;
5 |
6 | import static org.junit.Assert.assertTrue;
7 |
8 |
9 | public class JUnit4Test {
10 |
11 | @Test
12 | public void testJunit4_passed() {
13 | String msg = "junit4 works as usual";
14 | assertTrue("junit4 works as usual".equals(msg));
15 | }
16 |
17 | }
--------------------------------------------------------------------------------
/zerocode-maven-archetype/src/main/resources/archetype-resources/src/test/resources/hostconfig_ci.properties:
--------------------------------------------------------------------------------
1 | #Continuous Integration Context
2 | # Web Server host and port
3 | web.application.endpoint.host=https://api.github.com
4 | # Web Service Port; Leave it blank in case it is default port i.e. 80 or 443 etc
5 | web.application.endpoint.port=
6 | # Web Service context; Leave it blank in case you do not have a common context
7 | web.application.endpoint.context=
--------------------------------------------------------------------------------
/zerocode-maven-archetype/src/main/resources/archetype-resources/src/test/resources/hostconfig_sit.properties:
--------------------------------------------------------------------------------
1 | #System Integration Testing Context
2 | # Web Server host and port
3 | web.application.endpoint.host=https://api.github.com
4 | # Web Service Port; Leave it blank in case it is default port i.e. 80 or 443 etc
5 | web.application.endpoint.port=
6 | # Web Service context; Leave it blank in case you do not have a common context
7 | web.application.endpoint.context=
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/JsonTestCases.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 |
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | @Target(ElementType.TYPE)
10 | @Retention(RetentionPolicy.RUNTIME)
11 | public @interface JsonTestCases {
12 | public JsonTestCase[] value() default {};
13 | }
--------------------------------------------------------------------------------
/core/src/main/resources/engine/request_respone_actual.json:
--------------------------------------------------------------------------------
1 | {
2 | "createPerson": {
3 | "request":{
4 | "id" : "10101"
5 | },
6 | "response": {
7 | "status" : 201,
8 | "addresses":[
9 | {
10 | "houseNo": "9"
11 | },
12 | {
13 | "houseNo": "11"
14 | }
15 | ],
16 | "names":[
17 | "Rose",
18 | "Rosalin",
19 | "Rosy"
20 | ]
21 | }
22 | }
23 | }
--------------------------------------------------------------------------------
/core/src/test/resources/web_app.properties:
--------------------------------------------------------------------------------
1 | # Web Server host and port
2 | web.application.endpoint.host=http://localhost
3 | web.application.endpoint.port=8889
4 |
5 | # Web Service context; Leave it blank in case you do not have a common context
6 | web.application.endpoint.context=
7 |
8 | # WireMock will use this port for mocking dependent end points
9 | mock.api.port=8889
10 | #mock.api.port=8888 # Tensor Flow - Jupyter runs at 8888 during Python linear regression.
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworld_implicit_delay/http_implicit_delay_max_timeout_scenario.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Validate Http Implicit Delay or Max Timeout",
3 | "steps": [
4 | {
5 | "name": "verify_mock",
6 | "url": "/delay/ids/2",
7 | "method": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200
12 | }
13 | }
14 |
15 | ]
16 | }
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/defaultrunner/DefaultRunnerTestRunManuallyOnly.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.defaultrunner;
2 |
3 | import org.jsmart.zerocode.core.runner.ZeroCodePackageRunner;
4 | import org.jsmart.zerocode.core.domain.TestPackageRoot;
5 | import org.junit.runner.RunWith;
6 |
7 | @TestPackageRoot("unit_test_files/default_cases")
8 | @RunWith(ZeroCodePackageRunner.class)
9 | public class DefaultRunnerTestRunManuallyOnly {
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/yaml/string_optional_double_quotes_test.yml:
--------------------------------------------------------------------------------
1 | ---
2 | scenarioName: As simple GET request response
3 | steps:
4 | - name: "find_match"
5 | url: "/api/v1/search/persons"
6 | operation: "GET"
7 | request:
8 | queryParams:
9 | lang: "Amazing"
10 | city: "Lon"
11 | verify:
12 | status: 200
13 | body:
14 | exactMatches: true
15 | name: "Mr Bean"
16 | lang: "Amazing"
17 | city: "Lon"
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/java_apis/03_test_json_java_service_method_Exception.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Given_When_Then-Flow name For Java Service",
3 | "steps": [
4 | {
5 | "name": "javaMethodException",
6 | "url": "org.jsmart.zerocode.core.AddService",
7 | "operation": "squareRoot",
8 | "request": "-255.0", //<-- This negative number should throw an exception
9 | "assertions": {
10 | }
11 | }
12 | ]
13 | }
14 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/KafkaProduceJsonButNotReallyJsonTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce;
2 |
3 | import org.junit.Test;
4 |
5 | public class KafkaProduceJsonButNotReallyJsonTest {
6 |
7 | @Test
8 | public void testNothing() {
9 | // See the KafkaConsumeJsonNotReallyJsonTest.java
10 | // which has both produce and consumer test
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/kafka/client/ZerocodeCustomKafkaClient.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.kafka.client;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 |
6 | public class ZerocodeCustomKafkaClient extends BasicKafkaClient{
7 | private static final Logger LOGGER = LoggerFactory.getLogger(ZerocodeCustomKafkaClient.class);
8 |
9 | public ZerocodeCustomKafkaClient() {
10 | super();
11 | }
12 |
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/core/src/main/resources/01_verification_test_cases/20_non_json_assert_part_string.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "20_non_json_assert_part_string",
3 | "steps": [
4 | {
5 | "name": "get_call",
6 | "url": "/api/nonjson",
7 | "operation": "GET",
8 | "request": {
9 |
10 | },
11 | "assertions": {
12 | "status": 200,
13 | "body": "$NULL",
14 | "rawBody": "$CONTAINS.STRING:non-j"
15 | }
16 | }
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/domain/builders/ZeroCodeIoWriteBuilderTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain.builders;
2 |
3 | import org.junit.Test;
4 |
5 | public class ZeroCodeIoWriteBuilderTest {
6 |
7 | @Test
8 | public void testActual() throws Exception {
9 | // See the test -
10 | // org.jsmart.zerocode.core.verification.loopreport.SmartJUnitNavigatorReportGenTest.willGeneratReportLoopSceneMultiStepsLoop2_once
11 | }
12 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/utils/RandomNumberGenerator.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.utils;
2 |
3 | import java.util.concurrent.ThreadLocalRandom;
4 |
5 | public class RandomNumberGenerator {
6 |
7 | public String generateRandomNumber() {
8 | return String.valueOf(Math.abs(ThreadLocalRandom.current().nextLong()));
9 | }
10 |
11 | @Override
12 | public String toString() {
13 | return this.generateRandomNumber();
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/soap/xml_files/soap_request.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | AFA
6 | GBP
7 |
8 |
9 |
--------------------------------------------------------------------------------
/docker/compose/pg_compose.yml:
--------------------------------------------------------------------------------
1 | # Use postgres/example user/password credentials
2 | # Then visit http://localhost:8080, or http://swarm-ip:8080, or http://host-ip:8080 (as appropriate).
3 | # Tested with adminer:4.7.0
4 | # How to Wiki : https://github.com/authorjapps/zerocode-docker-factory/wiki/Docker-container-for-a-Postgres-DB
5 | version: '3'
6 |
7 | services:
8 | db:
9 | image: postgres:9.3
10 | restart: always
11 | environment:
12 | POSTGRES_PASSWORD: example
13 | ports:
14 | - 35432:5432
15 |
--------------------------------------------------------------------------------
/zerocode-maven-archetype/src/main/resources/archetype-resources/src/test/java/MyApiSuite.java:
--------------------------------------------------------------------------------
1 | package ${groupId};
2 |
3 | import org.junit.runner.RunWith;
4 | import org.junit.runners.Suite;
5 | import org.junit.runners.Suite.SuiteClasses;
6 |
7 | import ${groupId}.tests.MyGetApiTest;
8 | import ${groupId}.tests.MyPutApiTest;
9 | import ${groupId}.tests.MyPostApiTest;
10 |
11 | @RunWith(Suite.class)
12 | @SuiteClasses({MyGetApiTest.class, MyPostApiTest.class, MyPutApiTest.class})
13 | public class MyApiSuite {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/reports/01_basic_report_for_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "timeStamp": "2016-07-23T08:11:15.217",
3 | "results": [
4 | {
5 | "scenarioName": "scenario name",
6 | "loop": 10,
7 | "steps": [
8 | {
9 | "loop": 30,
10 | "name": "step_create",
11 | "url": "/home/googly",
12 | "correlationId": "correlation Id",
13 | "operation": "POST-POST",
14 | "result": "PASS-PASS"
15 | }
16 | ]
17 | }
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/verify/SmartPackagedVerification.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.verify;
2 |
3 | import org.jsmart.zerocode.core.domain.TargetEnv;
4 | import org.jsmart.zerocode.core.domain.TestPackageRoot;
5 | import org.jsmart.zerocode.core.runner.ZeroCodePackageRunner;
6 | import org.junit.runner.RunWith;
7 |
8 | @TargetEnv("dev_test.properties")
9 | @TestPackageRoot("01_verification_test_cases")
10 | @RunWith(ZeroCodePackageRunner.class)
11 | public class SmartPackagedVerification {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/12_scenario_parameterized_wrong_dsl.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "For deserialize only",
3 | "ignoreStepFailures": true,
4 | "steps": [
5 | {
6 | "name": "step1",
7 | "url": "/anUrl/${0}",
8 | "operation": "GET",
9 | "request": {
10 | },
11 | "assertions": {
12 | "status": 900
13 | }
14 | }
15 | ],
16 | "parameterized": {
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/Body.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 | public class Body {
4 | private final T bodyJson;
5 | private final String bodyString;
6 |
7 | public Body(T bodyJson, String bodyString) {
8 | this.bodyJson = bodyJson;
9 | this.bodyString = bodyString;
10 | }
11 |
12 | public T getBodyJson() {
13 | return bodyJson;
14 | }
15 |
16 | public String getBodyString() {
17 | return bodyString.toString();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/core/src/test/resources/load_test_files/simple_load_at_localhost.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Get call to home will fetch details",
3 | "steps": [
4 | {
5 | "name": "fetch_home_details",
6 | "url": "/home/bathroom/1",
7 | "operation": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "id": 1
14 | }
15 | }
16 | }
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/filebody_unit_test/json_step_test_wrong_file_ref.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "create_emp",
3 | "url": "/api/test/v1/employess",
4 | "operation": "POST",
5 | "request": {
6 | "headers": "${JSON.FILE:filebody_unit_test/common/common_content_WRONG.json}",
7 | "body": "${JSON.FILE:filebody_unit_test/common/common_content.json}"
8 | },
9 | "assertions": {
10 | "status": 201,
11 | "body": "${JSON.FILE:filebody_unit_test/common/common_content.json}"
12 | }
13 | }
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/AddServiceTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core;
2 |
3 | import org.junit.Test;
4 |
5 | import static org.hamcrest.CoreMatchers.is;
6 | import static org.junit.Assert.assertThat;
7 |
8 | public class AddServiceTest {
9 |
10 | @Test
11 | public void willAddTwoWholeNumbers() throws Exception {
12 | AddService addService = new AddService();
13 | int sum = addService.add(4, 6);
14 |
15 | assertThat("Addition failed for two whole numbers", sum, is(10));
16 | }
17 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/kafka/KafkaConstants.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.kafka;
2 |
3 | public interface KafkaConstants {
4 |
5 | Integer MAX_NO_OF_RETRY_POLLS_OR_TIME_OUTS = 5;
6 |
7 | Long DEFAULT_POLLING_TIME_MILLI_SEC = 100L;
8 |
9 | String RAW = "RAW";
10 |
11 | String JSON = "JSON";
12 |
13 | String AVRO = "AVRO";
14 |
15 | String PROTO = "PROTO";
16 |
17 | String RECORD_TYPE_JSON_PATH = "$.recordType";
18 |
19 | String PROTO_BUF_MESSAGE_CLASS_TYPE = "$.protoClassType";
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/core/src/test/resources/load_test_files/simple_load_at_localhost_fail.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Load- Get call to home will fetch details -Fail",
3 | "steps": [
4 | {
5 | "name": "fetch_home_details",
6 | "url": "/home/bathroom/1",
7 | "operation": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 400,
12 | "body": {
13 | "id": 1
14 | }
15 | }
16 | }
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/java_apis/01_test_json_java_service_method_Integer.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Given_When_Then-Flow name For Java Service",
3 | "loop": 5,
4 | //comments -- Allowed
5 | "steps": [
6 | {
7 | "loop": 3,
8 | "name": "javaMethodExecution", //<-- with comments
9 | "url": "org.jsmart.zerocode.core.AddService",
10 | "operation": "square",
11 | "request": "255", //<-- Because this is as good as premitive, not an Object type
12 | "assertions": {
13 | }
14 | }
15 | ]
16 | }
17 |
--------------------------------------------------------------------------------
/core/src/main/resources/01_verification_test_cases/02_java_service_single_step.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "DEV-Java Service",
3 | "loop": 1,
4 | "steps": [
5 | {
6 | "loop": 1,
7 | "name": "javaMethodExecution", //<-- with comments
8 | "url": "org.jsmart.zerocode.core.AddService",
9 | "operation": "squareMyNumber",
10 | "request": {
11 | "number": 30
12 | },
13 | "assertions": {
14 | "status": 201,
15 | "body": {
16 | "id": 1001
17 | }
18 | }
19 | }
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/http-testing-examples/src/main/java/org/jsmart/zerocode/zerocodejavaexec/httpclient/JustHelloWorldSuite.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.zerocodejavaexec.httpclient;
2 |
3 | import org.jsmart.zerocode.core.domain.TargetEnv;
4 | import org.jsmart.zerocode.core.domain.TestPackageRoot;
5 | import org.jsmart.zerocode.core.runner.ZeroCodePackageRunner;
6 | import org.junit.runner.RunWith;
7 |
8 | @TargetEnv("hello_github_host.properties")
9 | @TestPackageRoot("/helloworld")
10 | @RunWith(ZeroCodePackageRunner.class)
11 | public class JustHelloWorldSuite {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/module/GsonModule.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.di.module;
2 |
3 | import com.google.gson.Gson;
4 | import com.google.inject.Binder;
5 | import com.google.inject.Module;
6 | import jakarta.inject.Singleton;
7 | import org.jsmart.zerocode.core.di.provider.GsonSerDeProvider;
8 |
9 |
10 | public class GsonModule implements Module {
11 |
12 | @Override
13 | public void configure(Binder binder) {
14 | binder.bind(Gson.class).toProvider(GsonSerDeProvider.class).in(Singleton.class);
15 | }
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/tests/SmartPackagedTestCases.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.tests;
2 |
3 | import org.jsmart.zerocode.core.domain.TargetEnv;
4 | import org.jsmart.zerocode.core.domain.TestPackageRoot;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodePackageRunner;
6 | import org.junit.runner.RunWith;
7 |
8 | @TargetEnv("config_hosts.properties")
9 | @TestPackageRoot("integration_test_files/json_paths_jayway")
10 | @RunWith(TestOnlyZeroCodePackageRunner.class)
11 | public class SmartPackagedTestCases {
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/filebody_unit_test/json_step_test_file.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "create_emp",
3 | "url": "/api/test/v1/employess",
4 | "operation": "POST",
5 | "request": {
6 | "headers": "${JSON.FILE:unit_test_files/filebody_unit_test/common/common_content.json}",
7 | "body": "${JSON.FILE:unit_test_files/filebody_unit_test/common/common_content.json}"
8 | },
9 | "assertions": {
10 | "status": 201,
11 | "body": "${JSON.FILE:unit_test_files/filebody_unit_test/common/common_content.json}"
12 | }
13 | }
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/json_paths_jayway/02_java_service_single_step.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Java Service",
3 | "loop": 5,
4 | "steps": [
5 | {
6 | "name": "javaMethodExecution", //<-- with comments
7 | "loop": 3,
8 | "url": "org.jsmart.zerocode.core.AddService",
9 | "operation": "squareMyNumber",
10 | "request": {
11 | "number": 30
12 | },
13 | "assertions": {
14 | "status": 201,
15 | "body": {
16 | "id": 1001
17 | }
18 | }
19 | }
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/json_content_unit_test/json_step_no_json_content_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "get_user_details",
3 | "url": "/api/v1/employees/${$.create_emp.response.body.id}",
4 | "method": "GET",
5 | "request": {
6 | "body" : {
7 | "fullName":"Bob Luis",
8 | "empLogin":"bolu_lon",
9 | "type":"CONTRACT"
10 | }
11 | },
12 | "verify": {
13 | "status": 200,
14 | "body": {
15 | "id": 39001,
16 | "ldapId": "emmanorton",
17 | "name": "Emma",
18 | "surName": "Norton"
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/wiremock/test_mock_step_request_headers.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Mock the Get Person With Request Headers",
3 | "operation": "GET",
4 | "url": "/google-guys/persons/p001",
5 | "request" : {
6 | "headers":{
7 | "key": "key-001",
8 | "secret": "secret-001"
9 | }
10 | },
11 | "response": {
12 | "status": 200,
13 | "body": {
14 | "id": "p001",
15 | "source": {
16 | "code": "GOOGLE.UK"
17 | }
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/one_of/oneOf_test_expectedArrayEmpty.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Assert that 'currentStatus' is one of array items which is empty",
3 | "steps": [
4 | {
5 | "name": "get_person_job_details",
6 | "url": "",
7 | "operation": "",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "currentStatus": "$ONE.OF:[]"
14 | }
15 | }
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/provider/DefaultGuiceHttpClientProvider.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.di.provider;
2 |
3 | import jakarta.inject.Provider;
4 | import org.jsmart.zerocode.core.httpclient.BasicHttpClient;
5 | import org.jsmart.zerocode.core.httpclient.ssl.SslTrustHttpClient;
6 |
7 | public class DefaultGuiceHttpClientProvider implements Provider {
8 |
9 | @Override
10 | public BasicHttpClient get() {
11 |
12 | BasicHttpClient client = new SslTrustHttpClient();
13 |
14 | return client;
15 | }
16 |
17 | }
--------------------------------------------------------------------------------
/core/src/main/resources/01_verification_test_cases/09_host_port_annotated_bu_failed_assertion.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "09_host_port_annotated_bu_failed_assertion.json",
3 | "steps": [
4 | {
5 | "name": "get_hotel_resource",
6 | "url": "/home/bathroom/google_id_01",
7 | "operation": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "id" : 1,
14 | "name" : "G Hotel Shower",
15 | "availability" : true
16 | }
17 | }
18 | }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/kafka/produce/WIP_test_kafka_publish_inline_server.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Load - publish a message to kafka",
3 | "steps": [
4 | {
5 | "name": "load_kafka",
6 | "url": "kafka-topic:192.168.99.1:9092:demo",
7 | "operation": "load",
8 | "request": {
9 | "key": "${RANDOM.NUMBER}",
10 | "value": "Hello World"
11 | },
12 | "assertions": {
13 | "status": "Ok"
14 | }
15 | }
16 | ]
17 | }
18 |
--------------------------------------------------------------------------------
/core/src/main/resources/01_verification_test_cases/08_get_with_inline_host_port_context.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "08_get_with_inline_host_port_context.json",
3 | "steps": [
4 | {
5 | "name": "get_hotel_resource", //A hotel resource
6 | "url": "/home/bathroom/google_id_01",
7 | "operation": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "id": 1,
14 | "name": "G Hotel Shower",
15 | "availability": true
16 | }
17 | }
18 | }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/core/src/test/resources/soap_host.properties:
--------------------------------------------------------------------------------
1 | #
2 | web.application.endpoint.host=http://www.webservicex.net
3 | web.application.endpoint.port=80
4 |
5 | # Google Map Service Context
6 | web.application.endpoint.context=
7 |
8 | # This is false by default, it runs even if this property is not present here
9 | report.spike.chart.enabled=true
10 |
11 | # This is false by default, it runs even if this property is not present here
12 | # If you do not want the html-searchable-report, then set this flag to true
13 | interactive.html.report.disabled=true
14 |
15 | http.max.timeout.milliseconds=2000
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/filebody_unit_test/json_step_test_file_recursive.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "create_emp",
3 | "url": "/api/test/v1/employess",
4 | "operation": "POST",
5 | "request": {
6 | "headers": "${JSON.FILE:unit_test_files/filebody_unit_test/common/common_content.json}",
7 | "body": "${JSON.FILE:unit_test_files/filebody_unit_test/common/common_content_recursive.json}"
8 | },
9 | "assertions": {
10 | "status": 201,
11 | "body": "${JSON.FILE:unit_test_files/filebody_unit_test/common/common_content.json}"
12 | }
13 | }
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/one_of/oneOf_test_currentStatus.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Assert that 'currentStatus' is one of array items",
3 | "steps": [
4 | {
5 | "name": "get_person_job_details",
6 | "url": "",
7 | "operation": "",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "currentStatus": "$ONE.OF:[Found, Searching, Not Looking]"
14 | }
15 | }
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/TestUtility.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode;
2 |
3 | import com.fasterxml.jackson.databind.node.NullNode;
4 | import org.jsmart.zerocode.core.domain.Step;
5 |
6 | import java.util.Collections;
7 |
8 | public class TestUtility {
9 | private TestUtility() {
10 |
11 | }
12 |
13 | public static Step createDummyStep(String stepName) {
14 | return new Step(1, null, stepName, "dummy", "dummy", "dummy", null, Collections.emptyList(), NullNode.getInstance(), NullNode.getInstance(), NullNode.getInstance(), "dummy", false);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/javamethod/JavaMethodExecTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.javamethod;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 |
8 | @RunWith(ZeroCodeUnitRunner.class)
9 | public class JavaMethodExecTest {
10 |
11 | @Test
12 | @JsonTestCase("unit_test_files/java_apis/02_test_json_java_service_method_no_param.json")
13 | public void testJavaMethod_noParams() throws Exception {
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/core/src/main/resources/dsl_formats/dsl_parameterized_values.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Scenario with parameterized values",
3 | "ignoreStepFailures": true,
4 | "steps": [
5 | {
6 | "name": "step1",
7 | "url": "/anUrl/${0}",
8 | "operation": "GET",
9 | "request": {
10 | },
11 | "assertions": {
12 | "status": 200
13 | }
14 | }
15 | ],
16 | "parameterized": {
17 | "valueSource": [
18 | "hello",
19 | 123
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/parallel/restful/LoadRestEndPointSingleRunnerTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.parallel.restful;
2 |
3 | import org.jsmart.zerocode.core.domain.LoadWith;
4 | import org.jsmart.zerocode.core.domain.TestMapping;
5 | import org.jsmart.zerocode.core.runner.parallel.ZeroCodeLoadRunner;
6 | import org.junit.runner.RunWith;
7 |
8 | @LoadWith("load_config_test.properties")
9 | @TestMapping(testClass = JunitRestTestSample.class, testMethod = "testGetCallToHome_pass")
10 | @RunWith(ZeroCodeLoadRunner.class)
11 | public class LoadRestEndPointSingleRunnerTest {
12 |
13 | }
--------------------------------------------------------------------------------
/core/src/main/resources/01_verification_test_cases/10_text_node_json_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "10_text_node_json_test",
3 | "steps": [
4 | {
5 | "name": "get_call",
6 | "url": "/api/textnodejson",
7 | "operation": "GET",
8 | "request": {
9 | "headers": {
10 | "Content-Type": "application/json;charset=UTF-8",
11 | "Cookie": "cookie_123"
12 | },
13 | "body": {
14 | }
15 | },
16 | "assertions": {
17 | "status": 200,
18 | "body": "valid-text-node-json"
19 | }
20 | }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/place_holders/05_REST_end_point_nonJson_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Testing text-node-json content",
3 | "steps": [
4 | {
5 | "loop": 3,
6 | "name": "get_nonjson",
7 | "url": "/api/nonjson",
8 | "operation": "GET",
9 | "request": {
10 | "headers": {
11 | "Content-Type": "application/json;charset=UTF-8",
12 | "Cookie": "cookie_123"
13 | }
14 | },
15 | "assertions": {
16 | "status": 201,
17 | "rawBody": "non-jsonX"
18 | }
19 | }
20 |
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/module/KafkaModule.java:
--------------------------------------------------------------------------------
1 | //package org.jsmart.zerocode.core.di.module;
2 | //
3 | //import com.google.inject.Binder;
4 | //import com.google.inject.Module;
5 | //import org.jsmart.zerocode.core.di.provider.KafkaServicesProvider;
6 | //import org.jsmart.zerocode.core.kafka.KafkaService;
7 | //
8 | //import javax.inject.Singleton;
9 | //
10 | //public class KafkaModule implements Module {
11 | //
12 | // public void configure(Binder binder) {
13 | // binder.bind(KafkaService.class).toProvider(KafkaServicesProvider.class).in(Singleton.class);
14 | // }
15 | //}
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/one_of/oneOf_test_whiteSpace.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Assert that 'currentStatus' is one of array items, including a whitespace",
3 | "steps": [
4 | {
5 | "name": "get_person_job_details",
6 | "url": "",
7 | "operation": "",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "currentStatus": "$ONE.OF:[Found, Searching, , Not Looking]"
14 | }
15 | }
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/kafka-testing-examples/src/main/proto/Persons.proto:
--------------------------------------------------------------------------------
1 | syntax = "proto2";
2 |
3 | package tutorial;
4 |
5 | option java_package = "org.jsmart.zerocode.proto";
6 | option java_outer_classname = "PersonsProto";
7 |
8 | message Person {
9 | required string name = 1;
10 | required int32 id = 2;
11 | optional string email = 3;
12 |
13 | enum PhoneType {
14 | MOBILE = 0;
15 | HOME = 1;
16 | WORK = 2;
17 | }
18 |
19 | message PhoneNumber {
20 | required string number = 1;
21 | optional PhoneType type = 2 [default = HOME];
22 | }
23 |
24 | repeated PhoneNumber phones = 4;
25 | }
26 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/provider/ObjectMapperProvider.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.di.provider;
2 |
3 | import com.fasterxml.jackson.core.JsonParser;
4 | import com.fasterxml.jackson.databind.ObjectMapper;
5 | import jakarta.inject.Provider;
6 |
7 | public class ObjectMapperProvider implements Provider {
8 |
9 | @Override
10 | public ObjectMapper get() {
11 |
12 | ObjectMapper objectMapper = new ObjectMapper();
13 | objectMapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
14 |
15 | return objectMapper;
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/one_of/oneOf_test_emptyString.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Assert that 'currentStatus' is one of array items, including an empty string",
3 | "steps": [
4 | {
5 | "name": "get_person_job_details",
6 | "url": "",
7 | "operation": "",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "currentStatus": "$ONE.OF:[Found, Searching,, Not Looking]"
14 | }
15 | }
16 | }
17 | ]
18 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/runner/ZeroCodeMultiStepsScenarioRunner.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.runner;
2 |
3 | import org.jsmart.zerocode.core.domain.ScenarioSpec;
4 | import org.junit.runner.Description;
5 | import org.junit.runner.notification.RunNotifier;
6 |
7 | import java.util.function.BiConsumer;
8 |
9 | public interface ZeroCodeMultiStepsScenarioRunner {
10 |
11 | boolean runScenario(ScenarioSpec scenarioSpec, RunNotifier notifier, Description description);
12 |
13 | boolean runChildStep(ScenarioSpec scenarioSpec, BiConsumer testPassHandler);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/place_holders/04_REST_end_point_textNodeJson_response.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Testing non-json content",
3 | "steps": [
4 | {
5 | "loop": 3,
6 | "name": "get_textjson",
7 | "url": "/api/textnodejson",
8 | "operation": "GET",
9 | "request": {
10 | "headers": {
11 | "Content-Type": "application/json;charset=UTF-8",
12 | "Cookie": "cookie_123"
13 | }
14 | },
15 | "assertions": {
16 | "status": 201,
17 | "body": "valid-text-node-json"
18 | }
19 | }
20 |
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/kafka/metadata/WIP_test_kafka_topic_details.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Meta-data - Get topic details",
3 | "steps": [
4 | {
5 | "name": "load_kafka",
6 | "url": "kafka-topic://demo",
7 | "operation": "any-kafka-command-to-execute against the topic demo",
8 | "request": {
9 | "name": "demo",
10 | "broker-name": "kafka-server.corpbank.com"
11 | },
12 | "assertions": {
13 | "status": "OK"
14 | }
15 | }
16 |
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/module/CsvParserModule.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.di.module;
2 |
3 | import com.google.inject.Binder;
4 | import com.google.inject.Module;
5 | import jakarta.inject.Singleton;
6 | import org.jsmart.zerocode.core.di.provider.CsvParserInterface;
7 | import org.jsmart.zerocode.core.di.provider.CsvParserProvider;
8 |
9 | public class CsvParserModule implements Module {
10 |
11 | @Override
12 | public void configure(Binder binder) {
13 | binder.bind(CsvParserInterface.class).toProvider(CsvParserProvider.class).in(Singleton.class);
14 | }
15 | }
16 |
17 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/yaml/scenario_get_api_test.yml:
--------------------------------------------------------------------------------
1 | ---
2 | scenarioName: "A simple GET API Scenario" #comments allowed
3 | steps:
4 | - name: "find_match"
5 | url: "/api/v1/persons/p001"
6 | operation: "GET"
7 | request:
8 | headers:
9 | x-api-key: "Ama-zing-key"
10 | x-api-secret: "Sec-ret-stuff"
11 | verify:
12 | status: 200 #comment - a http status code as int value
13 | body:
14 | exactMatches: true
15 | name: "Mr Bean"
16 | addresses:
17 | - type: "office"
18 | line1: "10 Random St"
19 | - type: "home"
20 | line1: "300 Random St"
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldjavaexec/StaticMethodExecTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldjavaexec;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 |
8 | @RunWith(ZeroCodeUnitRunner.class)
9 | public class StaticMethodExecTest {
10 |
11 | @Test
12 | @Scenario("helloworldjavaexec/java_static_method_test.json")
13 | public void test_multi_arg_method_exec() throws Exception {
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/provider/KafkaServicesProvider.java:
--------------------------------------------------------------------------------
1 | //package org.jsmart.zerocode.core.di.provider;
2 | //
3 | //import org.jsmart.zerocode.core.kafka.KafkaService;
4 | //import org.jsmart.zerocode.core.kafka.KafkaServiceImpl;
5 | //
6 | //import javax.inject.Provider;
7 | //
8 | //public class KafkaServicesProvider implements Provider {
9 | //
10 | // @Override
11 | // public KafkaService get() {
12 | //
13 | // KafkaService kafkaService = new KafkaServiceImpl();
14 | // // Read the properties etc
15 | //
16 | // return kafkaService;
17 | // }
18 | //
19 | //}
--------------------------------------------------------------------------------
/core/src/main/resources/01_verification_test_cases/15_non_json_string_body_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "15_non_json_string_body_test",
3 | "steps": [
4 | {
5 | "name": "get_call",
6 | "url": "/api/nonjson",
7 | "operation": "GET",
8 | "request": {
9 | "headers": {
10 | "Content-Type": "application/json;charset=UTF-8",
11 | "Cookie": "cookie_123"
12 | },
13 | "body": {
14 | }
15 | },
16 | "assertions": {
17 | "status": 200,
18 | "body": "$NULL",
19 | "rawBody": "non-json"
20 | }
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/verification/ZeroCodePackageRunnerIgnoreTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.verification;
2 |
3 | import org.jsmart.zerocode.core.domain.TargetEnv;
4 | import org.jsmart.zerocode.core.domain.TestPackageRoot;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodePackageRunner;
6 | import org.junit.Ignore;
7 | import org.junit.runner.RunWith;
8 |
9 | @Ignore
10 | @TargetEnv("dev_test.properties")
11 | @TestPackageRoot("01_verification_test_cases")
12 | @RunWith(TestOnlyZeroCodePackageRunner.class)
13 | public class ZeroCodePackageRunnerIgnoreTest {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/yaml/YamlUnitTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.yaml;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 |
10 | @TargetEnv("github_host_test.properties")
11 | @RunWith(ZeroCodeUnitRunner.class)
12 | public class YamlUnitTest {
13 |
14 | @Test
15 | @JsonTestCase("unit_test_files/yaml/scenario_get_api_step_test.yml")
16 | public void testGitHubApi_get() {
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/module/HttpClientModule.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.di.module;
2 |
3 | import com.google.inject.Binder;
4 | import com.google.inject.Module;
5 | import jakarta.inject.Singleton;
6 | import org.jsmart.zerocode.core.di.provider.DefaultGuiceHttpClientProvider;
7 | import org.jsmart.zerocode.core.httpclient.BasicHttpClient;
8 |
9 | public class HttpClientModule implements Module {
10 |
11 | @Override
12 | public void configure(Binder binder) {
13 | binder.bind(BasicHttpClient.class).toProvider(DefaultGuiceHttpClientProvider.class).in(Singleton.class);
14 | }
15 | }
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/verification/ZeroCodePackageRunnerVerification.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.verification;
2 |
3 | import org.jsmart.zerocode.core.domain.TargetEnv;
4 | import org.jsmart.zerocode.core.domain.TestPackageRoot;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodePackageRunner;
6 | import org.junit.runner.RunWith;
7 |
8 | @TargetEnv("dev_test.properties")
9 | @TestPackageRoot("01_verification_test_cases")
10 | //@RunWith(ZeroCodePackageRunner.class)
11 | @RunWith(TestOnlyZeroCodePackageRunner.class)
12 | public class ZeroCodePackageRunnerVerification {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/verification/hostproperties/PropertiesInStepsPackageRunnerTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.verification.hostproperties;
2 |
3 | import org.jsmart.zerocode.core.domain.TargetEnv;
4 | import org.jsmart.zerocode.core.domain.TestPackageRoot;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodePackageRunner;
6 | import org.junit.runner.RunWith;
7 |
8 | @TargetEnv("dev_test.properties")
9 | @TestPackageRoot("integration_test_files/host_keys")
10 | @RunWith(TestOnlyZeroCodePackageRunner.class)
11 | public class PropertiesInStepsPackageRunnerTest {
12 |
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/10_scenario_parameterized_values.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Scenario with parameterized values",
3 | "ignoreStepFailures": true,
4 | "steps": [
5 | {
6 | "name": "step1",
7 | "url": "/anUrl/${0}",
8 | "operation": "GET",
9 | "request": {
10 | },
11 | "assertions": {
12 | "status": 900
13 | }
14 | }
15 | ],
16 | "parameterized": {
17 | "valueSource": [
18 | "hello",
19 | 123
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/java_apis/01_test_json_java_service_method_MyNumber.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Given_When_Then-Flow name For Java Service",
3 | "loop": 5,
4 | //comments -- Allowed
5 | "steps": [
6 | {
7 | "loop": 3,
8 | "name": "javaMethodExecution", //<-- with comments
9 | "url": "org.jsmart.zerocode.core.AddService",
10 | "operation": "squareMyNumber",
11 | "request": {
12 | "number": 30
13 | },
14 | "assertions": {
15 | "status": 201,
16 | "body": {
17 | "id": 1001
18 | }
19 | }
20 | }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworld_github_REST_api/GitHub_REST_api_more_assertions.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "GitHub GET API and more @@Alex",
3 | "steps": [
4 | {
5 | "name": "get_github_server_details",
6 | "url": "/users/albertosipov",
7 | "method": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "login": "albertosipov",
14 | "id": 36400587
15 | }
16 | }
17 | }
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/zerocode-maven-archetype/src/main/resources/archetype-resources/src/test/java/RunMyApiSuite.java:
--------------------------------------------------------------------------------
1 | package ${groupId};
2 |
3 | import org.junit.runner.JUnitCore;
4 | import org.junit.runner.Result;
5 | import org.junit.runner.notification.Failure;
6 | import ${groupId}.MyApiSuite;
7 |
8 | public class RunMyApiSuite {
9 | public static void main (String[] args){
10 | Result result = JUnitCore.runClasses(MyApiSuite.class);
11 | for (Failure failure : result.getFailures()){
12 | System.out.println(failure.toString());
13 | }
14 | System.out.println(result.wasSuccessful());
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/constants/ZerocodeConstants.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.constants;
2 |
3 | import static org.jsmart.zerocode.core.utils.SmartUtils.readJsonAsString;
4 |
5 | public interface ZerocodeConstants {
6 | String PROPERTY_KEY_HOST = "restful.application.endpoint.host";
7 | String PROPERTY_KEY_PORT = "restful.application.endpoint.context";
8 |
9 | String KAFKA = "kafka";
10 | String KAFKA_TOPIC = "kafka-topic:";
11 | String OK = "Ok";
12 | String FAILED = "Failed";
13 |
14 | String DSL_FORMAT = readJsonAsString("dsl_formats/dsl_parameterized_values.json");
15 | }
16 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworld_more/hello_world_get_new_emp_200.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "GIVEN- the REST end point, WHEN- I invoke GET for emp ID 1000, THEN- I will receive the details",
3 | "steps": [
4 | {
5 | "name": "get_user_details",
6 | "url": "/api/v1/google-uk/employees/UK1001",
7 | "method": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "id": "UK1001"
14 | }
15 | }
16 | }
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/converter/Converter.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.converter;
2 |
3 | import com.fasterxml.jackson.databind.JsonNode;
4 |
5 | import java.io.IOException;
6 |
7 | public interface Converter {
8 | Object xmlToJson(String xmlObject);
9 |
10 | Object stringToJson(String jsonString) throws IOException;
11 |
12 | Object jsonToJson(String jsonString) throws IOException;
13 |
14 | Object jsonBlockToJson(JsonNode jsonNode) throws IOException;
15 |
16 | default Object jsonNodeToJson(JsonNode jsonNode) throws IOException {
17 | return jsonBlockToJson(jsonNode);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/json_content_unit_test/json_step_test_wrong_json_path.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "get_user_details",
3 | "url": "/api/v1/employees/${$.create_emp.response.body.id}",
4 | "method": "GET",
5 | "request": {
6 | "body" : {
7 | "fullName":"Bob Luis",
8 | "empLogin":"bolu_lon",
9 | "type":"CONTRACT",
10 | "address":"${JSON.CONTENT:$.create_emp.response.body.id}"
11 | }
12 | },
13 | "verify": {
14 | "status": 200,
15 | "body": {
16 | "id": 39001,
17 | "ldapId": "emmanorton",
18 | "name": "Emma",
19 | "surName": "Norton"
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldretrywithsteps/HelloWorldRetryWithStepsTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldretrywithsteps;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 |
8 | @RunWith(ZeroCodeUnitRunner.class)
9 | public class HelloWorldRetryWithStepsTest {
10 |
11 | @Test
12 | @Scenario("helloworld_retry_withSteps/helloworld_retryWithSteps_test.json")
13 | public void retry_with_steps_test(){
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworld_github_REST_api/GitHub_REST_api_sample_assertions.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "GitHub Version-Details REST API will GET, version and server details @@Emma",
3 | "steps": [
4 | {
5 | "name": "get_github_server_details",
6 | "url": "/users/octocat/orgs",
7 | "method": "GET",
8 | "request": {
9 | "headers":{
10 | "api_key": "efg-135-xyz-9393"
11 | }
12 | },
13 | "assertions": {
14 | "status": 200
15 | }
16 | }
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldjavaexec/MultipleArgumentMethodExecTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldjavaexec;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
5 | import org.junit.Test;
6 | import org.junit.runner.RunWith;
7 |
8 | @RunWith(ZeroCodeUnitRunner.class)
9 | public class MultipleArgumentMethodExecTest {
10 |
11 | @Test
12 | @Scenario("helloworldjavaexec/java_method_multiple_arguments_test.json")
13 | public void test_multi_arg_method_exec() throws Exception {
14 |
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/junit5-testing-examples/src/test/resources/helloworld_github_REST_api/GitHub_REST_api_sample_assertions.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "GitHub Version-Details REST API will GET, version and server details @@Emma",
3 | "steps": [
4 | {
5 | "name": "get_github_server_details",
6 | "url": "/users/octocat/orgs",
7 | "operation": "GET",
8 | "request": {
9 | "headers":{
10 | "api_key": "efg-135-xyz-9393"
11 | }
12 | },
13 | "assertions": {
14 | "status": 200
15 | }
16 | }
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/HostProperties.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 | import java.lang.annotation.Documented;
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Inherited;
6 | import java.lang.annotation.Retention;
7 | import java.lang.annotation.RetentionPolicy;
8 | import java.lang.annotation.Target;
9 |
10 | @Documented
11 | @Target(ElementType.TYPE)
12 | @Retention(RetentionPolicy.RUNTIME)
13 | @Inherited
14 | public @interface HostProperties {
15 |
16 | String host() default "http://localhost";
17 | int port() default 8080;
18 | String context() default "";
19 |
20 | }
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/metadatatest/MetaDataTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.metadatatest;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class MetaDataTest {
12 | @Test
13 | @JsonTestCase("metadatatest/metadatatest.json")
14 | public void testMetaData() throws Exception {
15 |
16 | }
17 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/module/PropertiesInjectorModule.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.di.module;
2 |
3 | import com.google.inject.AbstractModule;
4 | import com.google.inject.name.Names;
5 |
6 | public class PropertiesInjectorModule extends AbstractModule {
7 |
8 | private String hostPropertiesFile;
9 |
10 | public PropertiesInjectorModule(String hostPropertiesFile) {
11 | this.hostPropertiesFile = hostPropertiesFile;
12 | }
13 |
14 | @Override
15 | protected void configure() {
16 | bind(String.class).annotatedWith(Names.named("HostFileName")).toInstance(hostPropertiesFile);
17 |
18 | }
19 | }
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/filebody_unit_test/json_step_test_address_array.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "create_emp",
3 | "url": "/api/test/v1/employess",
4 | "operation": "POST",
5 | "request": {
6 | "headers": "${JSON.FILE:unit_test_files/filebody_unit_test/common/common_content.json}",
7 | "body": {
8 | "name": "Mr Gates",
9 | "addresses": "${JSON.FILE:unit_test_files/filebody_unit_test/common/comm_addresses.json}"
10 | }
11 | },
12 | "assertions": {
13 | "status": 201,
14 | "body": "${JSON.FILE:unit_test_files/filebody_unit_test/common/common_content.json}"
15 | }
16 | }
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworld_more/hello_world_ok_status_200.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "GIVEN- the REST end point, WHEN- I invoke GET, THEN- I will receive the 200 status with body",
3 | "steps": [
4 | {
5 | "name": "get_emp_details",
6 | "url": "/api/v1/google-uk/employees/999",
7 | "method": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "id": 999,
14 | "name": "Larry P"
15 | }
16 | }
17 | }
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/zerocode-maven-archetype/src/main/resources/archetype-resources/src/test/java/tests/MyPutApiTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * @author MavenAutoGen
4 | */
5 |
6 | package ${groupId}.tests;
7 |
8 | import org.jsmart.zerocode.core.domain.Scenario;
9 | import org.jsmart.zerocode.core.domain.TargetEnv;
10 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
11 | import org.junit.Test;
12 | import org.junit.runner.RunWith;
13 |
14 | @TargetEnv("hostconfig_ci.properties")
15 | @RunWith(ZeroCodeUnitRunner.class)
16 | public class MyPutApiTest {
17 | @Test
18 | @Scenario("tests/put_api_200.json")
19 | public void testPost() throws Exception {
20 |
21 | }
22 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/engine/validators/ZeroCodeValidator.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.engine.validators;
2 |
3 | import java.util.List;
4 | import org.jsmart.zerocode.core.domain.Step;
5 | import org.jsmart.zerocode.core.engine.assertion.FieldAssertionMatcher;
6 |
7 | public interface ZeroCodeValidator {
8 |
9 | List validateFlat(Step thisStep, String actualResult, String resolvedScenarioState);
10 |
11 | List validateStrict(String expectedResult, String actualResult);
12 |
13 | List validateLenient(String expectedResult, String actualResult);
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/kafka/commands/WIP_test_kafka_command_execution.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Meta-data - Execute a command or equivalent Java function",
3 | "steps": [
4 | {
5 | "name": "load_kafka",
6 | "url": "kafka-topic://or//kafka-broker//against-what",
7 | "operation": "any-kafka-command-to-execute against the topic demo",
8 | "request": {
9 | "name": "demo",
10 | "broker-name": "kafka-server.corpbank.com"
11 | },
12 | "assertions": {
13 | "status": "OK"
14 | }
15 | }
16 |
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/zerocode-maven-archetype/src/main/resources/archetype-resources/src/test/java/tests/MyGetApiTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * @author MavenAutoGen
4 | */
5 |
6 | package ${groupId}.tests;
7 |
8 | import org.jsmart.zerocode.core.domain.Scenario;
9 | import org.jsmart.zerocode.core.domain.TargetEnv;
10 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
11 | import org.junit.Test;
12 | import org.junit.runner.RunWith;
13 |
14 | @TargetEnv("hostconfig_ci.properties")
15 | @RunWith(ZeroCodeUnitRunner.class)
16 | public class MyGetApiTest {
17 |
18 | @Test
19 | @Scenario("tests/get_api_200.json")
20 | public void testGet() throws Exception {
21 |
22 | }
23 | }
--------------------------------------------------------------------------------
/zerocode-maven-archetype/src/main/resources/archetype-resources/src/test/java/tests/MyPostApiTest.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | * @author MavenAutoGen
4 | */
5 |
6 | package ${groupId}.tests;
7 |
8 | import org.jsmart.zerocode.core.domain.Scenario;
9 | import org.jsmart.zerocode.core.domain.TargetEnv;
10 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
11 | import org.junit.Test;
12 | import org.junit.runner.RunWith;
13 |
14 | @TargetEnv("hostconfig_ci.properties")
15 | @RunWith(ZeroCodeUnitRunner.class)
16 | public class MyPostApiTest {
17 | @Test
18 | @Scenario("tests/post_api_200.json")
19 | public void testPost() throws Exception {
20 |
21 | }
22 | }
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/parameterized/ParameterisedDemoTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.parameterized;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("app_config.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class ParameterisedDemoTest {
12 |
13 | @Test
14 | @JsonTestCase("integration_test_files/parameterized/parameterized_sample_test.json")
15 | public void testParameterized() throws Exception {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/env_prop/22_env_property_dynamic_runtime.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "22_env_property_dynamic_runtime",
3 | "steps": [
4 | {
5 | "name": "get_hotel_resource for ci jenkins",
6 | "url": "/home/bathroom/google_id_01",
7 | "operation": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "id": 1,
14 | "name": "G Hotel Shower",
15 | "availability": true
16 | }
17 | }
18 | }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworld/JustHelloWorldTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworld;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class JustHelloWorldTest {
12 |
13 | @Test
14 | @Scenario("helloworld/hello_world_status_ok_assertions.json")
15 | public void testGet() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/main/java/org/jsmart/zerocode/zerocodejavaexec/utils/ExampleUtils.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.zerocodejavaexec.utils;
2 |
3 | import org.jsmart.zerocode.core.kafka.consume.SeekTimestamp;
4 |
5 | import java.text.DateFormat;
6 | import java.text.ParseException;
7 | import java.text.SimpleDateFormat;
8 |
9 | public class ExampleUtils {
10 |
11 | public String seekTimestampToEpoch(SeekTimestamp seekTimestamp) throws ParseException {
12 | DateFormat dateFormat = new SimpleDateFormat(seekTimestamp.getFormat());
13 | return String.valueOf(dateFormat.parse(seekTimestamp.getTimestamp()).toInstant().toEpochMilli());
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/failed_steps/01_two_step_one_fail.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "GIVEN Two Step - One Fail THEN Report assertions and payload",
3 | "ignoreStepFailures": true,
4 | "steps": [
5 | {
6 | "name": "FailedStep",
7 | "url": "/thisUrlShouldntWork",
8 | "operation": "GET",
9 | "request": {},
10 | "assertions": {
11 | "status": 200
12 | }
13 | },
14 | {
15 | "name": "PassedStep",
16 | "url": "/thisUrlShouldntWork",
17 | "operation": "GET",
18 | "request": {},
19 | "assertions": {
20 | "status": 404
21 | }
22 | }
23 |
24 | ]
25 | }
26 |
27 |
28 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/utils/EnvUtils.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.utils;
2 |
3 | import static java.lang.Integer.parseInt;
4 | import static java.lang.System.getProperty;
5 | import static java.lang.System.getenv;
6 |
7 | public class EnvUtils {
8 |
9 | public static Integer getEnvValueInt(String envKey) {
10 | String envValue = getProperty(envKey) == null ? getenv(envKey) : getProperty(envKey);
11 | return envValue == null ? null : parseInt(envValue);
12 | }
13 |
14 | public static String getEnvValueString(String envKey) {
15 | return getProperty(envKey) == null ? getenv(envKey) : getProperty(envKey);
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/custom_log/step_files.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "custom Log",
3 | "steps": [
4 | {
5 | "name": "step_with_custom_log",
6 | "url": "",
7 | "operation": "",
8 | "customLog": "Contributing to Zerocode",
9 | "request": {
10 | },
11 | "assertions": {
12 | }
13 | },
14 | {
15 | "name": "step_without_custom_log",
16 | "url": "",
17 | "operation": "",
18 | "request": {
19 |
20 | },
21 | "assertions": {
22 |
23 | }
24 | }
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/01_test_json_single_step.json:
--------------------------------------------------------------------------------
1 | {
2 | "loop": 3,
3 | "name": "StepNameWithoutSpaceEgCREATE",
4 | "url": "/persons",
5 | "operation": "POST",
6 | "request": {
7 | "headers": {
8 | "Content-Type": "application/json;charset=UTF-8",
9 | "Cookie": "cookie_123"
10 | },
11 | "queryParams": {
12 | "param1": "value1",
13 | "invId": 10101
14 | },
15 | "body": {
16 | "Customer": {
17 | "firstName": "FIRST_NAME"
18 | }
19 | }
20 | },
21 | "assertions": {
22 | "status": 201,
23 | "body": {
24 | "id" : 1001
25 | }
26 | },
27 | "verify": null
28 | }
29 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/wiremock/test_mock_step_request_body.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Mock the Get Person With Request Body",
3 | "operation": "GET",
4 | "url": "/google-guys/persons/p001",
5 | "request": {
6 | "body": {
7 | "name": "Emma",
8 | "age": 33,
9 | "address": {
10 | "line1": "address line 1",
11 | "line2": "address line 2"
12 | }
13 | }
14 | },
15 | "response": {
16 | "status": 200,
17 | "body": {
18 | "id": "p001",
19 | "source": {
20 | "code": "GOOGLE.UK"
21 | }
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/loadtesting/LoadGetEndPointTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.loadtesting;
2 |
3 | import org.jsmart.zerocode.core.domain.LoadWith;
4 | import org.jsmart.zerocode.core.domain.TestMapping;
5 | import org.jsmart.zerocode.core.runner.parallel.ZeroCodeLoadRunner;
6 | import org.jsmart.zerocode.testhelp.tests.loadtesting.restendpoint.TestGitGubEndPoint;
7 | import org.junit.runner.RunWith;
8 |
9 | @LoadWith("load_config_sample.properties")
10 | @TestMapping(testClass = TestGitGubEndPoint.class, testMethod = "testGitHubGET_load")
11 | @RunWith(ZeroCodeLoadRunner.class)
12 | public class LoadGetEndPointTest {
13 |
14 | }
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworldjavaexec/hello_world_javaexec_req_resp_as_json.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Java method request, response as JSON",
3 | "steps": [
4 | {
5 | "name": "execute_java_method",
6 | "url": "org.jsmart.zerocode.zerocodejavaexec.OrderCreator",
7 | "method": "createOrder",
8 | "request": {
9 | "itemName" : "Mango",
10 | "quantity" : 15000
11 | },
12 | "assertions": {
13 | "orderId" : 1020301,
14 | "itemName" : "Mango",
15 | "quantity" : 15000
16 | }
17 | }
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworldjavaexec/java_static_method_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Call static method",
3 | "steps": [
4 | {
5 | "name": "sample static method 1",
6 | "url": "org.jsmart.zerocode.zerocodejavaexec.SampleMethods",
7 | "method": "sampleStaticMethod",
8 | "request": {
9 | "0" : "arg1",
10 | "1" : "arg2"
11 | },
12 | "assertions": {
13 | "0" : "arg1",
14 | "1" : "arg2"
15 | }
16 | },
17 | {
18 | "name": "calling existing method",
19 | "url": "java.lang.System",
20 | "method": "currentTimeMillis",
21 | "assertions": "$NOT.NULL"
22 | }
23 | ]
24 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/provider/YamlObjectMapperProvider.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.di.provider;
2 |
3 | import com.fasterxml.jackson.core.JsonParser;
4 | import com.fasterxml.jackson.databind.ObjectMapper;
5 | import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
6 | import jakarta.inject.Provider;
7 |
8 | public class YamlObjectMapperProvider implements Provider {
9 |
10 | @Override
11 | public ObjectMapper get() {
12 |
13 | ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory());
14 | objectMapper.configure(JsonParser.Feature.ALLOW_COMMENTS, true);
15 |
16 | return objectMapper;
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/01.1_test_json_single_step_method.json:
--------------------------------------------------------------------------------
1 | {
2 | "loop": 3,
3 | "name": "StepNameWithoutSpaceEgCREATE",
4 | "url": "/persons",
5 | "method": "POST",
6 | "request": {
7 | "headers": {
8 | "Content-Type": "application/json;charset=UTF-8",
9 | "Cookie": "cookie_123"
10 | },
11 | "queryParams": {
12 | "param1": "value1",
13 | "invId": 10101
14 | },
15 | "body": {
16 | "Customer": {
17 | "firstName": "FIRST_NAME"
18 | }
19 | }
20 | },
21 | "assertions": {
22 | "status": 201,
23 | "body": {
24 | "id" : 1001
25 | }
26 | },
27 | "verify": null
28 | }
29 |
--------------------------------------------------------------------------------
/junit5-testing-examples/src/test/java/org/jsmart/zerocode/tests/junit4/GitHubHelloWorldTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.tests.junit4;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class GitHubHelloWorldTest {
12 |
13 | @Test
14 | @JsonTestCase("helloworld_github_REST_api/GitHub_REST_api_sample_assertions.json")
15 | public void testGitGubSample_RESTApi() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/UseKafkaClient.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Inherited;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 | import org.jsmart.zerocode.core.kafka.client.BasicKafkaClient;
9 |
10 | @Retention(RetentionPolicy.RUNTIME)
11 | @Target(ElementType.TYPE)
12 | @Inherited
13 | public @interface UseKafkaClient {
14 | /**
15 | * @return a Kafka Client implementation class which will override the default implementation
16 | */
17 | Class extends BasicKafkaClient> value();
18 | }
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/scenario/ScenarioAnnotationTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.scenario;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("config_hosts.properties")
10 | @RunWith(TestOnlyZeroCodeUnitRunner.class)
11 | public class ScenarioAnnotationTest {
12 |
13 | @Test
14 | @Scenario("01_verification_test_cases/05_number_equals_test.json")
15 | public void willPassIfEqualsToSame_number() throws Exception {
16 |
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/11.1_scenario_parameterized_csv.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "For deserialize only",
3 | "ignoreStepFailures": true,
4 | "steps": [
5 | {
6 | "name": "step1",
7 | "url": "/anUrl/${0}/${1}",
8 | "operation": "GET",
9 | "request": {
10 | },
11 | "assertions": {
12 | "status": "${2}"
13 | }
14 | }
15 | ],
16 | "parameterized": {
17 | "csvSource": [
18 | //id, AddressId, status
19 | "1, 2, 200",
20 | "11, 22, 400"
21 | ]
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldoneof/HelloWorldOneOfTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldoneof;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class HelloWorldOneOfTest {
12 |
13 | @Test
14 | @JsonTestCase("helloworld_one_of/hello_world_one_of_test.json")
15 | public void testValueOneOf() throws Exception {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworld/hello_world_status_ok_assertions.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "GIVEN- the GitHub REST end point, WHEN- I invoke GET, THEN- I will receive the 200 status with body",
3 | "steps": [
4 | {
5 | "name": "get_user_details",
6 | "url": "/users/octocat",
7 | "method": "GET",
8 | "request": {
9 | },
10 | "verify": {
11 | "status": 200,
12 | "body": {
13 | "login" : "octocat",
14 | "id" : 583231,
15 | "type" : "User"
16 | }
17 | }
18 | }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/kafka/common/KafkaCommonUtils.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.kafka.common;
2 |
3 | import java.util.Properties;
4 |
5 | import static org.jsmart.zerocode.core.utils.TokenUtils.resolveKnownTokens;
6 |
7 | public class KafkaCommonUtils {
8 |
9 | public static void resolveValuePlaceHolders(Properties properties) {
10 | properties.keySet().forEach(key -> {
11 | String value = properties.getProperty(key.toString());
12 | String resolvedValue = resolveKnownTokens(value);
13 | if(!value.equals(resolvedValue)){
14 | properties.put(key, resolvedValue);
15 | }
16 | });
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/zzignored/ZeroCodeException.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.zzignored;
2 |
3 | import java.util.concurrent.Callable;
4 |
5 | public class ZeroCodeException {
6 | public ZeroCodeException() {
7 | }
8 |
9 | public static T uncheck(Callable function) {
10 | try {
11 | return function.call();
12 | } catch (Exception var2) {
13 | throw new RuntimeException(var2);
14 | }
15 | }
16 |
17 | public static T ignore(Callable function) {
18 | try {
19 | return function.call();
20 | } catch (Exception var2) {
21 | return null;
22 | }
23 | }
24 | }
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/typecast/TypeCastIntegrationTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.typecast;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("config_hosts.properties")
10 | @RunWith(TestOnlyZeroCodeUnitRunner.class)
11 | public class TypeCastIntegrationTest {
12 |
13 | @Test
14 | @Scenario("integration_test_files/type_cast/cast_types_to_int_bool_test.json")
15 | public void willPassOnlyIfCastedTo_types() throws Exception {
16 |
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/place_holders/02_REST_end_point_GET.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Will Execute GET",
3 | "loop": 5, //comments -- Allowed
4 | "steps": [
5 | {
6 | "loop": 3,
7 | "name": "GetBathRoomDetails", //<-- with comments
8 | "url": "/home/bathroom/1",
9 | "operation": "GET",
10 | "request": {
11 | "headers": {
12 | "Content-Type": "application/json;charset=UTF-8",
13 | "Cookie": "cookie_123"
14 | },
15 | "body": {
16 | }
17 | },
18 | "assertions": {
19 | "status": 200,
20 | "body": {
21 | "id": 1
22 | }
23 | }
24 | }
25 |
26 | ]
27 | }
28 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/consume/KafkaConsumeRawTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.consume;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaConsumeRawTest {
12 |
13 | @Test
14 | @Scenario("kafka/consume/test_kafka_consume_raw_msg.json")
15 | public void testKafkaConsume_raw() throws Exception {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/multi_step/multi_step_file.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "name": "fist_of_multi_step",
4 | "url": "",
5 | "operation": "",
6 | "customLog": "Contributing to Zerocode",
7 | "request": {
8 | "req": "12345",
9 | "id": "${$.first_test.request.id}"
10 | },
11 | "assertions": {
12 | }
13 | },
14 | {
15 | "name": "second_of_multi_step",
16 | "url": "",
17 | "operation": "",
18 | "customLog": "Contributing to Zerocode",
19 | "request": {
20 | "req": "54321",
21 | "res": "${$.fist_of_multi_step.request.id}"
22 | },
23 | "assertions": {
24 | "res": "${$.first_test.request.id}"
25 | }
26 | }
27 | ]
28 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/date_after_before/dateAfterBefore_test_fail_afterSameDate.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Assert that 'startDateTime' is before expected & 'endDateTime' is after expected",
3 | "steps": [
4 | {
5 | "name": "get_project_details",
6 | "url": "",
7 | "operation": "",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "projectDetails": {
14 | "startDateTime" : "$LOCAL.DATETIME.AFTER:2015-09-14T09:49:34.000Z"
15 | }
16 | }
17 | }
18 | }
19 | ]
20 | }
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/date_after_before/dateAfterBefore_test_fail_beforeSameDate.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Assert that 'startDateTime' is before expected & 'endDateTime' is after expected",
3 | "steps": [
4 | {
5 | "name": "get_project_details",
6 | "url": "",
7 | "operation": "",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "projectDetails": {
14 | "startDateTime" : "$LOCAL.DATETIME.BEFORE:2015-09-14T09:49:34.000Z"
15 | }
16 | }
17 | }
18 | }
19 | ]
20 | }
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/consume/KafkaConsumeXmlTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.consume;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaConsumeXmlTest {
12 |
13 | @Test
14 | @Scenario("kafka/consume/test_kafka_consume_xml_msg.json")
15 | public void testKafkaConsumeRaw_XML() throws Exception {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/kafka_servers/kafka_producer_int_key.properties:
--------------------------------------------------------------------------------
1 | # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
2 | # kafka producer properties
3 | # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
4 | client.id=zerocode-producer
5 | key.serializer=org.apache.kafka.common.serialization.IntegerSerializer
6 | value.serializer=org.apache.kafka.common.serialization.StringSerializer
7 |
8 | #acks=all
9 | #retries=0
10 | #batch.size=16384
11 | #client.id=fcd-producer
12 | #auto.commit.interval.ms=1000
13 | #linger.ms=0
14 | #key.serializer=org.apache.kafka.common.serialization.StringSerializer
15 | #value.serializer=org.apache.kafka.common.serialization.ByteArraySerializer
16 | #block.on.buffer.full=true
17 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/UseHttpClient.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 | import org.jsmart.zerocode.core.httpclient.BasicHttpClient;
4 |
5 | import java.lang.annotation.ElementType;
6 | import java.lang.annotation.Inherited;
7 | import java.lang.annotation.Retention;
8 | import java.lang.annotation.RetentionPolicy;
9 | import java.lang.annotation.Target;
10 |
11 | @Retention(RetentionPolicy.RUNTIME)
12 | @Target(ElementType.TYPE)
13 | @Inherited
14 | public @interface UseHttpClient {
15 | /**
16 | * @return a Http Client implementation class which will override the default implementation of RestEasy client
17 | */
18 | Class extends BasicHttpClient> value();
19 | }
--------------------------------------------------------------------------------
/core/src/main/resources/01_verification_test_cases/06_number_not_equals_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "06_number_not_equals_test",
3 | "steps": [
4 | {
5 | "name": "get_call",
6 | "url": "http://localhost:9998/home/bathroom/1",
7 | "operation": "GET",
8 | "request": {
9 | "headers": {
10 | "Content-Type": "application/json;charset=UTF-8",
11 | "Cookie": "cookie_123"
12 | },
13 | "body": {
14 | }
15 | },
16 | "assertions": {
17 | "status": 200,
18 | "body": {
19 | "id": "$NOT.EQ.11",
20 | "name": "Shower",
21 | "availability": true
22 | }
23 | }
24 | }
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/integrationtests/CustomLogTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integrationtests;
2 |
3 |
4 | import org.jsmart.zerocode.core.domain.HostProperties;
5 | import org.jsmart.zerocode.core.domain.JsonTestCase;
6 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | @HostProperties(host="http://localhost", port=9998, context = "")
11 | @RunWith(TestOnlyZeroCodeUnitRunner.class)
12 | public class CustomLogTest {
13 |
14 | @Test
15 | @JsonTestCase("integration_test_files/custom_log/step_files.json")
16 | public void testStrict_compareStrict() throws Exception {
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/integrationtests/MultiStepTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integrationtests;
2 |
3 |
4 | import org.jsmart.zerocode.core.domain.HostProperties;
5 | import org.jsmart.zerocode.core.domain.JsonTestCase;
6 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | @HostProperties(host="http://localhost", port=9998, context = "")
11 | @RunWith(TestOnlyZeroCodeUnitRunner.class)
12 | public class MultiStepTest {
13 |
14 | @Test
15 | @JsonTestCase("integration_test_files/multi_step/array_step_file_test.json")
16 | public void testMultiStep() throws Exception {
17 |
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldfileupload/HelloWorldFileUploadTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldfileupload;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("postman_echo_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class HelloWorldFileUploadTest {
12 |
13 | @Test
14 | @Scenario("helloworld_file_upload/hello_world_file_upload_test.json")
15 | public void testFileUpload() throws Exception {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/parameterized_value/hello_world_test_parameterized_value.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Fetch and assert GitHub userNames",
3 | "steps": [
4 | {
5 | "name": "get_user_details",
6 | "url": "/users/${0}",
7 | "method": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "login": "${0}"
14 | }
15 | }
16 | }
17 | ],
18 | "parameterized": {
19 | "valueSource": [
20 | "octocat",
21 | "foo",
22 | "bar"
23 | ]
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/KafkaProduceAsyncTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProduceAsyncTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce/test_kafka_produce_async.json")
15 | public void testProduceAnd_async() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/KafkaProduceRawTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server_double_key.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProduceRawTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce/test_kafka_produce_raw.json")
15 | public void testProduce_raw() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/kafka_servers/kafka_producer_double_key.properties:
--------------------------------------------------------------------------------
1 | # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
2 | # kafka producer properties
3 | # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
4 | client.id=zerocode-producer
5 | key.serializer=org.apache.kafka.common.serialization.DoubleSerializer
6 | value.serializer=org.apache.kafka.common.serialization.StringSerializer
7 |
8 | #acks=all
9 | #retries=0
10 | #batch.size=16384
11 | #client.id=fcd-producer
12 | #auto.commit.interval.ms=1000
13 | #linger.ms=0
14 | #key.serializer=org.apache.kafka.common.serialization.StringSerializer
15 | #value.serializer=org.apache.kafka.common.serialization.ByteArraySerializer
16 | #block.on.buffer.full=true
17 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/retry_test_cases/04_REST_retry_with_state_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "WireMock State Saved For Retry",
3 | "steps": [
4 | {
5 | "retry": {
6 | "max": 5,
7 | "delay": 500
8 | },
9 | "name": "GetDatesRequest",
10 | "url": "http://localhost:8484/retry/ids/1",
11 | "operation": "GET",
12 | "request": {
13 | "headers": {
14 | "Content-Type": "application/json;charset=UTF-8"
15 | }
16 | },
17 | "assertions": {
18 | "status": 200
19 | }
20 | }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/KafkaProduceUniqueClientIdTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProduceUniqueClientIdTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce/test_kafka_produce.json")
15 | public void testProduce() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/protobuf/KafkaProtobufTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.protobuf;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server_protobuf.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProtobufTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce-consume/test_kafka_protobuf.json")
15 | public void testProduceConsume() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/kafka/more/test_kafka_produce.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Produce a message to kafka topic - more",
3 | "steps": [
4 | {
5 | "name": "load_kafka",
6 | "url": "kafka-topic:demo-s1",
7 | "operation": "produce",
8 | "request": {
9 | "records":[
10 | {
11 | "key": "${RANDOM.NUMBER}",
12 | "value": "Hello World"
13 | }
14 | ]
15 | },
16 | "assertions": {
17 | "status" : "Ok",
18 | "recordMetadata" : "$NOT.NULL"
19 | }
20 | }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/module/RuntimeHttpClientModule.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.di.module;
2 |
3 | import com.google.inject.Binder;
4 | import com.google.inject.Module;
5 | import org.jsmart.zerocode.core.httpclient.BasicHttpClient;
6 |
7 | public class RuntimeHttpClientModule implements Module {
8 |
9 | private final Class extends BasicHttpClient> customerHttpClientClazz;
10 |
11 | public RuntimeHttpClientModule(Class extends BasicHttpClient> customerHttpClientClazz) {
12 | this.customerHttpClientClazz = customerHttpClientClazz;
13 | }
14 |
15 | public void configure(Binder binder) {
16 | binder.bind(BasicHttpClient.class).to(customerHttpClientClazz);
17 | }
18 | }
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/verification/ZeroCodeUnitNumberEqualsTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.verification;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("config_hosts.properties")
10 | @RunWith(TestOnlyZeroCodeUnitRunner.class)
11 | public class ZeroCodeUnitNumberEqualsTest {
12 |
13 | @Test
14 | @JsonTestCase("01_verification_test_cases/05_number_equals_test.json")
15 | public void willPassIfEqualsToSame_number() throws Exception {
16 |
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/failed_steps_with_ignore/01_two_step_one_fail_and_ignored.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "GIVEN One Step Fail and ignored THEN the test is succeed",
3 | "ignoreStepFailures": true,
4 | "steps": [
5 | {
6 | "name": "FailedStep",
7 | "ignoreStep": true,
8 | "url": "/thisUrlShouldntWork",
9 | "operation": "GET",
10 | "request": {},
11 | "assertions": {
12 | "status": 200
13 | }
14 | },
15 | {
16 | "name": "PassedStep",
17 | "url": "/thisUrlShouldntWork",
18 | "operation": "GET",
19 | "request": {},
20 | "assertions": {
21 | "status": 404
22 | }
23 | }
24 |
25 | ]
26 | }
27 |
28 |
29 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworld_properties_reading/use_common_SAML_token_as_headers.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Use any common value or token or SAML token example",
3 | "steps": [
4 | {
5 | "name": "get_user_details",
6 | "url": "${another.new.endpoint.host}/users/octocat",
7 | "method": "GET",
8 | "request": {
9 | "headers":{
10 | "X-SAML": "${X-APP-SAML-TOKEN}"
11 | }
12 | },
13 | "assertions": {
14 | "status": 200,
15 | "body": {
16 | "login" : "octocat"
17 | }
18 | }
19 | }
20 | ]
21 | }
22 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/KafkaProduceJsonTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server_int_key.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProduceJsonTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce/test_kafka_produce_json_record.json")
15 | public void testProduce_json() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/kafka/produce/test_kafka_produce.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Produce a message to kafka topic - vanilla",
3 | "steps": [
4 | {
5 | "name": "load_kafka",
6 | "url": "kafka-topic:demo-1",
7 | "operation": "produce",
8 | "request": {
9 | "records":[
10 | {
11 | "key": "${RANDOM.NUMBER}",
12 | "value": "Hello World"
13 | }
14 | ]
15 | },
16 | "assertions": {
17 | "status" : "Ok",
18 | "recordMetadata" : "$NOT.NULL"
19 | }
20 | }
21 | ]
22 | }
23 |
--------------------------------------------------------------------------------
/zerocode-maven-archetype/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 4.0.0
4 |
5 | org.jsmart
6 | zerocode-tdd-parent
7 | 1.3.46-SNAPSHOT
8 |
9 | zerocode-maven-archetype
10 |
11 | Zerocode Automated Testing Maven Archetype
12 | Zerocode Automated-Testing Simple Maven Archetype
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/module/RuntimeKafkaClientModule.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.di.module;
2 |
3 | import com.google.inject.Binder;
4 | import com.google.inject.Module;
5 | import org.jsmart.zerocode.core.kafka.client.BasicKafkaClient;
6 |
7 | public class RuntimeKafkaClientModule implements Module {
8 |
9 | private final Class extends BasicKafkaClient> customKafkaClientClazz;
10 |
11 | public RuntimeKafkaClientModule(Class extends BasicKafkaClient> customKafkaClientClazz) {
12 | this.customKafkaClientClazz = customKafkaClientClazz;
13 | }
14 |
15 | public void configure(Binder binder) {
16 | binder.bind(BasicKafkaClient.class).to(customKafkaClientClazz);
17 | }
18 | }
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldgithub/GitHubHelloWorldTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldgithub;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class GitHubHelloWorldTest {
12 |
13 | @Test
14 | @JsonTestCase("helloworld_github_REST_api/GitHub_REST_api_sample_assertions.json")
15 | public void testGitGubSample_RESTApi() throws Exception {
16 |
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldtypecast/HelloWorldTypeCastTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldtypecast;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class HelloWorldTypeCastTest {
12 |
13 | @Test
14 | @Scenario("parameterized_csv/hello_world_test_parameterized_csv_type_cast.json")
15 | public void testParameterized_typeCast() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworld_date/hello_world_date_after_before_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Assert that 'created_at' is before expected & 'updated_at' is after expected",
3 | "steps": [
4 | {
5 | "name": "get_user_details",
6 | "url": "/users/octocat",
7 | "method": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "created_at" : "$LOCAL.DATETIME.BEFORE:2015-09-14T09:49:34.000Z",
14 | "updated_at" : "$LOCAL.DATETIME.AFTER:2015-09-14T09:49:34.000Z"
15 | }
16 | }
17 | }
18 | ]
19 | }
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/consume/KafkaConsumeUniqueGroupIdTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.consume;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server_unique.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaConsumeUniqueGroupIdTest {
12 |
13 | @Test
14 | @Scenario("kafka/consume/test_kafka_consume.json")
15 | public void testKafkaConsume() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/consume/filter/KafkaFilterTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.consume.filter;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaFilterTest {
12 |
13 | @Test
14 | @Scenario("kafka/consume/filter/test_kafka_filter_records_by_json_path.json")
15 | public void testConsumeFilter_byJsonPath(){
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/consume/sorting/KafkaSortingTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.consume.sorting;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaSortingTest {
12 |
13 | @Test
14 | @Scenario("kafka/consume/sorting/test_kafka_sort_records_by_json_path.json")
15 | public void testConsumeSort_byJsonPath(){
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/KafkaProduceTwoRecordsTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProduceTwoRecordsTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce/test_kafka_produce_2_records.json")
15 | public void testProduce_twoRecords() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/Retry.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain;
2 |
3 | import java.util.List;
4 |
5 | public class Retry {
6 | private Integer max;
7 | private Integer delay;
8 | private List withSteps;
9 |
10 | public Integer getMax() {
11 | return max;
12 | }
13 |
14 | public Integer getDelay() {
15 | return delay;
16 | }
17 |
18 | public List getWithSteps() {
19 | return withSteps;
20 | }
21 | public Retry() {}
22 |
23 | public Retry(Integer max, Integer delay, List withSteps) {
24 | this.max = max;
25 | this.delay = delay;
26 | this.withSteps = withSteps;
27 | }
28 |
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/kafka/helper/KafkaCommonUtils.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.kafka.helper;
2 |
3 | import org.slf4j.Logger;
4 | import org.slf4j.LoggerFactory;
5 |
6 | import static java.lang.String.format;
7 |
8 | public class KafkaCommonUtils {
9 | private static final Logger LOGGER = LoggerFactory.getLogger(KafkaConsumerHelper.class);
10 |
11 | public static void printBrokerProperties(String kafkaServers) {
12 |
13 | LOGGER.debug("\n---------------------------------------------------------\n" +
14 | format("kafka.bootstrap.servers - %s", kafkaServers) +
15 | "\n---------------------------------------------------------");
16 |
17 | }
18 |
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/parameterized/ParameterizedDemoTypeCastTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.parameterized;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("hello_world_host.properties")
10 | @RunWith(TestOnlyZeroCodeUnitRunner.class)
11 | public class ParameterizedDemoTypeCastTest {
12 |
13 | @Test
14 | @JsonTestCase("integration_test_files/parameterized/parameterized_sample_type_cast_test.json")
15 | public void testParametrize_typeCast() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldarraysize/HelloWorldArraySizeTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldarraysize;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class HelloWorldArraySizeTest {
12 |
13 | @Test
14 | @JsonTestCase("helloworld_array_size/hello_world_array_n_size_assertions_test.json")
15 | public void testArraySize() throws Exception {
16 |
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/consume/KafkaConsumeIntKeyTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.consume;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server_double_key.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaConsumeIntKeyTest {
12 |
13 | @Test
14 | @Scenario("kafka/consume/test_kafka_consume_int_key.json")
15 | public void testKafkaConsume_intKey() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/KafkaProduceIntKeyTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server_double_key.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProduceIntKeyTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce/test_kafka_produce_int_key.json")
15 | public void testProduce_intOrDoubleKey() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/engine/assertion/NumberComparator.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.engine.assertion;
2 |
3 | import java.math.BigDecimal;
4 | import java.util.Comparator;
5 |
6 | public class NumberComparator implements Comparator {
7 |
8 | /**
9 | * Compares two numbers and returns their differences.
10 | * e.g. 3 compare 3.0 = 0, 3.0 compare 3 = 0, 3 compare 3.12 = -1, 3.12 compare 3 = 1
11 | *
12 | * @param a One of two numbers to compare
13 | * @param b Two of two numbers to compare
14 | * @return a-b
15 | */
16 | public int compare(Number a, Number b){
17 | return new BigDecimal(a.toString()).compareTo(new BigDecimal(b.toString()));
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/core/src/main/resources/reports/09_report_template.vm:
--------------------------------------------------------------------------------
1 | {
2 | "timestamp": "$report.timestamp",
3 | "results": [
4 | {
5 | #foreach( $result in $report.results )
6 | "scenarioName": "$result.scenarioName",
7 | "loop": "$result.loop",
8 | "steps": [
9 | #foreach($step in $result.steps )
10 | {
11 | "loop": "$step.loop",
12 | "name": "$step.name",
13 | "url": "/services/service-delivery/sd_id_3030_90",
14 | "correlationId": "d6e2601c-5072-4bcf-a0dc-97e09c159cb6",
15 | "operation": "PUT",
16 | "requestTimeStamp": "2016-07-22T11:51:13.480",
17 | "responseTimeStamp": "2016-07-22T11:51:13.587",
18 | "Response delay": "107.0",
19 | "result": "pass"
20 | }
21 | #end
22 | ]
23 | }
24 | #end
25 | ]
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/verification/ZeroCodeUnitNumberNotEqualsTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.verification;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("config_hosts.properties")
10 | @RunWith(TestOnlyZeroCodeUnitRunner.class)
11 | public class ZeroCodeUnitNumberNotEqualsTest {
12 |
13 | @Test
14 | @JsonTestCase("01_verification_test_cases/06_number_not_equals_test.json")
15 | public void willPassIfNotEqualsToSame_number() throws Exception {
16 |
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/core/src/test/resources/load_test_files/github_get_api_sample_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "GIVEN-the GitHub REST end point, WHEN-I invoke GET, THEN-I will receive the 200 status with body",
3 | "steps": [
4 | {
5 | "name": "get_user_details",
6 | "url": "/users/octocat",
7 | "operation": "GET",
8 | "request": {
9 | },
10 | "verify": {
11 | "status": 200,
12 | "body": {
13 | "login" : "octocat",
14 | "id" : 583231,
15 | "type" : "User",
16 | "location" : "$MATCHES.STRING:San Fra(.*)"
17 | }
18 | }
19 | }
20 | ]
21 | }
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/place_holders/03_REST_end_point_POST.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Will Simulate POST",
3 | "loop": 5, //comments -- Allowed
4 | "steps": [
5 | {
6 | "loop": 3,
7 | "name": "Create", //<-- with comments
8 | "url": "/home/bathroom",
9 | "operation": "POST",
10 | "request": {
11 | "headers": {
12 | "Content-Type": "application/json;charset=UTF-8",
13 | "Cookie": "cookie_123"
14 | },
15 | "body": "" //<--can be / works for: null, "", 100, "alpha100", {"id" : "2"}
16 | },
17 | "assertions": {
18 | "status": 201,
19 | "body": {
20 | "id": 2
21 | }
22 | }
23 | }
24 |
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldnamedcsvparam/HelloWorldNamedCsvParamsTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldnamedcsvparam;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class HelloWorldNamedCsvParamsTest {
12 |
13 | @Test
14 | @Scenario("parameterized_csv/hello_world_test_named_parameterized.json")
15 | public void testNamedParameterized() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldqueryparams/HelloWorldQueryParamsTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldqueryparams;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class HelloWorldQueryParamsTest {
12 |
13 | @Test
14 | @JsonTestCase("helloworld_queryparams/github_get_repos_by_query_params.json")
15 | public void testGetBy_queryParams() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/KafkaProduceWithHeadersTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server_int_key.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProduceWithHeadersTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce/test_kafka_produce_json_with_headers.json")
15 | public void should_produce_json_with_headers() {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/reports/LocalDateTimeDeserializer.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain.reports;
2 |
3 | import com.fasterxml.jackson.core.JsonParser;
4 | import com.fasterxml.jackson.core.JsonProcessingException;
5 | import com.fasterxml.jackson.databind.DeserializationContext;
6 | import com.fasterxml.jackson.databind.JsonDeserializer;
7 |
8 | import java.io.IOException;
9 | import java.time.LocalDateTime;
10 |
11 | public class LocalDateTimeDeserializer extends JsonDeserializer {
12 | @Override
13 | public LocalDateTime deserialize(JsonParser arg0, DeserializationContext arg1) throws IOException, JsonProcessingException {
14 | return LocalDateTime.parse(arg0.getText());
15 | }
16 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/domain/reports/LocalDateTimeSerializer.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.domain.reports;
2 |
3 | import com.fasterxml.jackson.core.JsonGenerator;
4 | import com.fasterxml.jackson.core.JsonProcessingException;
5 | import com.fasterxml.jackson.databind.JsonSerializer;
6 | import com.fasterxml.jackson.databind.SerializerProvider;
7 |
8 | import java.io.IOException;
9 | import java.time.LocalDateTime;
10 |
11 | public class LocalDateTimeSerializer extends JsonSerializer {
12 | @Override
13 | public void serialize(LocalDateTime arg0, JsonGenerator arg1, SerializerProvider arg2) throws IOException, JsonProcessingException {
14 | arg1.writeString(arg0.toString());
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/github/TestGitHubApi.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.github;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Ignore;
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | @TargetEnv("github_host_test.properties")
11 | @RunWith(ZeroCodeUnitRunner.class)
12 | public class TestGitHubApi {
13 |
14 | //@Ignore("Locally passes, but fails in Travis CI due to rate limiting issue of GitHub")
15 | @Test
16 | @JsonTestCase("load_test_files/github_get_api_sample_test.json")
17 | public void testGitHubApi_get() throws Exception {
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/json_paths_jayway/05_REST_with_request_response_path_1step.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Will Execute GET And Pass 1 step",
3 | "loop": 5, //comments -- Allowed
4 | "steps": [
5 | {
6 | "loop": 3,
7 | "name": "GetBathRoomDetails1", //<-- with comments
8 | "url": "/home/bathroom/1",
9 | "operation": "GET",
10 | "request": {
11 | "headers": {
12 | "Content-Type": "application/json;charset=UTF-8",
13 | "Cookie": "cookie_123"
14 | },
15 | "body": {
16 | }
17 | },
18 | "assertions": {
19 | "status": 200,
20 | "body": {
21 | "id": -10000
22 | }
23 | }
24 | }
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/parameterized/parameterized_sample_csv_string_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Parameterized test scenario demo",
3 | "steps": [
4 | {
5 | "name": "get_user",
6 | "url": "",
7 | "operation": "",
8 | "request": {
9 | "body": {
10 | "login": "octocat"
11 | }
12 | },
13 | "assertions": {
14 | "body": {
15 | "login": "octocat"
16 | }
17 | },
18 | "parameterizedCsv": [
19 | "Hello, World, Hello World",
20 | "11, 22, 33"
21 | ]
22 | }
23 | ]
24 | }
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/04_ignoreStepFailures_in_multistep.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "For deserialize only",
3 | "ignoreStepFailures": true,
4 | "steps": [
5 | {
6 | "name": "step1",
7 | "url": "/anUrl",
8 | "operation": "GET",
9 | "request": {
10 | },
11 | "assertions": {
12 | "status": 900
13 | }
14 | },
15 | {
16 | "name": "step2",
17 | "url": "/otherUrl",
18 | "operation": "GET",
19 | "request": {
20 | },
21 | "assertions": {
22 | "status": 200
23 | }
24 | }
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldjavaexec/HelloWorldJavaApiAsProtocolTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldjavaexec;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("myapp_proto.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class HelloWorldJavaApiAsProtocolTest {
12 |
13 | @Test
14 | @JsonTestCase("helloworldjavaexec/hello_world_protocol_method.json")
15 | public void testJava_protocol() throws Exception {
16 |
17 | }
18 |
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/KafkaProduceToPartitionTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 |
10 | @TargetEnv("kafka_servers/kafka_test_server.properties")
11 | @RunWith(ZeroCodeUnitRunner.class)
12 | public class KafkaProduceToPartitionTest {
13 |
14 | @Test
15 | @Scenario("kafka/produce/test_kafka_produce_to_partition.json")
16 | public void testProdoceTo_partition() throws Exception {
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/KafkaProduceWithTimeStampTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProduceWithTimeStampTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce/test_kafka_produce_with_timestamp.json")
15 | public void testProduceWith_timestamp() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/verification/loopreport/SmartJUnitNavigatorReportGen.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.verification.loopreport;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("config_hosts.properties")
10 | @RunWith(TestOnlyZeroCodeUnitRunner.class)
11 | public class SmartJUnitNavigatorReportGen {
12 |
13 | @Test
14 | @JsonTestCase("unit_test_files/reports/02.1_loop_scenario_only.json")
15 | public void willGeneratReport_multiSceneMultiSteps() throws Exception {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldjavaexec/SecurityHeaderTokenDynamicTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldjavaexec;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class SecurityHeaderTokenDynamicTest {
12 |
13 | @Test
14 | @Scenario("helloworldjavaexec/hello_world_security_token_for_header_test.json")
15 | public void testNewHeaderToken() throws Exception {
16 |
17 | }
18 |
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/KafkaProduceRawWithHeadersTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server_double_key.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProduceRawWithHeadersTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce/test_kafka_produce_raw_with_headers.json")
15 | public void should_produce_raw_with_headers() {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/regex_match/string_matches_regex_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Testing string matches a regex pattern",
3 | "steps": [
4 | {
5 | "name": "StepNameWithoutSpaceEgCREATESD",
6 | "url": "/persons",
7 | "operation": "POST",
8 | "request": {
9 | "body": {
10 | "persons": {
11 | "dob": "2018-06-26"
12 | }
13 | }
14 | },
15 | "assertions": {
16 | "status": 201,
17 | "body": {
18 | "dob": "$MATCHES.STRING:\\d{4}-\\d{2}-\\d{2}"
19 | }
20 | }
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworlddateafterbefore/HelloWorldDateAfterBeforeTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworlddateafterbefore;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class HelloWorldDateAfterBeforeTest {
12 |
13 | @Test
14 | @JsonTestCase("helloworld_date/hello_world_date_after_before_test.json")
15 | public void testCreatedDateAfterBefore() throws Exception {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldjsoncontent/HelloJsonContentAsBodyTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldjsoncontent;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("hello_world_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class HelloJsonContentAsBodyTest {
12 |
13 | @Test
14 | @JsonTestCase("helloworld_json_content/hello_world_json_content_as_request_body.json")
15 | public void testHelloWorld_jsonContentAsBody() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldparameterizedvalue/HelloWorldParameterizedValueTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldparameterizedvalue;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class HelloWorldParameterizedValueTest {
12 |
13 | @Test
14 | @Scenario("parameterized_value/hello_world_test_parameterized_value.json")
15 | public void testGetByUserNames() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworld_file_upload/hello_world_file_upload_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Assert that file has been uploaded successfully",
3 | "steps": [
4 | {
5 | "name": "post_file",
6 | "url": "/post",
7 | "method": "POST",
8 | "request": {
9 | "headers": {
10 | "Content-Type": "multipart/form-data"
11 | },
12 | "body": {
13 | "files": ["file:helloworld_file_upload/textfile.txt"]
14 | }
15 | },
16 | "verify": {
17 | "status": 200,
18 | "body": {
19 | "files": {
20 | "['textfile.txt']": "data:application/octet-stream;base64,SGVsbG9Xb3JsZA=="
21 | }
22 | }
23 | }
24 | }
25 | ]
26 | }
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldregexmatch/HelloWorldRegexMatchDateTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldregexmatch;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("hello_world_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class HelloWorldRegexMatchDateTest {
12 |
13 |
14 | @Test
15 | @JsonTestCase("helloworld_regex_match/hello_world_matches_string_regex_test.json")
16 | public void testRegexStringMatch() throws Exception {
17 |
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/converter/SoapMocker.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.converter;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 | import org.jsmart.zerocode.core.utils.SmartUtils;
6 |
7 | public class SoapMocker {
8 |
9 | public Object soapResponseXml(String nothing){
10 |
11 | try {
12 | final String rawBody = SmartUtils.readJsonAsString("soap_response/mock_soap_response.xml");
13 | Map singleKeyValueMap = new HashMap<>();
14 | singleKeyValueMap.put("rawBody", rawBody);
15 |
16 | return singleKeyValueMap;
17 |
18 | } catch (RuntimeException e) {
19 | throw new RuntimeException("something wrong happened here" + e);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/parameterized/parameterized_sample_type_cast_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Parameterized test scenario demo Typecast",
3 | "steps": [
4 | {
5 | "name": "get_user",
6 | "url": "/home/bathroom/${0}",
7 | "operation": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "id": "(int)${0}",
14 | "availability": "(boolean)${1}"
15 | }
16 | }
17 | }
18 | ],
19 | "parameterized": {
20 | "csvSource":[
21 | "1, true",
22 | "21, true"
23 | ]
24 | }
25 |
26 | }
27 |
28 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/ignore_case/test_string_match_withIgnoring_case.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Testing string comparable with ignoring case",
3 | "steps": [
4 | {
5 | "name": "StepNameWithoutSpaceEgCREATESD",
6 | "url": "/persons",
7 | "operation": "POST",
8 | "request": {
9 | "body": {
10 | "persons": {
11 | "firstName": "Oliver Creasy"
12 | }
13 | }
14 | },
15 | "assertions": {
16 | "status": 201,
17 | "body": {
18 | "name": "$CONTAINS.STRING.IGNORECASE:CReASY"
19 | }
20 | }
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldtokenresolver/HelloWorldTokenResolverTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldtokenresolver;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class HelloWorldTokenResolverTest {
12 |
13 | @Test
14 | @JsonTestCase("helloworld_token_resolving/helloworld_token_resolving_ok.json")
15 | public void testHelloWorldTokenResolving_RESTApi() throws Exception {
16 |
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/file/KafkaProduceSyncFromFileRawTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce.file;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProduceSyncFromFileRawTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce/file_produce/test_kafka_produce_sync_from_file.json")
15 | public void testProduceAnd_syncFromFile() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/kafka/consume/latest/test_offset_to_latest_all_partitions_existing_topic.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Reset offset to latest 1st",
3 | "steps": [
4 | {
5 | "name": "reset_now",
6 | "url": "kafka-topic:demo-c1",
7 | // "url": "kafka-topic:local-demo-topic", //<--- This will work becaz of same topic as the previous test scenario
8 | "operation": "CONSUME",
9 | "request": {
10 | "consumerLocalConfigs": {
11 | "maxNoOfRetryPollsOrTimeouts": 3,
12 | "commitSync": true
13 | }
14 | },
15 | "assertions": {
16 | "size": 0
17 | }
18 | }
19 | ]
20 | }
21 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/resources/kafka/produce/negative/test_kafka_produce_from_worng_filename.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Produce a message - Wrong file name",
3 | "steps": [
4 | {
5 | "name": "load_kafka",
6 | "url": "kafka-topic:demo-file-2",
7 | "operation": "produce",
8 | "request": {
9 | "async": false,
10 | "recordType" : "RAW",
11 | "file": "kafka/pfiles/test_data_rawXX.json"
12 | },
13 | "assertions": {
14 | "status" : "Failed",
15 | "message" : "$CONTAINS.STRING:Error accessing file: `kafka/pfiles/test_data_rawXX.json' - java.lang.NullPointerException"
16 | }
17 | }
18 | ]
19 | }
20 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/verification/hostproperties/PropertiesInStepsUnitRunnerTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.verification.hostproperties;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("dev_test.properties")
10 | @RunWith(TestOnlyZeroCodeUnitRunner.class)
11 | public class PropertiesInStepsUnitRunnerTest {
12 |
13 | @Test
14 | @JsonTestCase("integration_test_files/host_keys/property_reading_into_test_step_test.json")
15 | public void testReading_propertyValuesViaKey() throws Exception {
16 |
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/github/TestGitHubApiOldFashionHost.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.github;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Ignore;
7 | import org.junit.Test;
8 | import org.junit.runner.RunWith;
9 |
10 | @TargetEnv("github_host_old_fashion_test.properties")
11 | @RunWith(ZeroCodeUnitRunner.class)
12 | public class TestGitHubApiOldFashionHost {
13 |
14 | @Ignore("Locally passes, but fails in Travis CI due to rate limiting of GitHub")
15 | @Test
16 | @JsonTestCase("load_test_files/github_get_api_sample_test.json")
17 | public void testGitHubApi_get() throws Exception {
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/HelloWorldGitHubSuite.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests;
2 |
3 | import org.jsmart.zerocode.core.domain.TargetEnv;
4 | import org.jsmart.zerocode.core.domain.TestPackageRoot;
5 | import org.jsmart.zerocode.core.domain.UseHttpClient;
6 | import org.jsmart.zerocode.core.runner.ZeroCodePackageRunner;
7 | import org.jsmart.zerocode.zerocodejavaexec.httpclient.CustomHttpClient;
8 | import org.junit.runner.RunWith;
9 |
10 | @TargetEnv("github_host.properties")
11 | @UseHttpClient(CustomHttpClient.class)
12 | @RunWith(ZeroCodePackageRunner.class)
13 | @TestPackageRoot("helloworld_github_REST_api") //<--- Root of the package to pick all tests including sub-folders
14 | public class HelloWorldGitHubSuite {
15 | }
16 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldcustomclient/CustomSecurityHeaderTokenTest.java:
--------------------------------------------------------------------------------
1 | //package org.jsmart.zerocode.testhelp.tests.helloworldcustomclient;
2 | //
3 | //import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | //import org.jsmart.zerocode.core.domain.TargetEnv;
5 | //import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | //import org.junit.Test;
7 | //import org.junit.runner.RunWith;
8 | //
9 | //@TargetEnv("hello_world_host.properties")
10 | //@RunWith(ZeroCodeUnitRunner.class)
11 | //public class CustomSecurityHeaderTokenTest {
12 | //
13 | // @Test
14 | // @JsonTestCase("helloworld_more/hello_world_ok_status_200.json")
15 | // public void testHelloWorld_localhostApi() throws Exception {
16 | // }
17 | //
18 | //}
19 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/metadatatest/metadatatest.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Scenario - Get GitHub User Details with Metadata",
3 | "steps": [
4 | {
5 | "name": "get_user_details",
6 | "url": "/users/octocat",
7 | "method": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "login": "octocat",
14 | "id": 583231,
15 | "type": "User"
16 | }
17 | }
18 | }
19 | ],
20 | "meta": {
21 | "authors": ["Emma", "Sidd", "Krish"],
22 | "tickets": ["ISSUE-519", "GT-312"],
23 | "categories": ["api", "regression"],
24 | "description": ["This test verifies the GitHub user API"],
25 | "last_updated": ["2023-05-15"]
26 | }
27 | }
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/consume/KafkaProduceConsumeAvroTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.consume;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server_avro.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProduceConsumeAvroTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce-consume/test_kafka_produce_consume_avro_records.json")
15 | public void testKafkaProduceConsume_avro_With_and_Without_Key() throws Exception {
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/file/KafkaProduceAsyncFromFileRawTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce.file;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProduceAsyncFromFileRawTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce/file_produce/test_kafka_produce_async_from_file.json")
15 | public void testProduceAnd_asyncFromFile() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/runner/e2e/FailSimpleAssertionInMultiStep.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.runner.e2e;
2 |
3 | import org.jsmart.zerocode.core.domain.HostProperties;
4 | import org.jsmart.zerocode.core.domain.JsonTestCase;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @HostProperties(host="http://localhost", port=9998, context = "")
10 | @RunWith(TestOnlyZeroCodeUnitRunner.class)
11 | public class FailSimpleAssertionInMultiStep {
12 |
13 | @Test
14 | @JsonTestCase("integration_test_files/failed_steps/01_two_step_one_fail.json")
15 | public void testFailSimpleAssertionInMultiStep_execAll() throws Exception {
16 |
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/json_paths_jayway/07_REST_with_loop_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Rest with Loop Test",
3 | "loop": 2, //comments -- Allowed
4 | "steps": [
5 | {
6 | "loop": 5, //Look for step: GetBathRoomDetails14, GetBathRoomDetails13 in the log
7 | "name": "GetBathRoomDetails1", //<-- with comments
8 | "url": "/home/bathroom/1",
9 | "operation": "GET",
10 | "request": {
11 | "headers": {
12 | "Content-Type": "application/json;charset=UTF-8",
13 | "Cookie": "cookie_123"
14 | },
15 | "body": {
16 | }
17 | },
18 | "assertions": {
19 | "status": 200,
20 | "body": {
21 | "id": 1
22 | }
23 | }
24 | }
25 |
26 | ]
27 | }
28 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/date_after_before/dateAfterBefore_test_both.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Assert that 'startDateTime' is before expected & 'endDateTime' is after expected",
3 | "steps": [
4 | {
5 | "name": "get_project_details",
6 | "url": "",
7 | "operation": "",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "projectDetails": {
14 | "startDateTime" : "$LOCAL.DATETIME.BEFORE:2015-09-14T09:49:34.000Z",
15 | "endDateTime" : "$LOCAL.DATETIME.AFTER:2015-09-14T09:49:34.000Z"
16 | }
17 | }
18 | }
19 | }
20 | ]
21 | }
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/verification/ZeroCodeFailedAssertionsTestRunner.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.verification;
2 |
3 | import org.jsmart.zerocode.core.domain.HostProperties;
4 | import org.jsmart.zerocode.core.domain.JsonTestCase;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @HostProperties(port=9998, context="/google-map-services")
10 | @RunWith(TestOnlyZeroCodeUnitRunner.class)
11 | public class ZeroCodeFailedAssertionsTestRunner {
12 |
13 | @JsonTestCase("01_verification_test_cases/09_host_port_annotated_bu_failed_assertion.json")
14 | @Test
15 | public void hostAnsPortWith_failedAssertions() throws Exception {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/verification/loopreport/SmartJUnitNavigatorReportGenFailureStep.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.verification.loopreport;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("config_hosts.properties")
10 | @RunWith(TestOnlyZeroCodeUnitRunner.class)
11 | public class SmartJUnitNavigatorReportGenFailureStep {
12 |
13 | @Test
14 | @JsonTestCase("unit_test_files/reports/02.2_loop_scenario_only_one_failing_step.json")
15 | public void willGeneratReport_multiSceneMultiSteps() throws Exception {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/date_after_before/dateAfterBefore_test_fail_both.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Assert that 'startDateTime' is before expected & 'endDateTime' is after expected",
3 | "steps": [
4 | {
5 | "name": "get_project_details",
6 | "url": "",
7 | "operation": "",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "projectDetails": {
14 | "startDateTime" : "$LOCAL.DATETIME.BEFORE:2016-09-14T09:49:34.000Z",
15 | "endDateTime" : "$LOCAL.DATETIME.AFTER:2019-09-14T09:49:34.000Z"
16 | }
17 | }
18 | }
19 | }
20 | ]
21 | }
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/engine_unit_test_jsons/15_test_validators_single_step.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Unit testing series of validators",
3 | "steps": [
4 | {
5 | "name": "get_visas",
6 | "url": "/api/visas",
7 | "method": "GET",
8 | "request": {
9 | "queryParams": {
10 | "city": "Lon"
11 | }
12 | },
13 | "validators": [
14 | {
15 | "field": "$.body.name",
16 | "value": "Mr Bean"
17 | },
18 | {
19 | "field": "$.status",
20 | "value": 200
21 | }
22 | ]
23 | }
24 | ]
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/kafka/produce/negative/KafkaProduceSyncWrongFileNameTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.kafka.produce.negative;
2 |
3 | import org.jsmart.zerocode.core.domain.Scenario;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("kafka_servers/kafka_test_server.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class KafkaProduceSyncWrongFileNameTest {
12 |
13 | @Test
14 | @Scenario("kafka/produce/negative/test_kafka_produce_from_worng_filename.json")
15 | public void testProduceAnd_wrongFileName() throws Exception {
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/parallel/restful/LoadRestEndPointMultiRunnerTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.parallel.restful;
2 |
3 | import org.jsmart.zerocode.core.domain.LoadWith;
4 | import org.jsmart.zerocode.core.domain.TestMapping;
5 | import org.jsmart.zerocode.core.runner.parallel.ZeroCodeMultiLoadRunner;
6 | import org.junit.runner.RunWith;
7 |
8 |
9 | @LoadWith("load_config_test.properties")
10 | @TestMapping(testClass = JunitRestTestSample.class, testMethod = "testGetCallToHome_pass")
11 | @TestMapping(testClass = JunitRestTestSample.class, testMethod = "testGetCallToHome_pass")
12 | //@TestMapping(testClass = JunitRestTestSample.class, testMethod = "testGetCallToHome_fail")
13 | @RunWith(ZeroCodeMultiLoadRunner.class)
14 | public class LoadRestEndPointMultiRunnerTest {
15 |
16 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/PropertyKeys.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.di;
2 |
3 | public interface PropertyKeys {
4 | // --------------
5 | // New properties
6 | // --------------
7 | String WEB_APPLICATION_ENDPOINT_HOST="web.application.endpoint.host";
8 | String WEB_APPLICATION_ENDPOINT_PORT="web.application.endpoint.port";
9 | String WEB_APPLICATION_ENDPOINT_CONTEXT="web.application.endpoint.context";
10 |
11 | // --------------
12 | // Old properties
13 | // --------------
14 | String RESTFUL_APPLICATION_ENDPOINT_HOST="restful.application.endpoint.host";
15 | String RESTFUL_APPLICATION_ENDPOINT_PORT="restful.application.endpoint.port";
16 | String RESTFUL_APPLICATION_ENDPOINT_CONTEXT="restful.application.endpoint.context";
17 | }
18 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/HelloWorldCustomHttpClientSuite.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests;
2 |
3 | import org.jsmart.zerocode.core.domain.TargetEnv;
4 | import org.jsmart.zerocode.core.domain.TestPackageRoot;
5 | import org.jsmart.zerocode.core.domain.UseHttpClient;
6 | import org.jsmart.zerocode.core.runner.ZeroCodePackageRunner;
7 | import org.jsmart.zerocode.zerocodejavaexec.httpclient.CustomHttpClient;
8 | import org.junit.runner.RunWith;
9 |
10 | @TargetEnv("github_host.properties")
11 | @UseHttpClient(CustomHttpClient.class)
12 | @RunWith(ZeroCodePackageRunner.class)
13 | @TestPackageRoot("helloworld_github_REST_api") //<--- Root of the package to pick all tests including sub-folders
14 | public class HelloWorldCustomHttpClientSuite {
15 | }
16 |
--------------------------------------------------------------------------------
/zerocode-maven-archetype/src/main/resources/archetype-resources/src/test/resources/tests/get_api_200.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Validate the GET api",
3 | "steps": [
4 | {
5 | "name": "get_user_details",
6 | "url": "/users/octocat",
7 | "method": "GET",
8 | "request": {
9 | "headers" : {
10 | "Content-Type" : "application/json"
11 | }
12 | },
13 | "verify": {
14 | "status": 200,
15 | "headers" : {
16 | "Content-Type" : [ "application/json; charset=utf-8" ]
17 | },
18 | "body": {
19 | "login" : "octocat"
20 | }
21 | }
22 | }
23 | ]
24 | }
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/no_server/no_server_call_multi.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Scenario - Single step",
3 | "steps": [
4 | {
5 | "name": "get_user_details",
6 | "url": "",
7 | "method": "",
8 | "request": {
9 | "status": 200,
10 | "body": {
11 | "login" : "octocat",
12 | "id" : 583231,
13 | "type" : "User"
14 | }
15 | },
16 | "assertions": {
17 | "status": 200,
18 | "body": {
19 | "login" : "octocat",
20 | "id" : 583231,
21 | "type" : "User"
22 | }
23 | }
24 | }
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/envprop/suite/ZeroCodeEnvPropertyReaderPackageTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.envprop.suite;
2 |
3 | import org.jsmart.zerocode.core.domain.EnvProperty;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.domain.TestPackageRoot;
6 | import org.junit.runner.RunWith;
7 |
8 | // see "ENV_NAME=ci" in .bash_profile file or pass via 'mvn -DENV_NAME=ci'.
9 | // If not found, then defaults to "app_config.properties"
10 |
11 | @EnvProperty("_${ENV_NAME}")
12 | @TargetEnv("env_config_test_files/app_config.properties")
13 | @TestPackageRoot("integration_test_files/env_prop")
14 | @RunWith(NewPortTestZeroCodeUnitRunner.class)
15 | //@RunWith(ZeroCodePackageRunner.class)
16 | public class ZeroCodeEnvPropertyReaderPackageTest {
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/core/src/test/java/org/jsmart/zerocode/core/verification/ZeroCodeJUnitHostPortContextAnnotationTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.verification;
2 |
3 | import org.jsmart.zerocode.core.domain.HostProperties;
4 | import org.jsmart.zerocode.core.domain.JsonTestCase;
5 | import org.jsmart.zerocode.core.tests.customrunner.TestOnlyZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @HostProperties(port=9998, context="/google-map-services")
10 | @RunWith(TestOnlyZeroCodeUnitRunner.class)
11 | public class ZeroCodeJUnitHostPortContextAnnotationTest {
12 |
13 | @JsonTestCase("01_verification_test_cases/08_get_with_inline_host_port_context.json")
14 | @Test
15 | public void willPickFromClassAnnotation_hostAndPortNContext() throws Exception {
16 |
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/get_api/simple_get_api_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "As simple GET request response",
3 | "steps": [
4 | {
5 | "name": "find_match",
6 | "url": "/api/v1/search/persons",
7 | "method": "GET",
8 | "request": {
9 | "queryParams": {
10 | "lang": "Amazing",
11 | "city": "Lon"
12 | }
13 | },
14 | "assertions": {
15 | "status": 200,
16 | "body": {
17 | "exactMatches": true,
18 | "name": "Mr Bean",
19 | "lang": "Amazing",
20 | "city": "Lon"
21 | }
22 | }
23 | }
24 | ]
25 | }
26 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/loadtesting/github_get_api_test_case.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Load testing- Git Hub GET API",
3 | "steps": [
4 | {
5 | "name": "get_user_details",
6 | "url": "/users/octocat",
7 | "method": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "login" : "octocat",
14 | "id" : 583231,
15 | "avatar_url" : "https://avatars3.githubusercontent.com/u/583231?v=4",
16 | "type" : "User",
17 | "name" : "The Octocat",
18 | "company" : "GitHub"
19 | }
20 | }
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/kafka-testing-examples/src/test/java/org/jsmart/zerocode/integration/tests/more/customclientsuite/KafkaProduceCustomClientSuiteTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.integration.tests.more.customclientsuite;
2 |
3 | import org.jsmart.zerocode.core.domain.TargetEnv;
4 | import org.jsmart.zerocode.core.domain.TestPackageRoot;
5 | import org.jsmart.zerocode.core.domain.UseKafkaClient;
6 | import org.jsmart.zerocode.core.runner.ZeroCodePackageRunner;
7 | import org.jsmart.zerocode.kafka.MyCustomKafkaClient;
8 | import org.junit.runner.RunWith;
9 |
10 | @TargetEnv("kafka_servers/kafka_test_server.properties")
11 | @TestPackageRoot("kafka/more")
12 | @UseKafkaClient(MyCustomKafkaClient.class)
13 | @RunWith(ZeroCodePackageRunner.class)
14 | public class KafkaProduceCustomClientSuiteTest {
15 | // no code goes here
16 | }
17 |
--------------------------------------------------------------------------------
/junit5-testing-examples/src/test/resources/loadtesting/github_get_api_test_case.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Load testing- Git Hub GET API",
3 | "steps": [
4 | {
5 | "name": "get_user_details",
6 | "url": "/users/octocat",
7 | "operation": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "login" : "octocat",
14 | "id" : 583231,
15 | "avatar_url" : "https://avatars3.githubusercontent.com/u/583231?v=4",
16 | "type" : "User",
17 | "name" : "The Octocat",
18 | "company" : "GitHub"
19 | }
20 | }
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/core/src/test/resources/unit_test_files/reports/03_multi_scenario_expected_report.json:
--------------------------------------------------------------------------------
1 | {
2 | "results": [
3 | {
4 | "scenarioName": "Loop Scenario - Will Get A bath Room",
5 | "steps": [
6 | {
7 | "name": "get_shower_room"
8 | },
9 | {
10 | "name": "get_another_shower_room"
11 | }
12 | ]
13 | },
14 | {
15 | "scenarioName": "Loop Scenario - Will Get A bath Room",
16 | "loop": 1,
17 | "steps": [
18 | {
19 | "name": "get_shower_room"
20 | },
21 | {
22 | "name": "get_another_shower_room"
23 | }
24 | ]
25 | }
26 | ]
27 | }
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/helloworld/get_api_integration_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "As simple GET API - Inetgration Test - Local Server",
3 | "steps": [
4 | {
5 | "name": "find_match",
6 | "url": "/api/v1/search/persons",
7 | "method": "GET",
8 | "request": {
9 | "queryParams": {
10 | "lang": "Amazing",
11 | "city": "Lon"
12 | }
13 | },
14 | "verify": {
15 | "status": 200,
16 | "body": {
17 | "exactMatches": true,
18 | "name": "Mr Bean",
19 | "lang": "Amazing",
20 | "city": "Lon"
21 | }
22 | }
23 | }
24 | ]
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/core/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | target/logs/zerocode_rest_bdd_logs.log
5 | true
6 |
7 | %d [%thread] %-5level %logger{100} - %msg%n
8 |
9 |
10 |
11 |
12 |
13 |
14 | %d %green([%thread]) %highlight(%level) %logger{100} - %blue(%msg%n)
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/core/src/test/resources/integration_test_files/host_keys/property_reading_into_test_step_test.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "New property keys from host config file",
3 | "steps": [
4 | {
5 | "name": "get_api_call",
6 | "url": "${web.application.endpoint.host}:${web.application.endpoint.port}/home/bathroom/1",
7 | "operation": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200
12 | }
13 | },
14 | {
15 | "name": "get_call_via_new_url",
16 | "url": "${my_new_url}/home/bathroom/1",
17 | "operation": "GET",
18 | "request": {
19 | },
20 | "assertions": {
21 | "status": 200
22 | }
23 | }
24 |
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/helloworldjavaexec/hello_world_java_method_return_assertions.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Java method return as JSON assertions",
3 | "steps": [
4 | {
5 | "name": "execute_java_method",
6 | "url": "org.jsmart.zerocode.zerocodejavaexec.DbSqlExecutor",
7 | "method": "fetchDbCustomers",
8 | "request": "select id, name from customers",
9 | "assertions": {
10 | "results": [
11 | {
12 | "id": 1,
13 | "name": "Elon Musk"
14 | },
15 | {
16 | "id": 2,
17 | "name": "Jeff Bezos"
18 | }
19 | ]
20 |
21 | }
22 | }
23 | ]
24 | }
25 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldignorestepfailures/HelloWorldIgnoreStepFailuresTest.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.testhelp.tests.helloworldignorestepfailures;
2 |
3 | import org.jsmart.zerocode.core.domain.JsonTestCase;
4 | import org.jsmart.zerocode.core.domain.TargetEnv;
5 | import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner;
6 | import org.junit.Test;
7 | import org.junit.runner.RunWith;
8 |
9 | @TargetEnv("github_host.properties")
10 | @RunWith(ZeroCodeUnitRunner.class)
11 | public class HelloWorldIgnoreStepFailuresTest {
12 |
13 | // final outcome is Fail, but all steps executed
14 | @Test
15 | @JsonTestCase("helloworld_ignore_step_failures/ignore_step_failures_exec_all.json")
16 | public void testMultiStepIgnoreStepFailures_execAll() throws Exception {
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/http-testing-examples/src/test/resources/parameterized_csv/hello_world_test_parameterized_csv_source_files.json:
--------------------------------------------------------------------------------
1 | {
2 | "scenarioName": "Fetch and assert GitHub userIds by their userNames",
3 | "steps": [
4 | {
5 | "name": "get_user_details",
6 | "url": "/users/${0}",
7 | "method": "GET",
8 | "request": {
9 | },
10 | "assertions": {
11 | "status": 200,
12 | "body": {
13 | "login" : "${0}",
14 | "type" : "User",
15 | "name" : "${1}",
16 | "location" : "${2}",
17 | "id" : "$EQ.${3}"
18 | }
19 | }
20 | }
21 | ],
22 | "parameterized": {
23 | "csvSource":"parameterized_csv/params.csv"
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/junit5-testing-examples/src/test/java/org/jsmart/zerocode/tests/jupiter/JUnit5Test.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.tests.jupiter;
2 |
3 | import org.jsmart.zerocode.tests.postgres.ExtensionA;
4 | import org.jsmart.zerocode.tests.postgres.ExtensionB;
5 | import org.junit.jupiter.api.Test;
6 | import org.junit.jupiter.api.extension.ExtendWith;
7 |
8 | import static java.lang.System.out;
9 | import static org.junit.jupiter.api.Assertions.assertTrue;
10 |
11 | @ExtendWith({ExtensionA.class, ExtensionB.class})
12 | public class JUnit5Test {
13 |
14 | @Test
15 | public void testX() {
16 | out.println("*JUnit5 ---> testX()");
17 | assertTrue(2 == 2); //jupiter assert
18 | }
19 |
20 | @Test
21 | public void testY() {
22 | out.println("*JUnit5 ---> testY()");
23 | assertTrue(2 == 2); //jupiter assert
24 | }
25 |
26 | }
--------------------------------------------------------------------------------
/core/src/main/java/org/jsmart/zerocode/core/di/provider/JacksonCsvParserAdapter.java:
--------------------------------------------------------------------------------
1 | package org.jsmart.zerocode.core.di.provider;
2 |
3 | import com.fasterxml.jackson.databind.ObjectReader;
4 | import org.apache.commons.lang3.StringUtils;
5 |
6 | import java.io.IOException;
7 | import java.io.StringReader;
8 |
9 | public class JacksonCsvParserAdapter implements CsvParserInterface {
10 |
11 | private final ObjectReader mapper;
12 | public JacksonCsvParserAdapter(final ObjectReader mapper) {
13 | this.mapper = mapper;
14 | }
15 | @Override
16 | public String[] parseLine(final String line) throws IOException {
17 | if (StringUtils.isEmpty(line)) return null ;
18 | if(line.trim().isEmpty()) {
19 | return new String[]{ null };
20 | }
21 | return mapper.readValue(new StringReader(line));
22 | }
23 | }
24 |
--------------------------------------------------------------------------------