Commit 5e324727 authored by linj's avatar linj

support js auto test

parent 7f3d8602
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package autotest
import (
"github.com/33cn/chain33/cmd/autotest/types"
)
// JsCreateCase token createcase command
type JsCreateCase struct {
types.BaseCase
}
// JsCreatePack defines create package command
type JsCreatePack struct {
types.BaseCasePack
}
// SendCommand defines send command function of tokenprecreatecase
func (testCase *JsCreateCase) SendCommand(packID string) (types.PackFunc, error) {
return types.DefaultSend(testCase, &JsCreatePack{}, packID)
}
// Copyright Fuzamei Corp. 2018 All Rights Reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package autotest
import (
"reflect"
"github.com/33cn/chain33/cmd/autotest/types"
)
type jsAutoTest struct {
SimpleCaseArr []types.SimpleCase `toml:"SimpleCase,omitempty"`
JSCreateCaseArr []JsCreateCase `toml:"jsCreateCase,omitempty"`
}
func init() {
types.RegisterAutoTest(jsAutoTest{})
}
func (config jsAutoTest) GetName() string {
return "js"
}
func (config jsAutoTest) GetTestConfigType() reflect.Type {
return reflect.TypeOf(config)
}
# 1Q8hGLfoGe63efeWa8fJ4Pnukhkngt6poK manage addr
# 0xc34b5d9d44ac7b754806f761d3d4d2c4fe5214f6b074c19f069c4f5c2a29c8cc
[[jsCreateCase]]
id = "create1"
command = "send jsvm create -c ../../../plugin/dapp/js/executor/game.js -n hello -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
fail = true
[[jsCreateCase]]
id = "create2"
command = "send jsvm create -c ../../../plugin/dapp/js/executor/game.js -n hello -k 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt"
dep = ["create1", "configJS"]
[[SimpleCase]]
id = "configJS"
dep = ["create1"]
command = "send config config_tx -c js-creator -o add -v 14KEKbYtKKQm4wMthSK9J4La4nAiidGozt -k 0xc34b5d9d44ac7b754806f761d3d4d2c4fe5214f6b074c19f069c4f5c2a29c8cc"
\ No newline at end of file
......@@ -5,6 +5,9 @@ import (
"github.com/33cn/plugin/plugin/dapp/js/cmd"
"github.com/33cn/plugin/plugin/dapp/js/executor"
ptypes "github.com/33cn/plugin/plugin/dapp/js/types"
// init auto test
_ "github.com/33cn/plugin/plugin/dapp/js/autotest"
)
func init() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment