Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
22365063
Unverified
Commit
22365063
authored
Sep 10, 2020
by
yann300
Committed by
GitHub
Sep 10, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #394 from ethereum/unitTestingAssert
Added expected vs received values for tests in SUT plugin
parents
a0ef2216
f90233c3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
5 deletions
+27
-5
solidityUnittests.test.ts
apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts
+1
-2
test-tab.js
apps/remix-ide/src/app/tabs/test-tab.js
+26
-3
No files found.
apps/remix-ide-e2e/src/tests/solidityUnittests.test.ts
View file @
22365063
...
@@ -172,8 +172,7 @@ function runTests (browser: NightwatchBrowser) {
...
@@ -172,8 +172,7 @@ function runTests (browser: NightwatchBrowser) {
.
pause
(
500
)
.
pause
(
500
)
.
scrollAndClick
(
'#runTestsTabRunAction'
)
.
scrollAndClick
(
'#runTestsTabRunAction'
)
.
waitForElementPresent
(
'*[data-id="testTabSolidityUnitTestsOutputheader"]'
,
40000
)
.
waitForElementPresent
(
'*[data-id="testTabSolidityUnitTestsOutputheader"]'
,
40000
)
.
pause
(
5000
)
.
waitForElementPresent
(
'#solidityUnittestsOutput div[class^="testPass"]'
,
7000
)
.
waitForElementPresent
(
'#solidityUnittestsOutput div[class^="testPass"]'
)
.
assert
.
containsText
(
'#solidityUnittestsOutput'
,
'browser/tests/4_Ballot_test.sol'
)
.
assert
.
containsText
(
'#solidityUnittestsOutput'
,
'browser/tests/4_Ballot_test.sol'
)
.
assert
.
containsText
(
'#solidityUnittestsOutput'
,
'✓ Check winning proposal'
)
.
assert
.
containsText
(
'#solidityUnittestsOutput'
,
'✓ Check winning proposal'
)
.
assert
.
containsText
(
'#solidityUnittestsOutput'
,
'✓ Check winnin proposal with return value'
)
.
assert
.
containsText
(
'#solidityUnittestsOutput'
,
'✓ Check winnin proposal with return value'
)
...
...
apps/remix-ide/src/app/tabs/test-tab.js
View file @
22365063
...
@@ -144,17 +144,40 @@ module.exports = class TestTab extends ViewPlugin {
...
@@ -144,17 +144,40 @@ module.exports = class TestTab extends ViewPlugin {
this
.
testsOutput
.
appendChild
(
this
.
outputHeader
)
this
.
testsOutput
.
appendChild
(
this
.
outputHeader
)
}
else
if
(
result
.
type
===
'testPass'
)
{
}
else
if
(
result
.
type
===
'testPass'
)
{
this
.
testsOutput
.
appendChild
(
yo
`
this
.
testsOutput
.
appendChild
(
yo
`
<div id="
${
this
.
runningTestFileName
}
" data-id="testTabSolidityUnitTestsOutputheader" class="
${
css
.
testPass
}
${
css
.
testLog
}
text-success border-0">
<div id="
${
this
.
runningTestFileName
}
" data-id="testTabSolidityUnitTestsOutputheader" class="
${
css
.
testPass
}
${
css
.
testLog
}
bg-light mb-2
text-success border-0">
✓
${
result
.
value
}
✓
${
result
.
value
}
</div>
</div>
`
)
`
)
}
else
if
(
result
.
type
===
'testFailure'
)
{
}
else
if
(
result
.
type
===
'testFailure'
)
{
if
(
!
result
.
assertMethod
)
{
this
.
testsOutput
.
appendChild
(
yo
`
this
.
testsOutput
.
appendChild
(
yo
`
<div class="
${
css
.
testFailure
}
${
css
.
testLog
}
d-flex flex-column text-danger border-0" id="UTContext
${
result
.
context
}
">
<div class="
bg-light mb-2
${
css
.
testFailure
}
${
css
.
testLog
}
d-flex flex-column text-danger border-0" id="UTContext
${
result
.
context
}
">
<span> ✘
${
result
.
value
}
</span>
<span> ✘
${
result
.
value
}
</span>
<span>"
${
result
.
errMsg
}
"</span>
<span class="text-dark">Error Message:</span>
<span class="pb-2 text-break">"
${
result
.
errMsg
}
"</span>
</div>
</div>
`
)
`
)
}
else
{
const
preposition
=
result
.
assertMethod
===
'equal'
||
result
.
assertMethod
===
'notEqual'
?
'to'
:
''
const
method
=
result
.
assertMethod
===
'ok'
?
''
:
result
.
assertMethod
const
expected
=
result
.
assertMethod
===
'ok'
?
`'true'`
:
result
.
expected
this
.
testsOutput
.
appendChild
(
yo
`
<div class="bg-light mb-2
${
css
.
testFailure
}
${
css
.
testLog
}
d-flex flex-column text-danger border-0" id="UTContext
${
result
.
context
}
">
<span> ✘
${
result
.
value
}
</span>
<span class="text-dark">Error Message:</span>
<span class="pb-2 text-break">"
${
result
.
errMsg
}
"</span>
<span class="text-dark">Assertion:</span>
<div class="d-flex flex-wrap">
<span>Expected value should be</span>
<div class="mx-1 font-weight-bold">
${
method
}
</div>
<div>
${
preposition
}
${
expected
}
</div>
</div>
<span class="text-dark">Received value:</span>
<span>
${
result
.
returned
}
</span>
<span class="text-dark text-sm pb-2">Skipping the remaining tests of the function.</span>
</div>
`
)
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment