Skip to content

Commit

Permalink
[internal & refactor] add jacoco plugin, fix test code
Browse files Browse the repository at this point in the history
  • Loading branch information
dongseoki committed Dec 17, 2023
1 parent f5f7e30 commit 586b3d4
Show file tree
Hide file tree
Showing 5 changed files with 192 additions and 42 deletions.
95 changes: 95 additions & 0 deletions crawling/avg.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"def average_decimal_from_percentage_range(percentage_range):\n",
" # Split the range into lower and upper bounds\n",
" lower, upper = map(float, percentage_range.strip('%').split('~'))\n",
"\n",
" # Calculate the average\n",
" average_decimal = (lower + upper) / 2\n",
"\n",
" return average_decimal\n",
"\n",
"# Test the function\n",
"percentage_range_1 = \"14~15%\"\n",
"percentage_range_2 = \"16.5~18.6%\"\n",
"\n",
"average_decimal_1 = average_decimal_from_percentage_range(percentage_range_1)\n",
"average_decimal_2 = average_decimal_from_percentage_range(percentage_range_2)\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"14.5"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"average_decimal_1\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"17.55"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"average_decimal_2"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
79 changes: 42 additions & 37 deletions crawling/jsonToRequestFinal prd.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import re\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -171,7 +176,7 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -210,7 +215,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -233,7 +238,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand All @@ -248,7 +253,7 @@
" 'Finish': '오크, 견과류, 강렬한'}}"
]
},
"execution_count": 5,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -259,65 +264,65 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0\n",
"Time spent: 0.0005037784576416016 seconds\n",
"Time spent: 0.00016379356384277344 seconds\n",
"100\n",
"Time spent: 2.3976569175720215 seconds\n",
"Time spent: 5.282529830932617 seconds\n",
"200\n",
"Time spent: 4.399032831192017 seconds\n",
"Time spent: 9.038448810577393 seconds\n",
"300\n",
"Time spent: 6.423213958740234 seconds\n",
"Time spent: 12.740983724594116 seconds\n",
"400\n",
"Time spent: 8.675644874572754 seconds\n",
"Time spent: 16.26521873474121 seconds\n",
"500\n",
"Time spent: 11.454974889755249 seconds\n",
"Time spent: 19.59007477760315 seconds\n",
"600\n",
"Time spent: 13.775301933288574 seconds\n",
"Time spent: 22.958903789520264 seconds\n",
"700\n",
"Time spent: 16.026554822921753 seconds\n",
"Time spent: 26.34813165664673 seconds\n",
"800\n",
"Time spent: 18.560529947280884 seconds\n",
"Time spent: 29.60022473335266 seconds\n",
"900\n",
"Time spent: 21.04695200920105 seconds\n",
"Time spent: 33.73060584068298 seconds\n",
"1000\n",
"Time spent: 23.664711952209473 seconds\n",
"Time spent: 37.11545395851135 seconds\n",
"1100\n",
"Time spent: 26.370426893234253 seconds\n",
"Time spent: 40.234336614608765 seconds\n",
"1200\n",
"Time spent: 29.24735689163208 seconds\n",
"Time spent: 43.431806802749634 seconds\n",
"1300\n",
"Time spent: 32.33311891555786 seconds\n",
"Time spent: 46.53055787086487 seconds\n",
"1400\n",
"Time spent: 35.3498649597168 seconds\n",
"Time spent: 49.68968081474304 seconds\n",
"1500\n",
"Time spent: 39.01486897468567 seconds\n",
"Time spent: 53.08196783065796 seconds\n",
"1600\n",
"Time spent: 42.23234796524048 seconds\n",
"Time spent: 56.44183564186096 seconds\n",
"1700\n",
"Time spent: 45.475361824035645 seconds\n",
"Time spent: 59.66334795951843 seconds\n",
"1800\n",
"Time spent: 48.78619885444641 seconds\n",
"Time spent: 63.13595485687256 seconds\n",
"1900\n",
"Time spent: 52.07514190673828 seconds\n",
"Time spent: 66.41015982627869 seconds\n",
"2000\n",
"Time spent: 55.49247479438782 seconds\n",
"Time spent: 70.04686284065247 seconds\n",
"2100\n",
"Time spent: 59.141927003860474 seconds\n",
"Time spent: 73.3049168586731 seconds\n",
"2200\n",
"Time spent: 62.84601187705994 seconds\n",
"Time spent: 76.47569274902344 seconds\n",
"2300\n",
"Time spent: 66.5096538066864 seconds\n",
"Time spent: 79.69447684288025 seconds\n",
"2400\n",
"Time spent: 70.4407548904419 seconds\n",
"Time spent: 82.88502764701843 seconds\n",
"2500\n",
"Time spent: 74.2739417552948 seconds\n"
"Time spent: 85.94225072860718 seconds\n"
]
}
],
Expand Down Expand Up @@ -363,7 +368,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -376,16 +381,16 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"defaultdict(int, {400: 53, 201: 2507})"
"defaultdict(int, {201: 2509, 400: 51})"
]
},
"execution_count": 23,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
Expand Down
42 changes: 42 additions & 0 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ plugins {
id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.1.3'
// id "com.ewerk.gradle.plugins.querydsl" version "1.0.10"
id 'jacoco'
}

group = 'com.bside'
Expand Down Expand Up @@ -91,6 +92,47 @@ tasks.named('test') {
useJUnitPlatform()
}

test {
useJUnitPlatform()
jacoco {
destinationFile = file("$buildDir/jacoco/jacoco.exec")
}
finalizedBy jacocoTestReport // report is always generated after tests run
}

jacoco {
// JaCoCo 버전
toolVersion = '0.8.8'
}

jacocoTestReport {
dependsOn test
reports {
html.required.set(true)
xml.required.set(false)
csv.required.set(false)

html.destination file("$buildDir/jacocoHtml")
}
}

jacocoTestCoverageVerification {
violationRules {
rule {
element = 'CLASS'
limit {
counter = 'INSTRUCTION'
value = 'COVEREDRATIO'
minimum = 0.00
}
excludes = [
'**.*Dto.*',
'**.Application.*'
]
}
}
}

//def querydslDir = "$buildDir/generated/querydsl"
//
//querydsl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ void user_follow_success() throws Exception {
@Test
@DisplayName("유저 언팔로우. 성공.")
void user_unfollow_success() throws Exception {
mockMvc.perform(post(String.format("/user/follow/%d", 2))
mockMvc.perform(post(String.format("/user/unfollow/%d", 2))
.header("Authorization", "Bearer " + userAccessToken))
.andExpect(status().isOk());
}
Expand Down
Loading

0 comments on commit 586b3d4

Please sign in to comment.