diff --git a/http-testing/pom.xml b/http-testing/pom.xml index 971000460..6c50c7649 100644 --- a/http-testing/pom.xml +++ b/http-testing/pom.xml @@ -63,6 +63,7 @@ org.jsmart.zerocode.testhelp.tests.helloworldjavaexec.HelloWorldJavaApiAsProtocolTest org.jsmart.zerocode.testhelp.tests.helloworldarrayelementmatching.HelloWorldArrayElementPickerTest org.jsmart.zerocode.testhelp.tests.helloworldimplicitdelay.JustHelloImplicitDelayTimeOutTest + org.jsmart.zerocode.testhelp.tests.helloworldfileupload.HelloWorldFileUploadTest diff --git a/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldfileupload/HelloWorldFileUploadTest.java b/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldfileupload/HelloWorldFileUploadTest.java new file mode 100644 index 000000000..ea805ce84 --- /dev/null +++ b/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldfileupload/HelloWorldFileUploadTest.java @@ -0,0 +1,17 @@ +package org.jsmart.zerocode.testhelp.tests.helloworldfileupload; + +import org.jsmart.zerocode.core.domain.Scenario; +import org.jsmart.zerocode.core.domain.TargetEnv; +import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner; +import org.junit.Test; +import org.junit.runner.RunWith; + +@TargetEnv("postman_echo_host.properties") +@RunWith(ZeroCodeUnitRunner.class) +public class HelloWorldFileUploadTest { + + @Test + @Scenario("helloworld_file_upload/hello_world_file_upload_test.json") + public void testFileUpload() throws Exception { + } +} diff --git a/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldjavaexec/SecurityHeaderTokenDynamicTest.java b/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldjavaexec/SecurityHeaderTokenDynamicTest.java index 05ba28a0c..08f17d54c 100644 --- a/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldjavaexec/SecurityHeaderTokenDynamicTest.java +++ b/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldjavaexec/SecurityHeaderTokenDynamicTest.java @@ -1,6 +1,6 @@ package org.jsmart.zerocode.testhelp.tests.helloworldjavaexec; -import org.jsmart.zerocode.core.domain.JsonTestCase; +import org.jsmart.zerocode.core.domain.Scenario; import org.jsmart.zerocode.core.domain.TargetEnv; import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner; import org.junit.Test; @@ -11,7 +11,7 @@ public class SecurityHeaderTokenDynamicTest { @Test - @JsonTestCase("helloworldjavaexec/hello_world_security_token_for_header_test.json") + @Scenario("helloworldjavaexec/hello_world_security_token_for_header_test.json") public void testNewHeaderToken() throws Exception { } diff --git a/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldproperties/HelloWorldPropertiesReadingTest.java b/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldproperties/HelloWorldPropertiesReadingTest.java index 3635227f6..a92d0d753 100644 --- a/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldproperties/HelloWorldPropertiesReadingTest.java +++ b/http-testing/src/test/java/org/jsmart/zerocode/testhelp/tests/helloworldproperties/HelloWorldPropertiesReadingTest.java @@ -1,6 +1,6 @@ package org.jsmart.zerocode.testhelp.tests.helloworldproperties; -import org.jsmart.zerocode.core.domain.JsonTestCase; +import org.jsmart.zerocode.core.domain.Scenario; import org.jsmart.zerocode.core.domain.TargetEnv; import org.jsmart.zerocode.core.runner.ZeroCodeUnitRunner; import org.junit.Test; @@ -11,12 +11,12 @@ public class HelloWorldPropertiesReadingTest { @Test - @JsonTestCase("helloworld_properties_reading/read_properties_into_test_steps.json") + @Scenario("helloworld_properties_reading/read_properties_into_test_steps.json") public void test_aPropertyKeyValue() throws Exception { } @Test - @JsonTestCase("helloworld_properties_reading/use_common_SAML_token_as_headers.json") + @Scenario("helloworld_properties_reading/use_common_SAML_token_as_headers.json") public void test_useCommonSAMLToken() throws Exception { } diff --git a/http-testing/src/test/resources/helloworld_file_upload/hello_world_file_upload_test.json b/http-testing/src/test/resources/helloworld_file_upload/hello_world_file_upload_test.json new file mode 100644 index 000000000..5657926f8 --- /dev/null +++ b/http-testing/src/test/resources/helloworld_file_upload/hello_world_file_upload_test.json @@ -0,0 +1,26 @@ +{ + "scenarioName": "Assert that file has been uploaded successfully", + "steps": [ + { + "name": "post_file", + "url": "/post", + "method": "POST", + "request": { + "headers": { + "Content-Type": "multipart/form-data" + }, + "body": { + "files": ["file:helloworld_file_upload/textfile.txt"] + } + }, + "verify": { + "status": 200, + "body": { + "files": { + "['textfile.txt']": "data:application/octet-stream;base64,SGVsbG9Xb3JsZA==" + } + } + } + } + ] +} \ No newline at end of file diff --git a/http-testing/src/test/resources/helloworld_file_upload/textfile.txt b/http-testing/src/test/resources/helloworld_file_upload/textfile.txt new file mode 100644 index 000000000..8970971f1 --- /dev/null +++ b/http-testing/src/test/resources/helloworld_file_upload/textfile.txt @@ -0,0 +1 @@ +HelloWorld \ No newline at end of file diff --git a/http-testing/src/test/resources/postman_echo_host.properties b/http-testing/src/test/resources/postman_echo_host.properties new file mode 100644 index 000000000..a65941cbc --- /dev/null +++ b/http-testing/src/test/resources/postman_echo_host.properties @@ -0,0 +1,6 @@ +# Web Server host and port +web.application.endpoint.host=https://postman-echo.com +# Web Service Port; Leave it blank in case it is default port i.e. 80 or 443 etc +web.application.endpoint.port= +# Web Service context; Leave it blank in case you do not have a common context +web.application.endpoint.context=