-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test to measure performance of data as code approach against common data in csv files Remove unused ClassLoadedCounter.kt class. Rename test sample classes. Move memory dump creation logic to SimpleBaseTest.kt
- Loading branch information
Dzmitry Sankouski
committed
Mar 13, 2022
1 parent
a0b7229
commit 561a432
Showing
10 changed files
with
160 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
testng-core/src/test/kotlin/org/testng/dataprovider/sample/issue2724/ClassLoadedCounter.kt
This file was deleted.
Oops, something went wrong.
23 changes: 23 additions & 0 deletions
23
testng-core/src/test/kotlin/org/testng/dataprovider/sample/issue2724/SampleDPUnloaded.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.testng.dataprovider.sample.issue2724 | ||
|
||
import jlibs.core.lang.RuntimeUtil | ||
import org.testng.annotations.AfterClass | ||
import org.testng.annotations.Test | ||
import test.SimpleBaseTest | ||
|
||
class SampleDPUnloaded { | ||
@Suppress("UNUSED_PARAMETER") | ||
@Test( | ||
dataProviderDynamicClass = "org.testng.dataprovider.sample.issue2724.DataProviders", | ||
dataProvider = "data" | ||
) | ||
fun testDynamicDataProvider(name: String, age: Int, status: String) { | ||
|
||
} | ||
|
||
@AfterClass | ||
fun afterTest() { | ||
RuntimeUtil.gc(10) | ||
SimpleBaseTest.saveMemDump(System.getProperty("memdump.path")) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
testng-core/src/test/kotlin/org/testng/dataprovider/sample/issue2724/SampleSimpleDP.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.testng.dataprovider.sample.issue2724 | ||
|
||
import org.testng.annotations.DataProvider | ||
import org.testng.annotations.Test | ||
|
||
class SampleSimpleDP { | ||
@Suppress("UNUSED_PARAMETER") | ||
@Test(dataProvider = "data") | ||
fun testDynamicDataProvider(name: String, age: Int, status: String) { | ||
|
||
} | ||
|
||
@DataProvider | ||
fun data() : Array<Array<Any>> { | ||
return arrayOf( | ||
arrayOf("Mike", 34, "student"), | ||
arrayOf("Mike", 23, "driver"), | ||
arrayOf("Paul", 20, "director") | ||
) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
testng-core/src/test/kotlin/org/testng/dataprovider/sample/issue2724/SampleWithCSVData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.testng.dataprovider.sample.issue2724 | ||
|
||
import org.testng.annotations.DataProvider | ||
import org.testng.annotations.Test | ||
|
||
class SampleWithCSVData { | ||
@Suppress("UNUSED_PARAMETER") | ||
@Test(dataProvider = "data") | ||
fun testDynamicDataProvider(name: String, age: Int, status: String) { | ||
|
||
} | ||
|
||
@DataProvider | ||
fun data() : Array<Array<Any>> { | ||
val fileInputStream = this::class.java.classLoader | ||
.getResourceAsStream("test/issue2724/data.csv") | ||
return fileInputStream.reader().readLines().map { | ||
it.split(",").toTypedArray<Any>() | ||
}.toTypedArray() | ||
} | ||
} |
36 changes: 0 additions & 36 deletions
36
testng-core/src/test/kotlin/org/testng/dataprovider/sample/issue2724/TestDPUnloaded.kt
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
testng-core/src/test/kotlin/org/testng/dataprovider/sample/issue2724/TestTimeListener.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package org.testng.dataprovider.sample.issue2724 | ||
|
||
import org.testng.ITestContext | ||
import org.testng.ITestListener | ||
|
||
class TestTimeListener : ITestListener { | ||
private var startTime: Long = 0 | ||
|
||
override fun onStart(context: ITestContext?) { | ||
startTime = System.currentTimeMillis() | ||
} | ||
|
||
override fun onFinish(context: ITestContext?) { | ||
testRunTime = System.currentTimeMillis() - startTime | ||
} | ||
|
||
companion object { | ||
var testRunTime: Long = 0 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Mike, 34, student | ||
Mike, 23, driver | ||
Paul, 20, director |