Skip to content

Commit

Permalink
PR - Merge pull request #600 from wojdeb/FileUpload
Browse files Browse the repository at this point in the history
added helloworld example of upload files using POST
  • Loading branch information
authorjapps authored Nov 1, 2023
2 parents 8ebdd66 + 7fc3b0c commit 6ef5f20
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 5 deletions.
1 change: 1 addition & 0 deletions http-testing/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
<include>org.jsmart.zerocode.testhelp.tests.helloworldjavaexec.HelloWorldJavaApiAsProtocolTest</include>
<include>org.jsmart.zerocode.testhelp.tests.helloworldarrayelementmatching.HelloWorldArrayElementPickerTest</include>
<include>org.jsmart.zerocode.testhelp.tests.helloworldimplicitdelay.JustHelloImplicitDelayTimeOutTest</include>
<include>org.jsmart.zerocode.testhelp.tests.helloworldfileupload.HelloWorldFileUploadTest</include>
</includes>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
}
}
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {

}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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=="
}
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
HelloWorld
6 changes: 6 additions & 0 deletions http-testing/src/test/resources/postman_echo_host.properties
Original file line number Diff line number Diff line change
@@ -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=

0 comments on commit 6ef5f20

Please sign in to comment.