Coder Social home page Coder Social logo

rebar3_tsung's Introduction

rebar3_tsung

Join the chat at https://gitter.im/zyuyou/rebar3_tsung

A rebar plugin for helping develop Tsung plugin

Build

$ rebar3 compile

Use

rebar3 new a lib project, Add the plugin to your rebar config:

{plugins, [
    { rebar3_tsung, ".*", {git, "git@host:user/rebar3_tsung.git", {tag, "0.1.0"}}}
]}.

Then just call your plugin directly in an existing application:

$ rebar3 tsung
===> Fetching rebar3_tsung
===> Compiling rebar3_tsung
<Plugin Output>

Example

Add tsung config to rebar.config.

{tsung, [
%%    {root, "tsung"},          % default is "tsung"
%%    {config, "tsung.xml"},    % default is {{root}}/tsung.xml
%%    {dtd, "tsung-1.0.dtd"},   % default is {{root}}/tsung-1.0.dtd
%%    {log_dir, "log"}          % default is {{root}}/log
%%    {timeout, 300000}         % default is 300000

    {plugins, [
        % {PluginName :: atom(), Attrs :: list(Attr()), IsEmpty:: bool()}
        % Attr() :: {AttrName:: atom(), CDATA | list(enum()), Default},
        % enum() :: atom()
        {foo, [
            {type, [connect, bar], required},
            {msg, cdata, implied}
        ]}
    ]}
]}.
  1. Call rebar3 tsung new dtd will generate an dtd-file from plugins config, some code would like below:
  1. Call rebar3 tsung will run tsung ...args start which has flag like -X _build/default/lib/{{tsung_plugin_lib}}/ebin.
<!ATTLIST session
    name         CDATA #REQUIRED
    bidi         CDATA #IMPLIED
    persistent   (true | false) #IMPLIED
    probability   NMTOKEN #IMPLIED
    weight        NMTOKEN #IMPLIED
    type         (ts_jabber | ts_http | ts_raw | ts_pgsql | ts_ldap | ts_webdav |ts_mysql| ts_fs | ts_shell | ts_job | ts_websocket | ts_amqp | ts_mqtt | **ts_foo**) #REQUIRED>
<!ELEMENT change_type EMPTY>
<!ATTLIST change_type
     new_type         (ts_jabber | ts_http | ts_raw | ts_pgsql | ts_ldap | ts_webdav | ts_mysql | ts_fs | ts_shell | ts_job | ts_websocket | ts_amqp | ts_mqtt | **ts_foo**) #REQUIRED
     host NMTOKEN #REQUIRED
     port NMTOKEN #REQUIRED
     server_type NMTOKEN #REQUIRED
     store  ( true | false ) "false"
     restore ( true | false ) "false"
     bidi ( true | false ) "false"
    >
<!ELEMENT foo (#PCDATA) >
<!ATTLIST foo
   type (connect | bar) #REQUIRED
   msg CDATA #IMPLIED>

rebar3_tsung's People

Contributors

zyuyou avatar gitter-badger avatar

Stargazers

 avatar Kamil Chmielewski avatar

Watchers

James Cloos avatar  avatar  avatar

Forkers

gitter-badger

rebar3_tsung's Issues

sh: line 0: exec: tsung: not found

rebar3 version info:

$ rebar3 -v
rebar 3.1.1 on Erlang/OTP 18 Erts 7.3

I create a lib project with following command:

➜  tsung rebar3 new lib ts_test
===> Writing ts_test/src/ts_test.erl
===> Writing ts_test/src/ts_test.app.src
===> Writing ts_test/rebar.config
===> Writing ts_test/.gitignore
===> Writing ts_test/LICENSE
===> Writing ts_test/README.md

Then, add plugin config to rebar.config

{erl_opts, [debug_info]}.
{deps, []}.
{plugins, [rebar3_tsung]}.

{tsung, [
%%    {root, "tsung"},          % default is "tsung"
%%    {config, "tsung.xml"},    % default is {{root}}/tsung.xml
%%    {dtd, "tsung-1.0.dtd"},   % default is {{root}}/tsung-1.0.dtd
%%    {log_dir, "log"}          % default is {{root}}/log
%%    {timeout, 300000}         % default is 300000

    {plugins, [
        % {PluginName :: atom(), Attrs :: list(Attr()), IsEmpty:: bool()}
        % Attr() :: {AttrName:: atom(), CDATA | list(enum()), Default},
        % enum() :: atom()
        {test, [
            {type, [connect, bar], required},
            {msg, cdata, implied}
        ]}
    ]}
]}.
rebar3 compile
===> Fetching rebar3_tsung ({pkg,<<"rebar3_tsung">>,<<"0.1.2">>})
===> Downloaded package, caching at /Users/hezhiqiang/.cache/rebar3/hex/default/packages/rebar3_tsung-0.1.2.tar
===> Compiling rebar3_tsung
===> Verifying dependencies...
===> Compiling ts_test

Error result when run rebar3 tsung:

➜ rebar3 tsung
===> Verifying dependencies...
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace
===> When submitting a bug report, please include the output of `rebar3 report "your command"`

DEBUG INFO:

➜ DEBUG=1 rebar3 tsung 
===> Load global config file /Users/hezhiqiang/.config/rebar3/rebar.config
===> Expanded command sequence to be run: [{default,app_discovery},
                                                  {default,install_deps},
                                                  {default,lock},
                                                  {default,tsung}]
===> Not adding provider default tsung from module rebar3_tsung_prv because it already exists from module rebar3_tsung_prv
===> Not adding provider default tsung from module rebar3_tsung_prv because it already exists from module rebar3_tsung_prv
===> Verifying dependencies...
===> Uncaught error in rebar_core. Run with DEBUG=1 to see stacktrace
===> Uncaught error: {badmatch,false}
===> Stack trace to the error location: [{rebar3_tsung_prv,do,1,
                                                 [{file,
                                                   "/Users/hezhiqiang/ElixirProjects/tsung/ts_test/_build/default/plugins/rebar3_tsung/src/rebar3_tsung_prv.erl"},
                                                  {line,71}]},
                                                {rebar_core,do,2,
                                                 [{file,
                                                   "/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar_core.erl"},
                                                  {line,125}]},
                                                {rebar3,main,1,
                                                 [{file,
                                                   "/home/tristan/Devel/rebar3/_build/default/lib/rebar/src/rebar3.erl"},
                                                  {line,56}]},
                                                {escript,run,2,
                                                 [{file,"escript.erl"},
                                                  {line,757}]},
                                                {escript,start,1,
                                                 [{file,"escript.erl"},
                                                  {line,277}]},
                                                {init,start_it,1,[]},
                                                {init,start_em,1,[]}]
===> When submitting a bug report, please include the output of `rebar3 report "your command"`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.